Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Tiem Song | ee0da74 | 2024-01-03 14:08:46 -0800 | [diff] [blame] | 17 | /** |
| 18 | * This file was created using the `create_project.py` script located in the |
| 19 | * `<AndroidX root>/development/project-creator` directory. |
| 20 | * |
| 21 | * Please use that script when creating a new project, rather than copying an existing project and |
| 22 | * modifying its settings. |
| 23 | */ |
Kuan-Ying Chou | 73305d3 | 2024-10-29 17:27:51 +0000 | [diff] [blame] | 24 | |
| 25 | import androidx.build.KotlinTarget |
Omar Ismail | a3085e1e | 2024-04-23 19:11:16 +0100 | [diff] [blame] | 26 | import androidx.build.LibraryType |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 27 | import androidx.build.PlatformIdentifier |
Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 28 | |
| 29 | plugins { |
| 30 | id("AndroidXPlugin") |
| 31 | id("com.android.library") |
Louis Pullen-Freilich | c8a26b8 | 2021-06-03 18:11:39 +0100 | [diff] [blame] | 32 | id("AndroidXComposePlugin") |
Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 33 | } |
| 34 | |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 35 | androidXMultiplatform { |
| 36 | android() |
| 37 | desktop() |
Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 38 | |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 39 | defaultPlatform(PlatformIdentifier.ANDROID) |
Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 40 | |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 41 | sourceSets { |
| 42 | commonMain { |
Marcello Galhardo | 7a8b0a8 | 2024-03-20 11:26:09 +0000 | [diff] [blame] | 43 | dependencies { |
Aurimas | 6fee221 | 2024-08-30 00:38:08 +0000 | [diff] [blame] | 44 | api(project(":lifecycle:lifecycle-common")) |
| 45 | api(project(":lifecycle:lifecycle-viewmodel")) |
Aurimas Liutikas | 96f0b30 | 2024-07-25 15:49:23 -0700 | [diff] [blame] | 46 | api("androidx.annotation:annotation:1.8.1") |
Marcello Galhardo | 7a8b0a8 | 2024-03-20 11:26:09 +0000 | [diff] [blame] | 47 | api("androidx.compose.runtime:runtime:1.6.0") |
Marcello Galhardo | 7a8b0a8 | 2024-03-20 11:26:09 +0000 | [diff] [blame] | 48 | implementation(libs.kotlinStdlib) |
| 49 | } |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 50 | } |
Andrey Kulikov | af61f66 | 2021-02-03 19:48:53 +0000 | [diff] [blame] | 51 | |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 52 | commonTest { |
| 53 | // TODO(b/330323282): Move common dependencies here. |
| 54 | } |
| 55 | |
| 56 | androidMain { |
| 57 | dependsOn(commonMain) |
| 58 | dependencies { |
Aurimas | 6fee221 | 2024-08-30 00:38:08 +0000 | [diff] [blame] | 59 | api(project(":lifecycle:lifecycle-viewmodel-savedstate")) |
Marcello Galhardo | 2011234 | 2024-05-10 11:10:17 +0100 | [diff] [blame] | 60 | api("androidx.compose.ui:ui:1.6.0") |
Marcello Galhardo | 87fc3ece | 2024-03-27 14:53:26 +0000 | [diff] [blame] | 61 | // Converting `lifecycle-viewmodel-compose` to KMP and including a transitive |
| 62 | // dependency on `lifecycle-livedata-core` triggered a Gradle bug. Adding the |
| 63 | // `livedata` dependency directly works around the issue. |
| 64 | // See https://github.com/gradle/gradle/issues/14220 for details. |
Aurimas | 6fee221 | 2024-08-30 00:38:08 +0000 | [diff] [blame] | 65 | compileOnly(project(":lifecycle:lifecycle-livedata-core")) |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 66 | } |
| 67 | } |
| 68 | |
| 69 | androidInstrumentedTest { |
| 70 | dependsOn(commonTest) |
| 71 | dependencies { |
Aurimas | 6fee221 | 2024-08-30 00:38:08 +0000 | [diff] [blame] | 72 | implementation(project(":compose:ui:ui-test-junit4")) |
Marcello Galhardo | fc493ab | 2024-03-27 14:57:55 +0000 | [diff] [blame] | 73 | implementation(project(":compose:test-utils")) |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 74 | implementation(libs.testRules) |
| 75 | implementation(libs.testRunner) |
| 76 | implementation(libs.junit) |
| 77 | implementation(libs.truth) |
Marcello Galhardo | fc493ab | 2024-03-27 14:57:55 +0000 | [diff] [blame] | 78 | implementation("androidx.fragment:fragment:1.3.0") |
| 79 | implementation("androidx.appcompat:appcompat:1.3.0") |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 80 | // old version of common-java8 conflicts with newer version, because both have |
| 81 | // DefaultLifecycleEventObserver. |
| 82 | // Outside of androidx this is resolved via constraint added to lifecycle-common, |
| 83 | // but it doesn't work in androidx. |
| 84 | // See aosp/1804059 |
Aurimas | 6fee221 | 2024-08-30 00:38:08 +0000 | [diff] [blame] | 85 | implementation(project(":lifecycle:lifecycle-common-java8")) |
| 86 | implementation(project(":lifecycle:lifecycle-viewmodel-savedstate")) |
| 87 | implementation(project(":activity:activity-compose")) |
| 88 | implementation(project(":lifecycle:lifecycle-runtime-testing")) |
Marcello Galhardo | ee95558 | 2024-03-20 11:18:32 +0000 | [diff] [blame] | 89 | } |
| 90 | } |
| 91 | } |
Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 92 | } |
| 93 | |
Ben Trengrove | b5bcdcd | 2024-07-23 02:19:27 +0000 | [diff] [blame] | 94 | dependencies { |
| 95 | lintPublish(project(":lifecycle:lifecycle-viewmodel-compose-lint")) |
| 96 | } |
| 97 | |
Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 98 | androidx { |
| 99 | name = "Lifecycle ViewModel Compose" |
Omar Ismail | a3085e1e | 2024-04-23 19:11:16 +0100 | [diff] [blame] | 100 | type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS |
Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 101 | inceptionYear = "2021" |
| 102 | description = "Compose integration with Lifecycle ViewModel" |
Aurimas | 6fee221 | 2024-08-30 00:38:08 +0000 | [diff] [blame] | 103 | samples(project(":lifecycle:lifecycle-viewmodel-compose:lifecycle-viewmodel-compose-samples")) |
Kuan-Ying Chou | 73305d3 | 2024-10-29 17:27:51 +0000 | [diff] [blame] | 104 | kotlinTarget = KotlinTarget.KOTLIN_1_9 |
Jeremy Woods | 6a95604 | 2021-02-03 10:04:26 -0800 | [diff] [blame] | 105 | } |
Sergey Vasilinets | 15d5a9d | 2021-06-25 14:30:22 +0100 | [diff] [blame] | 106 | |
Aurimas Liutikas | dcfa035 | 2022-03-14 16:05:33 -0700 | [diff] [blame] | 107 | android { |
Aurimas Liutikas | 7795282 | 2024-12-04 18:00:17 -0800 | [diff] [blame] | 108 | compileSdk = 35 |
| 109 | namespace = "androidx.lifecycle.viewmodel.compose" |
Aurimas Liutikas | dcfa035 | 2022-03-14 16:05:33 -0700 | [diff] [blame] | 110 | } |