blob: c63ee186ad520d94b0003910338b8779d5d48a75 [file] [log] [blame]
Jeremy Woods6a956042021-02-03 10:04:26 -08001/*
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 Songee0da742024-01-03 14:08:46 -080017/**
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 Chou73305d32024-10-29 17:27:51 +000024
25import androidx.build.KotlinTarget
Omar Ismaila3085e1e2024-04-23 19:11:16 +010026import androidx.build.LibraryType
Marcello Galhardoee955582024-03-20 11:18:32 +000027import androidx.build.PlatformIdentifier
Jeremy Woods6a956042021-02-03 10:04:26 -080028
29plugins {
30 id("AndroidXPlugin")
31 id("com.android.library")
Louis Pullen-Freilichc8a26b82021-06-03 18:11:39 +010032 id("AndroidXComposePlugin")
Jeremy Woods6a956042021-02-03 10:04:26 -080033}
34
Marcello Galhardoee955582024-03-20 11:18:32 +000035androidXMultiplatform {
36 android()
37 desktop()
Jeremy Woods6a956042021-02-03 10:04:26 -080038
Marcello Galhardoee955582024-03-20 11:18:32 +000039 defaultPlatform(PlatformIdentifier.ANDROID)
Jeremy Woods6a956042021-02-03 10:04:26 -080040
Marcello Galhardoee955582024-03-20 11:18:32 +000041 sourceSets {
42 commonMain {
Marcello Galhardo7a8b0a82024-03-20 11:26:09 +000043 dependencies {
Aurimas6fee2212024-08-30 00:38:08 +000044 api(project(":lifecycle:lifecycle-common"))
45 api(project(":lifecycle:lifecycle-viewmodel"))
Aurimas Liutikas96f0b302024-07-25 15:49:23 -070046 api("androidx.annotation:annotation:1.8.1")
Marcello Galhardo7a8b0a82024-03-20 11:26:09 +000047 api("androidx.compose.runtime:runtime:1.6.0")
Marcello Galhardo7a8b0a82024-03-20 11:26:09 +000048 implementation(libs.kotlinStdlib)
49 }
Marcello Galhardoee955582024-03-20 11:18:32 +000050 }
Andrey Kulikovaf61f662021-02-03 19:48:53 +000051
Marcello Galhardoee955582024-03-20 11:18:32 +000052 commonTest {
53 // TODO(b/330323282): Move common dependencies here.
54 }
55
56 androidMain {
57 dependsOn(commonMain)
58 dependencies {
Aurimas6fee2212024-08-30 00:38:08 +000059 api(project(":lifecycle:lifecycle-viewmodel-savedstate"))
Marcello Galhardo20112342024-05-10 11:10:17 +010060 api("androidx.compose.ui:ui:1.6.0")
Marcello Galhardo87fc3ece2024-03-27 14:53:26 +000061 // 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.
Aurimas6fee2212024-08-30 00:38:08 +000065 compileOnly(project(":lifecycle:lifecycle-livedata-core"))
Marcello Galhardoee955582024-03-20 11:18:32 +000066 }
67 }
68
69 androidInstrumentedTest {
70 dependsOn(commonTest)
71 dependencies {
Aurimas6fee2212024-08-30 00:38:08 +000072 implementation(project(":compose:ui:ui-test-junit4"))
Marcello Galhardofc493ab2024-03-27 14:57:55 +000073 implementation(project(":compose:test-utils"))
Marcello Galhardoee955582024-03-20 11:18:32 +000074 implementation(libs.testRules)
75 implementation(libs.testRunner)
76 implementation(libs.junit)
77 implementation(libs.truth)
Marcello Galhardofc493ab2024-03-27 14:57:55 +000078 implementation("androidx.fragment:fragment:1.3.0")
79 implementation("androidx.appcompat:appcompat:1.3.0")
Marcello Galhardoee955582024-03-20 11:18:32 +000080 // 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
Aurimas6fee2212024-08-30 00:38:08 +000085 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 Galhardoee955582024-03-20 11:18:32 +000089 }
90 }
91 }
Jeremy Woods6a956042021-02-03 10:04:26 -080092}
93
Ben Trengroveb5bcdcd2024-07-23 02:19:27 +000094dependencies {
95 lintPublish(project(":lifecycle:lifecycle-viewmodel-compose-lint"))
96}
97
Jeremy Woods6a956042021-02-03 10:04:26 -080098androidx {
99 name = "Lifecycle ViewModel Compose"
Omar Ismaila3085e1e2024-04-23 19:11:16 +0100100 type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
Jeremy Woods6a956042021-02-03 10:04:26 -0800101 inceptionYear = "2021"
102 description = "Compose integration with Lifecycle ViewModel"
Aurimas6fee2212024-08-30 00:38:08 +0000103 samples(project(":lifecycle:lifecycle-viewmodel-compose:lifecycle-viewmodel-compose-samples"))
Kuan-Ying Chou73305d32024-10-29 17:27:51 +0000104 kotlinTarget = KotlinTarget.KOTLIN_1_9
Jeremy Woods6a956042021-02-03 10:04:26 -0800105}
Sergey Vasilinets15d5a9d2021-06-25 14:30:22 +0100106
Aurimas Liutikasdcfa0352022-03-14 16:05:33 -0700107android {
Aurimas Liutikas77952822024-12-04 18:00:17 -0800108 compileSdk = 35
109 namespace = "androidx.lifecycle.viewmodel.compose"
Aurimas Liutikasdcfa0352022-03-14 16:05:33 -0700110}