blob: b9e1ccf449229947a4c15b89db95940946c55962 [file] [log] [blame]
/*
* Copyright 2018 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.
*/
/**
* 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.KotlinTarget
import androidx.build.LibraryType
import androidx.build.PlatformIdentifier
plugins {
id("AndroidXPlugin")
id("com.android.library")
alias(libs.plugins.kotlinSerialization)
}
androidXMultiplatform {
android()
desktop()
ios()
linux()
mac()
defaultPlatform(PlatformIdentifier.ANDROID)
sourceSets {
commonMain {
dependencies {
api("androidx.annotation:annotation:1.8.1")
api(project(":savedstate:savedstate"))
api(project(":lifecycle:lifecycle-viewmodel"))
api(libs.kotlinStdlib)
api(libs.kotlinCoroutinesCore)
api(libs.kotlinSerializationCore)
}
}
commonTest {
dependencies {
implementation(project(":lifecycle:lifecycle-runtime"))
implementation(libs.kotlinCoroutinesTest)
}
}
jvmMain {
dependsOn(commonMain)
}
jvmTest {
dependsOn(commonTest)
}
androidMain {
dependsOn(jvmMain)
dependencies {
api("androidx.core:core-ktx:1.2.0")
api(project(":lifecycle:lifecycle-livedata-core"))
api(libs.kotlinCoroutinesAndroid)
}
}
androidUnitTest {
dependsOn(jvmTest)
}
androidInstrumentedTest {
dependsOn(jvmTest)
dependencies {
implementation(project(":lifecycle:lifecycle-livedata-core"))
implementation ("androidx.fragment:fragment:1.3.0")
implementation(project(":internal-testutils-runtime"))
implementation(project(":lifecycle:lifecycle-viewmodel"))
implementation(libs.truth)
implementation(libs.testExtJunit)
implementation(libs.testCore)
implementation(libs.testRunner)
implementation(libs.testRules)
}
}
nonAndroidMain {
dependsOn(commonMain)
}
nonAndroidTest {
dependsOn(commonTest)
}
desktopMain {
dependsOn(jvmMain)
dependsOn(nonAndroidMain)
}
desktopTest {
dependsOn(jvmTest)
dependsOn(nonAndroidTest)
}
nativeMain {
dependsOn(commonMain)
dependsOn(nonAndroidMain)
}
nativeTest {
dependsOn(commonTest)
dependsOn(nonAndroidTest)
}
darwinMain {
dependsOn(nativeMain)
}
darwinTest {
dependsOn(nativeTest)
}
linuxMain {
dependsOn(nativeMain)
}
linuxTest {
dependsOn(nativeTest)
}
targets.configureEach { target ->
if (target.platformType == org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType.native) {
target.compilations["main"].defaultSourceSet {
def konanTargetFamily = target.konanTarget.family
if (konanTargetFamily == org.jetbrains.kotlin.konan.target.Family.OSX || konanTargetFamily == org.jetbrains.kotlin.konan.target.Family.IOS) {
dependsOn(darwinMain)
} else if (konanTargetFamily == org.jetbrains.kotlin.konan.target.Family.LINUX) {
dependsOn(linuxMain)
} else {
throw new GradleException("unknown native target ${target}")
}
}
target.compilations["test"].defaultSourceSet {
def konanTargetFamily = target.konanTarget.family
if (konanTargetFamily == org.jetbrains.kotlin.konan.target.Family.OSX || konanTargetFamily == org.jetbrains.kotlin.konan.target.Family.IOS) {
dependsOn(darwinTest)
} else if (konanTargetFamily == org.jetbrains.kotlin.konan.target.Family.LINUX) {
dependsOn(linuxTest)
} else {
throw new GradleException("unknown native target ${target}")
}
}
}
}
}
}
android {
buildTypes.configureEach {
consumerProguardFiles("proguard-rules.pro")
}
namespace = "androidx.lifecycle.viewmodel.savedstate"
experimentalProperties["android.lint.useK2Uast"] = false // TODO(b/345531033)
}
androidx {
name = "Lifecycle ViewModel with SavedState"
type = LibraryType.PUBLISHED_LIBRARY
inceptionYear = "2018"
description = "Android Lifecycle ViewModel"
samples(project(":lifecycle:lifecycle-viewmodel-savedstate-samples"))
kotlinTarget = KotlinTarget.KOTLIN_1_9
}