From c0dd24eb8315f6de13f1f0d3eefe53c2444dff1b Mon Sep 17 00:00:00 2001 From: pluu Date: Fri, 27 Dec 2024 01:19:28 +0900 Subject: [PATCH] Add Compose UI Test setting --- .../src/main/java/com/pluu/convention/AndroidCompose.kt | 6 +++++- .../src/main/java/com/pluu/convention/KotlinAndroid.kt | 2 +- gradle/libs.versions.toml | 7 +++++++ repositories.gradle.kts | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build-logic/convention/src/main/java/com/pluu/convention/AndroidCompose.kt b/build-logic/convention/src/main/java/com/pluu/convention/AndroidCompose.kt index efd253ca..c629162b 100644 --- a/build-logic/convention/src/main/java/com/pluu/convention/AndroidCompose.kt +++ b/build-logic/convention/src/main/java/com/pluu/convention/AndroidCompose.kt @@ -23,10 +23,14 @@ internal fun Project.configureAndroidCompose( } dependencies { + val bom = libs.findLibrary("androidX-compose-bom").get() // Disabling to work with Alpha - api(platform(libs.findLibrary("androidX-compose-bom").get())) + api(platform(bom)) implementation(libs.findBundle("androidX-compose")) debugImplementation(libs.findBundle("androidX-compose-debug")) + + "androidTestImplementation"(platform(bom)) + "androidTestImplementation"(libs.findBundle("androidX-compose-ui-test").get()) } tasks.withType().configureEach { diff --git a/build-logic/convention/src/main/java/com/pluu/convention/KotlinAndroid.kt b/build-logic/convention/src/main/java/com/pluu/convention/KotlinAndroid.kt index b155ed1b..a0efad2d 100644 --- a/build-logic/convention/src/main/java/com/pluu/convention/KotlinAndroid.kt +++ b/build-logic/convention/src/main/java/com/pluu/convention/KotlinAndroid.kt @@ -26,7 +26,7 @@ internal fun Project.configureAndroid() { minSdk = Const.minSdk targetSdk = Const.targetSdk - testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true resourceConfigurations.addAll(listOf("en", "ko")) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d172eac9..d1d68960 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,6 +35,8 @@ androidX-compose-tooling = { module = "androidx.compose.ui:ui-tooling" } androidX-compose-toolingPreview = { module = "androidx.compose.ui:ui-tooling-preview" } androidX-compose-ui = { module = "androidx.compose.ui:ui" } androidX-compose-uiTestManifest = { module = "androidx.compose.ui:ui-test-manifest" } +androidX-compose-ui-test = { module = "androidx.compose.ui:ui-test" } +androidX-compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" } androidX-constraintlayout-compose = "androidx.constraintlayout:constraintlayout-compose:1.1.0" androidX-fragment-ktx = "androidx.fragment:fragment-ktx:1.8.5" androidX-hilt-navigation-compose = "androidx.hilt:hilt-navigation-compose:1.2.0" @@ -100,6 +102,11 @@ androidX-compose-debug = [ "androidX-compose-uiTestManifest" ] +androidX-compose-ui-test = [ + "androidX-compose-ui-test", + "androidX-compose-ui-test-junit4" +] + [plugins] android-application = { id = "com.android.application", version.ref = "androidStudioGradlePlugin" } android-library = { id = "com.android.library", version.ref = "androidStudioGradlePlugin" } diff --git a/repositories.gradle.kts b/repositories.gradle.kts index 9ead1d59..2a1abbd8 100644 --- a/repositories.gradle.kts +++ b/repositories.gradle.kts @@ -2,6 +2,7 @@ fun configureSharedRepositories(handler: RepositoryHandler) { handler.google { content { includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google\\.android\\..*") includeGroupByRegex("androidx.*") includeGroup("android.arch.lifecycle") includeGroup("android.arch.core")