diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml index 6bee0ddfb..5bf03b47a 100644 --- a/.github/workflows/Build.yaml +++ b/.github/workflows/Build.yaml @@ -25,9 +25,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v3 - - name: Copy CI gradle.properties run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties @@ -38,7 +35,10 @@ jobs: java-version: 17 - name: Setup Gradle - uses: gradle/gradle-build-action@v3 + uses: gradle/actions/setup-gradle@v3 + with: + validate-wrappers: true + gradle-home-cache-cleanup: true - name: Check build-logic run: ./gradlew check -p build-logic @@ -187,7 +187,10 @@ jobs: java-version: 17 - name: Setup Gradle - uses: gradle/gradle-build-action@v3 + uses: gradle/actions/setup-gradle@v3 + with: + validate-wrappers: true + gradle-home-cache-cleanup: true - name: Build projects and run instrumentation tests uses: reactivecircus/android-emulator-runner@v2 diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 2184a4c50..b18b41faa 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -19,10 +19,8 @@ jobs: ls /dev/kvm - name: Checkout - uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v3 + uses: actions/checkout@v4 - name: Copy CI gradle.properties run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties @@ -33,6 +31,12 @@ jobs: distribution: 'zulu' java-version: 17 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + validate-wrappers: true + gradle-home-cache-cleanup: true + - name: Install GMD image for baseline profile generation run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;aosp_atd;x86_64" diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 355ec42c0..47b8af943 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -112,16 +112,14 @@ dependencies { kspTest(libs.hilt.compiler) testImplementation(projects.core.dataTest) - testImplementation(projects.core.testing) - testImplementation(projects.sync.syncTest) - testImplementation(libs.androidx.compose.ui.test) - testImplementation(libs.androidx.work.testing) testImplementation(libs.hilt.android.testing) + testImplementation(projects.sync.syncTest) testDemoImplementation(libs.robolectric) testDemoImplementation(libs.roborazzi) testDemoImplementation(projects.core.screenshotTesting) + androidTestImplementation(kotlin("test")) androidTestImplementation(projects.core.testing) androidTestImplementation(projects.core.dataTest) androidTestImplementation(projects.core.datastoreTest) diff --git a/app/dependencies/prodReleaseRuntimeClasspath.txt b/app/dependencies/prodReleaseRuntimeClasspath.txt index 066771b7d..96e5940e8 100644 --- a/app/dependencies/prodReleaseRuntimeClasspath.txt +++ b/app/dependencies/prodReleaseRuntimeClasspath.txt @@ -83,26 +83,26 @@ androidx.hilt:hilt-navigation:1.2.0 androidx.hilt:hilt-work:1.1.0 androidx.interpolator:interpolator:1.0.0 androidx.legacy:legacy-support-core-utils:1.0.0 -androidx.lifecycle:lifecycle-common-java8:2.8.1 -androidx.lifecycle:lifecycle-common-jvm:2.8.1 -androidx.lifecycle:lifecycle-common:2.8.1 -androidx.lifecycle:lifecycle-livedata-core-ktx:2.8.1 -androidx.lifecycle:lifecycle-livedata-core:2.8.1 -androidx.lifecycle:lifecycle-livedata:2.8.1 -androidx.lifecycle:lifecycle-process:2.8.1 -androidx.lifecycle:lifecycle-runtime-android:2.8.1 -androidx.lifecycle:lifecycle-runtime-compose-android:2.8.1 -androidx.lifecycle:lifecycle-runtime-compose:2.8.1 -androidx.lifecycle:lifecycle-runtime-ktx-android:2.8.1 -androidx.lifecycle:lifecycle-runtime-ktx:2.8.1 -androidx.lifecycle:lifecycle-runtime:2.8.1 -androidx.lifecycle:lifecycle-service:2.8.1 -androidx.lifecycle:lifecycle-viewmodel-android:2.8.1 -androidx.lifecycle:lifecycle-viewmodel-compose-android:2.8.1 -androidx.lifecycle:lifecycle-viewmodel-compose:2.8.1 -androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.1 -androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.1 -androidx.lifecycle:lifecycle-viewmodel:2.8.1 +androidx.lifecycle:lifecycle-common-java8:2.8.3 +androidx.lifecycle:lifecycle-common-jvm:2.8.3 +androidx.lifecycle:lifecycle-common:2.8.3 +androidx.lifecycle:lifecycle-livedata-core-ktx:2.8.3 +androidx.lifecycle:lifecycle-livedata-core:2.8.3 +androidx.lifecycle:lifecycle-livedata:2.8.3 +androidx.lifecycle:lifecycle-process:2.8.3 +androidx.lifecycle:lifecycle-runtime-android:2.8.3 +androidx.lifecycle:lifecycle-runtime-compose-android:2.8.3 +androidx.lifecycle:lifecycle-runtime-compose:2.8.3 +androidx.lifecycle:lifecycle-runtime-ktx-android:2.8.3 +androidx.lifecycle:lifecycle-runtime-ktx:2.8.3 +androidx.lifecycle:lifecycle-runtime:2.8.3 +androidx.lifecycle:lifecycle-service:2.8.3 +androidx.lifecycle:lifecycle-viewmodel-android:2.8.3 +androidx.lifecycle:lifecycle-viewmodel-compose-android:2.8.3 +androidx.lifecycle:lifecycle-viewmodel-compose:2.8.3 +androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.3 +androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.3 +androidx.lifecycle:lifecycle-viewmodel:2.8.3 androidx.loader:loader:1.0.0 androidx.localbroadcastmanager:localbroadcastmanager:1.0.0 androidx.metrics:metrics-performance:1.0.0-alpha04 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0b0482c13..1f5e13f2f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -20,11 +20,13 @@ + + { apply("nowinandroid.android.hilt") } extensions.configure { - defaultConfig { - testInstrumentationRunner = - "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner" - } testOptions.animationsDisabled = true configureGradleManagedDevices(this) } diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt index be5b41d07..71d818c0c 100644 --- a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt @@ -40,6 +40,7 @@ class AndroidLibraryConventionPlugin : Plugin { extensions.configure { configureKotlinAndroid(this) defaultConfig.targetSdk = 34 + defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testOptions.animationsDisabled = true configureFlavors(this) configureGradleManagedDevices(this) @@ -52,6 +53,7 @@ class AndroidLibraryConventionPlugin : Plugin { disableUnnecessaryAndroidTests(target) } dependencies { + add("androidTestImplementation", kotlin("test")) add("testImplementation", kotlin("test")) add("implementation", libs.findLibrary("androidx.tracing.ktx").get()) diff --git a/core/database/build.gradle.kts b/core/database/build.gradle.kts index 4a6bcb66a..a9e38ead7 100644 --- a/core/database/build.gradle.kts +++ b/core/database/build.gradle.kts @@ -22,10 +22,6 @@ plugins { } android { - defaultConfig { - testInstrumentationRunner = - "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner" - } namespace = "com.google.samples.apps.nowinandroid.core.database" } @@ -34,5 +30,7 @@ dependencies { implementation(libs.kotlinx.datetime) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.androidx.test.core) + androidTestImplementation(libs.androidx.test.runner) + androidTestImplementation(libs.kotlinx.coroutines.test) } diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index bbb4ab97b..31635865c 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -46,10 +46,7 @@ dependencies { testImplementation(libs.hilt.android.testing) testImplementation(libs.robolectric) - testImplementation(libs.roborazzi) testImplementation(projects.core.screenshotTesting) - testImplementation(projects.core.testing) - androidTestImplementation(libs.androidx.compose.ui.test) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) } diff --git a/core/screenshot-testing/build.gradle.kts b/core/screenshot-testing/build.gradle.kts index fb23cf057..1b816fc67 100644 --- a/core/screenshot-testing/build.gradle.kts +++ b/core/screenshot-testing/build.gradle.kts @@ -24,11 +24,10 @@ android { } dependencies { + api(libs.bundles.androidx.compose.ui.test) api(libs.roborazzi) implementation(libs.androidx.compose.ui.test) implementation(libs.androidx.activity.compose) - implementation(libs.androidx.compose.ui.test) implementation(libs.robolectric) - implementation(projects.core.common) implementation(projects.core.designsystem) } diff --git a/core/testing/build.gradle.kts b/core/testing/build.gradle.kts index 02729ceff..90f2405a4 100644 --- a/core/testing/build.gradle.kts +++ b/core/testing/build.gradle.kts @@ -15,7 +15,6 @@ */ plugins { alias(libs.plugins.nowinandroid.android.library) - alias(libs.plugins.nowinandroid.android.library.compose) alias(libs.plugins.nowinandroid.android.hilt) } @@ -24,19 +23,15 @@ android { } dependencies { - api(kotlin("test")) - api(libs.androidx.compose.ui.test) + api(libs.kotlinx.coroutines.test) api(projects.core.analytics) + api(projects.core.common) api(projects.core.data) api(projects.core.model) api(projects.core.notifications) - debugApi(libs.androidx.compose.ui.testManifest) implementation(libs.androidx.test.rules) implementation(libs.hilt.android.testing) - implementation(libs.kotlinx.coroutines.test) implementation(libs.kotlinx.datetime) - implementation(projects.core.common) - implementation(projects.core.designsystem) } diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 5d8a65d44..5606cb5d1 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -20,9 +20,6 @@ plugins { } android { - defaultConfig { - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } namespace = "com.google.samples.apps.nowinandroid.core.ui" } @@ -36,5 +33,6 @@ dependencies { implementation(libs.coil.kt) implementation(libs.coil.kt.compose) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/docs/images/graphs/dep_graph_core_screenshot_testing.svg b/docs/images/graphs/dep_graph_core_screenshot_testing.svg index 997654f40..a7d58b0ea 100644 --- a/docs/images/graphs/dep_graph_core_screenshot_testing.svg +++ b/docs/images/graphs/dep_graph_core_screenshot_testing.svg @@ -1,25 +1,17 @@ - + - + - - :core:screenshot-testing + + :core:screenshot-testing - - :core:common + + :core:designsystem - - - - - - :core:designsystem - - - - + + diff --git a/docs/images/graphs/dep_graph_core_testing.svg b/docs/images/graphs/dep_graph_core_testing.svg index 9dfc695e1..d441858e5 100644 --- a/docs/images/graphs/dep_graph_core_testing.svg +++ b/docs/images/graphs/dep_graph_core_testing.svg @@ -1,129 +1,121 @@ - + - + - - :core:testing + + :core:testing - - :core:analytics + + :core:analytics - - + + - - :core:data - - - - - - - - :core:model + + :core:common - - + + - - :core:notifications + + :core:data - - - + + + - - :core:common + + :core:model - - + + - - :core:designsystem + + :core:notifications - - + + - - + + - - + + - - + + - - :core:database + + :core:database - - + + - - :core:datastore + + :core:datastore - - + + - - :core:network + + :core:network - - + + - - + + - - + + - - + + - - + + - - + + - - :core:datastore-proto + + :core:datastore-proto - - + + - - + + - - + + diff --git a/feature/bookmarks/build.gradle.kts b/feature/bookmarks/build.gradle.kts index 4e97176a2..51a15ce7a 100644 --- a/feature/bookmarks/build.gradle.kts +++ b/feature/bookmarks/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/foryou/build.gradle.kts b/feature/foryou/build.gradle.kts index fd41d9a13..004fe8ad6 100644 --- a/feature/foryou/build.gradle.kts +++ b/feature/foryou/build.gradle.kts @@ -33,8 +33,8 @@ dependencies { testImplementation(libs.hilt.android.testing) testImplementation(libs.robolectric) testImplementation(projects.core.testing) - testImplementation(projects.core.screenshotTesting) - testDemoImplementation(libs.roborazzi) + testDemoImplementation(projects.core.screenshotTesting) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/interests/build.gradle.kts b/feature/interests/build.gradle.kts index ee6aaf122..ca91ba2c4 100644 --- a/feature/interests/build.gradle.kts +++ b/feature/interests/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/search/build.gradle.kts b/feature/search/build.gradle.kts index 98052e9ab..c5f1f6ad0 100644 --- a/feature/search/build.gradle.kts +++ b/feature/search/build.gradle.kts @@ -31,6 +31,7 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } diff --git a/feature/settings/build.gradle.kts b/feature/settings/build.gradle.kts index 4b9a72bdd..15d65204d 100644 --- a/feature/settings/build.gradle.kts +++ b/feature/settings/build.gradle.kts @@ -31,5 +31,5 @@ dependencies { testImplementation(projects.core.testing) - androidTestImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) } diff --git a/feature/topic/build.gradle.kts b/feature/topic/build.gradle.kts index d457b2f73..726920af1 100644 --- a/feature/topic/build.gradle.kts +++ b/feature/topic/build.gradle.kts @@ -29,5 +29,6 @@ dependencies { testImplementation(projects.core.testing) + androidTestImplementation(libs.bundles.androidx.compose.ui.test) androidTestImplementation(projects.core.testing) } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ab082d48f..adf9c1436 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ androidxCoreSplashscreen = "1.0.1" androidxDataStore = "1.0.0" androidxEspresso = "3.5.1" androidxHiltNavigationCompose = "1.2.0" -androidxLifecycle = "2.8.1" +androidxLifecycle = "2.8.3" androidxMacroBenchmark = "1.2.4" androidxMetrics = "1.0.0-alpha04" androidxNavigation = "2.8.0-alpha06" @@ -60,6 +60,9 @@ secrets = "2.0.1" truth = "1.4.2" turbine = "1.1.0" +[bundles] +androidx-compose-ui-test = ["androidx-compose-ui-test", "androidx-compose-ui-testManifest"] + [libraries] accompanist-permissions = { group = "com.google.accompanist", name = "accompanist-permissions", version.ref = "accompanist" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" }