1/*
2 * Copyright 2022 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
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 */
24import androidx.build.SoftwareType
25import androidx.build.PlatformIdentifier
26import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
27
28plugins {
29    id("AndroidXPlugin")
30    id("com.android.library")
31    id("AndroidXComposePlugin")
32}
33
34androidXMultiplatform {
35    androidTarget()
36    jvmStubs()
37    linuxX64Stubs()
38
39    defaultPlatform(PlatformIdentifier.ANDROID)
40
41    sourceSets {
42        commonMain {
43            dependencies {
44                api(project(":lifecycle:lifecycle-runtime"))
45                api("androidx.annotation:annotation:1.8.1")
46                api("androidx.compose.runtime:runtime:1.7.1")
47            }
48        }
49
50        androidMain {
51            dependsOn(commonMain)
52            dependencies {
53                // Although this artifact is empty, it ensures that upgrading
54                // `lifecycle-runtime-compose` also updates `lifecycle-runtime-ktx`
55                // in cases where our constraints fail (e.g., internally in AndroidX
56                // when using project dependencies).
57                api(project(":lifecycle:lifecycle-runtime-ktx"))
58            }
59        }
60
61        androidInstrumentedTest {
62            dependencies {
63                implementation(project(":lifecycle:lifecycle-runtime-testing"))
64                implementation(project(":compose:ui:ui-test"))
65                implementation(project(":compose:test-utils"))
66                implementation(libs.testRules)
67                implementation(libs.testRunner)
68                implementation(libs.kotlinTest)
69                implementation(project(":kruth:kruth"))
70            }
71        }
72
73        nonAndroidMain {
74            dependsOn(commonMain)
75        }
76
77        jvmStubsMain {
78            dependsOn(nonAndroidMain)
79        }
80
81        linuxx64StubsMain {
82            dependsOn(nonAndroidMain)
83        }
84    }
85}
86
87dependencies {
88    lintPublish(project(":lifecycle:lifecycle-runtime-compose-lint"))
89}
90
91androidx {
92    name = "Lifecycle Runtime Compose"
93    type = SoftwareType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
94    inceptionYear = "2021"
95    description = "Compose integration with Lifecycle"
96    samples(project(":lifecycle:lifecycle-runtime-compose:lifecycle-runtime-compose-samples"))
97}
98
99android {
100    compileSdk = 35
101
102    buildTypes.configureEach {
103        consumerProguardFiles "proguard-rules.pro"
104    }
105
106    namespace = "androidx.lifecycle.runtime.compose"
107}
108