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 17 18import androidx.build.SoftwareType 19import androidx.build.PlatformIdentifier 20 21plugins { 22 id("AndroidXPlugin") 23 id("com.android.library") 24 id("AndroidXComposePlugin") 25 alias(libs.plugins.kotlinSerialization) 26} 27 28androidXMultiplatform { 29 androidTarget() 30 jvmStubs() 31 linuxX64Stubs() 32 33 defaultPlatform(PlatformIdentifier.ANDROID) 34 35 sourceSets { 36 commonMain { 37 dependencies { 38 api(libs.kotlinStdlib) 39 api(project(":navigation:navigation-runtime")) 40 api(project(":navigation:navigation-common")) 41 implementation("androidx.annotation:annotation:1.8.0") 42 api("androidx.compose.runtime:runtime:1.7.2") 43 api("androidx.compose.ui:ui:1.7.2") 44 api("androidx.compose.animation:animation:1.7.2") 45 api("androidx.compose.runtime:runtime-saveable:1.7.2") 46 implementation("androidx.compose.animation:animation-core:1.7.2") 47 implementation("androidx.compose.foundation:foundation-layout:1.7.2") 48 implementation("androidx.collection:collection:1.4.5") 49 implementation(project(":lifecycle:lifecycle-common")) 50 implementation(project(":lifecycle:lifecycle-runtime-compose")) 51 implementation(project(":lifecycle:lifecycle-viewmodel-savedstate")) 52 implementation(project(":lifecycle:lifecycle-viewmodel")) 53 implementation(project(":lifecycle:lifecycle-viewmodel-compose")) 54 implementation(project(":savedstate:savedstate")) 55 implementation(project(":savedstate:savedstate-compose")) 56 implementation(libs.kotlinCoroutinesCore) 57 implementation(libs.kotlinSerializationCore) 58 } 59 } 60 commonTest { 61 dependencies { 62 implementation(libs.kotlinTest) 63 } 64 } 65 nonAndroidMain { 66 dependsOn(commonMain) 67 } 68 nonAndroidTest { 69 dependsOn(commonTest) 70 } 71 jvmCommonMain { 72 dependsOn(commonMain) 73 } 74 jvmCommonTest { 75 dependsOn(commonTest) 76 } 77 jvmStubsMain { 78 dependsOn(jvmCommonMain) 79 dependsOn(nonAndroidMain) 80 } 81 jvmStubsTest { 82 dependsOn(jvmCommonTest) 83 dependsOn(nonAndroidTest) 84 } 85 androidMain { 86 dependsOn(jvmCommonMain) 87 dependencies { 88 api("androidx.activity:activity-compose:1.8.0") 89 api("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.2") 90 implementation("androidx.activity:activity:1.8.0") 91 } 92 } 93 androidUnitTest { 94 dependsOn(jvmCommonTest) 95 } 96 androidInstrumentedTest { 97 dependsOn(jvmCommonTest) 98 dependencies { 99 implementation("androidx.activity:activity:1.9.2") 100 implementation("androidx.core:core-ktx:1.13.0") 101 implementation("androidx.lifecycle:lifecycle-runtime-testing:2.8.2") 102 implementation("androidx.lifecycle:lifecycle-runtime:2.8.2") 103 implementation("androidx.lifecycle:lifecycle-common:2.8.2") 104 implementation("androidx.lifecycle:lifecycle-viewmodel:2.8.2") 105 implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.2") 106 implementation("androidx.savedstate:savedstate:1.2.1") 107 implementation(project(":navigation:navigation-testing")) 108 implementation(libs.testExtJunit) 109 implementation(libs.testRunner) 110 implementation(libs.junit) 111 implementation(libs.truth) 112 113 // Compose test dependencies 114 implementation(project(":compose:animation:animation")) 115 implementation(project(":compose:animation:animation-core")) 116 implementation(project(":compose:foundation:foundation")) 117 implementation(project(":compose:runtime:runtime")) 118 implementation(project(":compose:runtime:runtime-saveable")) 119 implementation(project(":compose:ui:ui")) 120 implementation(project(":compose:ui:ui-graphics")) 121 implementation(project(":compose:ui:ui-test")) 122 implementation(project(":compose:ui:ui-text")) 123 implementation(project(":compose:ui:ui-tooling-preview")) 124 implementation(project(":compose:ui:ui-unit")) 125 implementation(project(":compose:material:material")) 126 implementation(project(":compose:test-utils")) 127 implementation(project(":compose:ui:ui-test-junit4")) 128 implementation(project(":compose:ui:ui-tooling")) 129 } 130 } 131 nonJvmCommonMain { 132 dependsOn(nonAndroidMain) 133 } 134 nonJvmCommonTest { 135 dependsOn(nonAndroidTest) 136 } 137 nativeMain { 138 dependsOn(nonJvmCommonMain) 139 } 140 nativeTest { 141 dependsOn(nonJvmCommonTest) 142 } 143 linuxx64StubsMain.dependsOn(nativeMain) 144 linuxx64StubsTest.dependsOn(nativeTest) 145 } 146} 147 148dependencies { 149 lintChecks(project(":navigation:navigation-compose-lint")) 150 lintPublish(project(":navigation:navigation-compose-lint")) 151 androidTestImplementation(project(":internal-testutils-navigation"), { 152 exclude group: "androidx.navigation", module: "navigation-common" 153 }) 154} 155 156androidx { 157 name = "Compose Navigation" 158 type = SoftwareType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS 159 inceptionYear = "2020" 160 description = "Compose integration with Navigation" 161 samples(project(":navigation:navigation-compose:navigation-compose-samples")) 162 metalavaK2UastEnabled = false 163 addGoldenImageAssets() 164} 165 166android { 167 compileSdk = 35 168 namespace = "androidx.navigation.compose" 169} 170