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)
pull/1930/head
Aurimas Liutikas 4 weeks ago
parent c48c8381e1
commit 7ff1913855

@ -62,11 +62,7 @@ android {
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
}
}
testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
testOptions.unitTests.isIncludeAndroidResources = true
namespace = "com.google.samples.apps.nowinandroid"
}

@ -42,13 +42,6 @@ internal fun Project.configureAndroidCompose(
"implementation"(libs.findLibrary("androidx-compose-ui-tooling-preview").get())
"debugImplementation"(libs.findLibrary("androidx-compose-ui-tooling").get())
}
testOptions {
unitTests {
// For Robolectric
isIncludeAndroidResources = true
}
}
}
extensions.configure<ComposeCompilerGradlePluginExtension> {

@ -22,11 +22,7 @@ plugins {
android {
namespace = "com.google.samples.apps.nowinandroid.core.data"
testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
testOptions.unitTests.isIncludeAndroidResources = true
}
dependencies {

@ -22,6 +22,7 @@ plugins {
android {
namespace = "com.google.samples.apps.nowinandroid.core.designsystem"
testOptions.unitTests.isIncludeAndroidResources = true
}
dependencies {

@ -30,11 +30,7 @@ android {
buildConfig = true
}
namespace = "com.google.samples.apps.nowinandroid.core.network"
testOptions {
unitTests {
isIncludeAndroidResources = true
}
}
testOptions.unitTests.isIncludeAndroidResources = true
}
dependencies {

@ -23,6 +23,7 @@ plugins {
android {
namespace = "com.google.samples.apps.nowinandroid.feature.foryou"
testOptions.unitTests.isIncludeAndroidResources = true
}
dependencies {

Loading…
Cancel
Save