blob: 248201fea134f8a5d2614e4dce03afd312c4bcf5 [file] [log] [blame]
/*
* Copyright 2019 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 `create_project.py` script located in the
* `<AndroidX root>/development/project-creator` directory.
*
* Please use that script when creating a new project, rather than copying an existing project and
* modifying its settings.
*/
import androidx.build.LibraryType
import androidx.build.KmpPlatformsKt
import androidx.build.PlatformIdentifier
import static androidx.inspection.gradle.InspectionPluginKt.packageInspector
plugins {
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXComposePlugin")
}
androidXMultiplatform {
android()
desktop()
defaultPlatform(PlatformIdentifier.ANDROID)
sourceSets {
commonMain {
dependencies {
implementation(libs.kotlinStdlibCommon)
implementation(libs.kotlinCoroutinesCore)
api("androidx.annotation:annotation:1.6.0")
implementation("androidx.collection:collection:1.4.0")
// when updating the runtime version please also update the runtime-saveable version
implementation(project(":compose:runtime:runtime"))
api(project(":compose:runtime:runtime-saveable"))
api(project(":compose:ui:ui-geometry"))
api(project(":compose:ui:ui-graphics"))
api(project(":compose:ui:ui-text"))
api(project(":compose:ui:ui-unit"))
api(project(":compose:ui:ui-util"))
}
}
commonTest {
dependencies {
implementation(libs.kotlinReflect)
api project(":compose:ui:ui-util")
}
}
jvmMain {
dependsOn(commonMain)
dependencies {
}
}
skikoMain {
dependsOn(commonMain)
dependencies {
api(libs.skikoCommon)
}
}
androidMain {
dependsOn(jvmMain)
dependencies {
implementation(libs.kotlinStdlib)
api("androidx.annotation:annotation-experimental:1.4.0")
// This has stub APIs for access to legacy Android APIs, so we don't want
// any dependency on this module.
compileOnly(project(":compose:ui:ui-android-stubs"))
implementation("androidx.autofill:autofill:1.0.0")
implementation(libs.kotlinCoroutinesAndroid)
implementation("androidx.activity:activity-ktx:1.7.0")
implementation("androidx.core:core:1.12.0")
implementation('androidx.collection:collection:1.0.0')
implementation("androidx.customview:customview-poolingcontainer:1.0.0")
implementation("androidx.savedstate:savedstate-ktx:1.2.1")
api("androidx.lifecycle:lifecycle-runtime-compose:2.8.0")
implementation("androidx.lifecycle:lifecycle-viewmodel:2.6.1")
implementation("androidx.emoji2:emoji2:1.2.0")
implementation("androidx.profileinstaller:profileinstaller:1.3.1")
// `compose-ui` has a transitive dependency on `lifecycle-livedata-core`, and
// converting `lifecycle-runtime-compose` to KMP triggered a Gradle bug. Adding
// the `livedata` dependency directly works around the issue.
// See https://github.com/gradle/gradle/issues/14220 for details.
compileOnly("androidx.lifecycle:lifecycle-livedata-core:2.8.0")
// `compose-ui` has a transitive dependency on `lifecycle-viewmodel-savedstate`, and
// converting `lifecycle-runtime-compose` to KMP triggered a Gradle bug. Adding
// the `lifecycle-viewmodel-savedstate` dependency directly works around the issue.
// See https://github.com/gradle/gradle/issues/14220 for details.
compileOnly("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.0")
}
}
desktopMain {
dependsOn(skikoMain)
dependsOn(jvmMain)
dependencies {
implementation(libs.kotlinStdlib)
api(libs.kotlinCoroutinesSwing)
}
}
jvmTest {
dependsOn(commonTest)
dependencies {
}
}
androidInstrumentedTest {
dependsOn(jvmTest)
dependencies {
implementation("androidx.fragment:fragment:1.3.0")
implementation("androidx.appcompat:appcompat:1.3.0")
implementation(libs.testUiautomator)
implementation(libs.testRules)
implementation(libs.testRunner)
implementation(libs.testExtJunitKtx)
implementation(libs.kotlinCoroutinesTest)
implementation(libs.kotlinTest)
implementation(libs.espressoCore)
implementation(libs.bundles.espressoContrib)
implementation(libs.junit)
implementation(libs.dexmakerMockito)
implementation(libs.mockitoCore)
implementation(libs.truth)
implementation(libs.mockitoKotlin)
implementation(libs.material)
implementation(project(":compose:animation:animation-core"))
implementation(project(":compose:foundation:foundation"))
implementation(project(":compose:foundation:foundation-layout"))
implementation(project(":compose:material:material"))
implementation(project(":compose:test-utils"))
implementation(project(":internal-testutils-fonts"))
implementation(project(":compose:ui:ui-test-junit4"))
implementation(project(":internal-testutils-runtime"))
implementation(project(":test:screenshot:screenshot"))
implementation("androidx.lifecycle:lifecycle-runtime-testing:2.6.1")
implementation("androidx.recyclerview:recyclerview:1.3.0")
implementation("androidx.core:core-ktx:1.2.0")
implementation("androidx.activity:activity-compose:1.7.0")
implementation("androidx.fragment:fragment-testing:1.4.1")
}
}
androidUnitTest {
dependsOn(jvmTest)
dependencies {
implementation(libs.testRules)
implementation(libs.testRunner)
implementation(libs.kotlinCoroutinesTest)
implementation(libs.junit)
implementation(libs.truth)
implementation(libs.kotlinTest)
implementation(libs.robolectric)
implementation(libs.mockitoCore4)
implementation(libs.mockitoKotlin4)
implementation(libs.byteBuddy)
implementation(project(":compose:ui:ui-test-junit4"))
implementation(project(":internal-testutils-fonts"))
implementation(project(":compose:test-utils"))
}
}
desktopTest {
dependsOn(jvmTest)
dependencies {
implementation(libs.truth)
implementation(libs.junit)
implementation(libs.mockitoCore)
implementation(libs.mockitoKotlin)
implementation(libs.skikoCurrentOs)
implementation(project(":compose:material:material"))
implementation(project(":compose:ui:ui-test-junit4"))
}
}
}
}
dependencies {
constraints {
// In 1.4.0-alpha02 there was a change made in :compose:ui:ui which fixed an issue where
// we were over-invalidating layout. This change caused a corresponding regression in
// foundation's CoreText, where it was expecting a layout to happen but with this change
// it would not. A corresponding fix for this was added in 1.4.0-alpha02 of
// :compose:foundation:foundation. By adding this constraint, we are ensuring that the
// if an app has this ui module _and_ the foundation module as a dependency, then the
// version of foundation will be at least this version. This will prevent the bug in
// foundation from occurring. This does _NOT_ require that the app have foundation as
// a dependency.
commonMainImplementation("androidx.compose.foundation:foundation:1.4.0") {
because 'prevents a critical bug in Text'
}
}
}
packageInspector(project, ":compose:ui:ui-inspection")
dependencies {
lintChecks(project(":compose:ui:ui-lint"))
lintPublish(project(":compose:ui:ui-lint"))
}
androidx {
name = "Compose UI"
type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
inceptionYear = "2019"
description = "Compose UI primitives. This library contains the primitives that form the Compose UI Toolkit, such as drawing, measurement and layout."
legacyDisableKotlinStrictApiMode = true
samples(project(":compose:ui:ui:ui-samples"))
}
if (KmpPlatformsKt.enableDesktop(project)) {
tasks.withType(Test).configureEach {
if (name.equals("desktopTest")) {
systemProperties["GOLDEN_PATH"] = project.rootDir.absolutePath + "/../../golden"
}
}
}
android {
testOptions.unitTests.includeAndroidResources = true
buildTypes.configureEach {
consumerProguardFiles("proguard-rules.pro")
}
}
// Screenshot tests related setup
android {
sourceSets.androidTest.assets.srcDirs +=
project.rootDir.absolutePath + "/../../golden/compose/ui/ui"
namespace "androidx.compose.ui"
// namespace has to be unique, but default androidx.compose.ui.test package is taken by
// the androidx.compose.ui:ui-test library
testNamespace "androidx.compose.ui.tests"
}