blob: 7c0846fbbb0ab35f0558904ab4e030efc519ab53 [file] [log] [blame]
/**
* This file was created using the `create_project.py` script located in the
* `<AndroidX root>/development/project-creator` directory.
*
* Please use that script when creating a new project, rather than copying an existing project and
* modifying its settings.
*/
import androidx.build.SoftwareType
import androidx.build.PlatformIdentifier
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
plugins {
id("AndroidXPlugin")
}
androidXMultiplatform {
androidLibrary {
namespace = "androidx.lifecycle.runtime"
withJava()
optimization {
it.consumerKeepRules.publish = true
it.consumerKeepRules.files.add(new File("proguard-rules.pro"))
}
androidResources.enable = true
// Needed for api tasks and docs generation
sourceSets {
androidMain {
kotlin.srcDirs += 'src/androidMain/java'
}
}
}
desktop()
mac()
linux()
ios()
watchos()
tvos()
mingwX64()
js()
wasmJs()
defaultPlatform(PlatformIdentifier.ANDROID)
sourceSets {
commonMain {
dependencies {
api(libs.kotlinStdlib)
api(project(":lifecycle:lifecycle-common"))
api("androidx.annotation:annotation:1.9.1")
}
}
commonTest {
dependencies {
implementation(project(":internal-testutils-lifecycle"))
implementation(libs.kotlinCoroutinesTest)
implementation(libs.kotlinTest)
implementation(project(":kruth:kruth"))
implementation(libs.atomicFu)
}
}
jvmMain {
dependsOn(commonMain)
dependencies {
api("androidx.arch.core:core-common:2.2.0")
}
}
jvmTest {
dependsOn(commonTest)
}
desktopMain {
dependsOn(jvmMain)
}
desktopTest {
dependsOn(jvmTest)
dependencies {
implementation(libs.kotlinCoroutinesSwing)
}
}
androidMain {
dependsOn(jvmMain)
dependencies {
api(libs.kotlinCoroutinesAndroid)
api(libs.jspecify)
implementation("androidx.core:core-viewtree:1.0.0")
implementation("androidx.arch.core:core-runtime:2.2.0")
implementation("androidx.profileinstaller:profileinstaller:1.4.0")
}
}
androidUnitTest {
dependsOn(jvmTest)
dependencies {
implementation(libs.junit)
implementation(libs.mockitoCore4)
}
}
androidInstrumentedTest {
dependsOn(jvmTest)
dependencies {
implementation("androidx.core:core-viewtree:1.0.0")
implementation(libs.junit)
implementation(libs.truth)
implementation(libs.testExtJunit)
implementation(libs.testCore)
implementation(libs.testRunner)
implementation(libs.kotlinCoroutinesTest)
}
}
nonJvmMain {
dependsOn(commonMain)
}
nonJvmTest {
dependsOn(commonTest)
}
nativeMain {
dependsOn(nonJvmMain)
// Required for WeakReference usage
languageSettings.optIn("kotlin.experimental.ExperimentalNativeApi")
}
nativeTest {
dependsOn(commonTest)
}
webMain {
dependsOn(nonJvmMain)
}
webTest {
dependsOn(nonJvmTest)
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
}
}
targets.configureEach { target ->
if (target.platformType == KotlinPlatformType.native) {
target.compilations["main"].defaultSourceSet {
dependsOn(nativeMain)
// Required for WeakReference usage
languageSettings.optIn("kotlin.experimental.ExperimentalNativeApi")
}
target.compilations["test"].defaultSourceSet {
dependsOn(nativeTest)
}
} else if (target.platformType in [KotlinPlatformType.js, KotlinPlatformType.wasm]) {
target.compilations["main"].defaultSourceSet.dependsOn(webMain)
target.compilations["test"].defaultSourceSet.dependsOn(webTest)
}
}
}
}
dependencies {
lintPublish(project(":lifecycle:lifecycle-runtime-lint"))
}
androidx {
name = "Lifecycle Runtime"
type = SoftwareType.PUBLISHED_LIBRARY
inceptionYear = "2017"
description = "Android Lifecycle Runtime"
}