blob: 72e371e7ca5f03416f46da4b6d225415105d85da [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.
*/
import androidx.build.AndroidXComposePlugin
import androidx.build.LibraryType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXComposePlugin")
}
AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
android {
if (!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
sourceSets {
test.java.srcDirs += "src/androidCommonTest/kotlin"
androidTest.java.srcDirs += "src/androidCommonTest/kotlin"
}
}
lintOptions {
disable("InvalidPackage")
}
namespace "androidx.compose.ui.test"
}
dependencies {
if (!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
api("androidx.compose.runtime:runtime:1.2.1")
api(project(":compose:ui:ui"))
api(project(":compose:ui:ui-graphics"))
api(project(":compose:ui:ui-text"))
api(project(":compose:ui:ui-unit"))
api(libs.kotlinCoroutinesCore)
api(libs.kotlinCoroutinesTest)
api(libs.kotlinStdlib)
api(libs.kotlinStdlibCommon)
implementation(project(":compose:ui:ui-util"))
implementation("androidx.annotation:annotation:1.1.0")
implementation("androidx.core:core-ktx:1.1.0")
implementation("androidx.test.espresso:espresso-core:3.3.0")
implementation(libs.testMonitor)
testImplementation(project(":compose:test-utils"))
testImplementation(libs.truth)
testImplementation(libs.robolectric)
testImplementation(libs.mockitoCore4)
testImplementation(libs.mockitoKotlin4)
androidTestImplementation("androidx.activity:activity-compose:1.3.1")
androidTestImplementation(project(":compose:material:material"))
androidTestImplementation(project(":compose:test-utils"))
androidTestImplementation(project(":compose:ui:ui-test-junit4"))
androidTestImplementation(libs.truth)
androidTestImplementation(libs.mockitoCore)
androidTestImplementation(libs.dexmakerMockito)
androidTestImplementation(libs.mockitoKotlin)
samples(project(":compose:ui:ui-test:ui-test-samples"))
}
}
if (AndroidXComposePlugin.isMultiplatformEnabled(project)) {
androidXComposeMultiplatform {
android()
desktop()
}
kotlin {
sourceSets {
commonMain.dependencies {
api(project(":compose:ui:ui"))
api(project(":compose:ui:ui-text"))
api(project(":compose:ui:ui-unit"))
api(libs.kotlinStdlib)
implementation(project(":compose:ui:ui-util"))
}
jvmMain.dependencies {
api(project(":compose:runtime:runtime"))
api(libs.kotlinCoroutinesCore)
api(libs.kotlinCoroutinesTest)
api(libs.kotlinStdlibCommon)
}
androidMain.dependencies {
api(project(":compose:ui:ui-graphics"))
implementation("androidx.annotation:annotation:1.1.0")
implementation("androidx.core:core-ktx:1.2.0")
implementation("androidx.test.espresso:espresso-core:3.3.0")
implementation(libs.testMonitor)
}
androidCommonTest.dependencies {
implementation(project(":compose:test-utils"))
implementation(libs.truth)
}
// TODO(b/214407011): These dependencies leak into instrumented tests as well. If you
// need to add Robolectric (which must be kept out of androidAndroidTest), use a top
// level dependencies block instead:
// `dependencies { testImplementation(libs.robolectric) }`
androidTest.dependencies {
implementation(libs.mockitoCore4)
implementation(libs.mockitoKotlin4)
}
androidAndroidTest.dependencies {
implementation(project(":compose:material:material"))
implementation(project(":compose:ui:ui-test-junit4"))
implementation("androidx.activity:activity-compose:1.3.1")
implementation(libs.mockitoCore)
implementation(libs.mockitoKotlin)
implementation(libs.dexmakerMockito)
}
desktopMain.dependencies {
implementation(libs.junit)
implementation(libs.truth)
implementation(libs.skiko)
}
androidCommonTest.dependsOn(commonTest)
androidTest.dependsOn(androidCommonTest)
androidAndroidTest.dependsOn(androidCommonTest)
}
}
dependencies {
// Can't declare this in kotlin { sourceSets { androidTest.dependencies { .. } } } as that
// leaks into instrumented tests (b/214407011)
testImplementation(libs.robolectric)
samples(project(":compose:ui:ui-test:ui-test-samples"))
}
}
androidx {
name = "Compose Testing"
type = LibraryType.PUBLISHED_TEST_LIBRARY
mavenGroup = LibraryGroups.COMPOSE_UI
inceptionYear = "2019"
description = "Compose testing library"
legacyDisableKotlinStrictApiMode = true
}
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
"-Xjvm-default=all",
]
}
}