| /* |
| * 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 `createProject` gradle task (./gradlew createProject) |
| * |
| * Please use the task 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.konan.target.Family |
| import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType |
| |
| plugins { |
| id("AndroidXPlugin") |
| alias(libs.plugins.kotlinSerialization) |
| } |
| |
| androidXMultiplatform { |
| androidLibrary { |
| namespace = "androidx.lifecycle.viewmodel.savedstate" |
| } |
| desktop() |
| mac() |
| linux() |
| ios() |
| watchos() |
| tvos() |
| mingwX64() |
| js() |
| wasmJs() |
| |
| defaultPlatform(PlatformIdentifier.ANDROID) |
| |
| sourceSets { |
| commonMain.dependencies { |
| api("androidx.annotation:annotation:1.9.1") |
| api("androidx.savedstate:savedstate:1.4.0") |
| api(project(":lifecycle:lifecycle-viewmodel")) |
| implementation(project(":lifecycle:lifecycle-common")) |
| implementation("androidx.collection:collection:1.5.0") |
| api(libs.kotlinCoroutinesCore) |
| api(libs.kotlinSerializationCore) |
| } |
| |
| commonTest.dependencies { |
| implementation(project(":lifecycle:lifecycle-runtime-testing")) |
| implementation(project(":kruth:kruth")) |
| implementation(libs.kotlinTest) |
| implementation(libs.kotlinCoroutinesTest) |
| } |
| |
| androidMain.dependencies { |
| api("androidx.core:core-ktx:1.2.0") |
| api(project(":lifecycle:lifecycle-livedata-core")) |
| api(libs.kotlinCoroutinesAndroid) |
| } |
| |
| androidDeviceTest.dependencies { |
| implementation(project(":lifecycle:lifecycle-livedata-core")) |
| implementation("androidx.activity:activity:1.13.0") |
| 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) |
| } |
| |
| create("nonAndroidMain").dependsOn(commonMain) |
| desktopMain.dependsOn(nonAndroidMain) |
| nonJvmMain.dependsOn(nonAndroidMain) |
| } |
| } |
| |
| dependencies { |
| constraints { |
| // Prevents symbols duplication with old versions of JetBrains' fork. |
| // Starting with version 2.9.5, this module is published as empty artifact with dependency |
| // to this androidx module. |
| commonMainImplementation("org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-savedstate:2.9.5") { |
| because "prevents symbols duplication" |
| } |
| |
| // Fragment 1.2.0+ is the first version to use `SavedStateViewModelFactory` to handle |
| // saving and restoring state. This makes `LegacySavedStateHandleController` obsolete. |
| androidMainImplementation("androidx.fragment:fragment:1.2.0") { |
| because "SavedStateViewModelFactory replaces LegacySavedStateHandleController by default" |
| } |
| } |
| } |
| |
| androidx { |
| name = "Lifecycle ViewModel with SavedState" |
| type = SoftwareType.PUBLISHED_LIBRARY |
| inceptionYear = "2018" |
| description = "Android Lifecycle ViewModel" |
| samples(project(":lifecycle:lifecycle-viewmodel-savedstate-samples")) |
| } |