| /* |
| * Copyright (C) 2020 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| apply plugin: 'com.android.library' |
| apply plugin: 'kotlin-android' |
| |
| android { |
| namespace "androidx.databinding.ktx" |
| compileSdkVersion dataBindingConfig.compileSdkVersion |
| buildToolsVersion dataBindingConfig.buildToolsVersion |
| |
| defaultConfig { |
| minSdkVersion 14 |
| targetSdkVersion dataBindingConfig.targetSdkVersion |
| } |
| compileOptions { |
| sourceCompatibility dataBindingConfig.javaTargetCompatibility |
| targetCompatibility dataBindingConfig.javaSourceCompatibility |
| } |
| buildTypes { |
| release { |
| minifyEnabled false |
| } |
| } |
| packagingOptions { |
| exclude 'META-INF/LICENSE.txt' |
| exclude 'META-INF/NOTICE.txt' |
| } |
| |
| publishing { |
| singleVariant("release") |
| } |
| } |
| |
| tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { |
| kotlinOptions { |
| jvmTarget = dataBindingConfig.javaTargetCompatibility |
| } |
| } |
| |
| dependencies { |
| implementation project(':library') |
| implementation rootProject.ext.libs.kotlin_stdlib |
| api rootProject.ext.libs.coroutines |
| api rootProject.ext.libs.android_arch_lifecycle_runtime_ktx |
| // some of these lifecycle deps are unnecessary but we are keeping them to stay backwards |
| // compatible with the lifecycle-extensions dependency |
| api rootProject.libs.lifecycle_livedata |
| api rootProject.libs.lifecycle_process |
| api rootProject.libs.lifecycle_service |
| api rootProject.libs.lifecycle_viewmodel |
| } |
| |
| //create jar tasks |
| android.libraryVariants.all { variant -> |
| def name = variant.buildType.name |
| |
| if (name.equals(com.android.builder.core.BuilderConstants.DEBUG)) { |
| return // Skip debug builds. |
| } |
| def suffix = name.capitalize() |
| |
| def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) { |
| archiveClassifier.set('sources') |
| from android.sourceSets.main.java.srcDirs |
| } |
| } |
| |
| afterEvaluate { |
| publishing { |
| publications { |
| release(MavenPublication) { |
| artifactId = 'databinding-ktx' |
| from components.release |
| artifact tasks.named("sourceJarRelease") |
| |
| pom { |
| licenses { |
| license { |
| name = dataBindingConfig.licenseName |
| url = dataBindingConfig.licenseUrl |
| distribution = dataBindingConfig.licenseDistribution |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| task prebuildAar(type : Copy) { |
| dependsOn tasks.named("publish") |
| from "$buildDir/outputs/aar/databinding-ktx-release.aar" |
| into dataBindingConfig.prebuildFolder |
| rename { String fileName -> |
| "databinding-ktx.aar" |
| } |
| } |