Skip to content

Commit 7ff1913

Browse files
committed
Fixes host test tasks that were accidentally attemping to run
Gradle 9.0.0 has the new enforcement that Test task runs that have sources but no tests run should fail. Without this change we get Execution failed for task ':core:analytics:testDemoDebugUnitTest'. > There are test sources present and no filters are applied, but the test task did not discover any tests to execute. This is likely due to a misconfiguration. Please check your test configuration. If this is not a misconfiguration, this error can be disabled by setting the 'failOnNoDiscoveredTests' property to false. We get this because before this change AndroidCompose was always setting isIncludeAndroidResources = true which generates a source to the test task and in the case of :core:analytics it is the only source. Instead of setting isIncludeAndroidResources in AndroidCompose move to setting it in relevant build.gradle.kts files (most already had it)
1 parent c48c838 commit 7ff1913

File tree

6 files changed

+5
-22
lines changed

6 files changed

+5
-22
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ android {
6262
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
6363
}
6464
}
65-
testOptions {
66-
unitTests {
67-
isIncludeAndroidResources = true
68-
}
69-
}
65+
testOptions.unitTests.isIncludeAndroidResources = true
7066
namespace = "com.google.samples.apps.nowinandroid"
7167
}
7268

build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ internal fun Project.configureAndroidCompose(
4242
"implementation"(libs.findLibrary("androidx-compose-ui-tooling-preview").get())
4343
"debugImplementation"(libs.findLibrary("androidx-compose-ui-tooling").get())
4444
}
45-
46-
testOptions {
47-
unitTests {
48-
// For Robolectric
49-
isIncludeAndroidResources = true
50-
}
51-
}
5245
}
5346

5447
extensions.configure<ComposeCompilerGradlePluginExtension> {

core/data/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ plugins {
2222

2323
android {
2424
namespace = "com.google.samples.apps.nowinandroid.core.data"
25-
testOptions {
26-
unitTests {
27-
isIncludeAndroidResources = true
28-
}
29-
}
25+
testOptions.unitTests.isIncludeAndroidResources = true
3026
}
3127

3228
dependencies {

core/designsystem/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ plugins {
2222

2323
android {
2424
namespace = "com.google.samples.apps.nowinandroid.core.designsystem"
25+
testOptions.unitTests.isIncludeAndroidResources = true
2526
}
2627

2728
dependencies {

core/network/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ android {
3030
buildConfig = true
3131
}
3232
namespace = "com.google.samples.apps.nowinandroid.core.network"
33-
testOptions {
34-
unitTests {
35-
isIncludeAndroidResources = true
36-
}
37-
}
33+
testOptions.unitTests.isIncludeAndroidResources = true
3834
}
3935

4036
dependencies {

feature/foryou/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ plugins {
2323

2424
android {
2525
namespace = "com.google.samples.apps.nowinandroid.feature.foryou"
26+
testOptions.unitTests.isIncludeAndroidResources = true
2627
}
2728

2829
dependencies {

0 commit comments

Comments
 (0)