diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt index 1610e0ab8..8d28f99dd 100644 --- a/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt @@ -25,10 +25,10 @@ class AndroidApplicationJacocoConventionPlugin : Plugin { val androidExtension = extensions.getByType() androidExtension.buildTypes.configureEach { + // The jacoco plugin is applied automatically when any of these are set enableAndroidTestCoverage = true enableUnitTestCoverage = true } } } - } diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt index a0d08f805..9733ce6f5 100644 --- a/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt @@ -15,7 +15,6 @@ */ import com.android.build.api.dsl.LibraryExtension -import com.android.build.api.variant.LibraryAndroidComponentsExtension import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.getByType @@ -23,17 +22,14 @@ import org.gradle.kotlin.dsl.getByType class AndroidLibraryJacocoConventionPlugin : Plugin { override fun apply(target: Project) { with(target) { - val androidExtension: LibraryExtension = extensions.getByType() + val androidExtension = extensions.getByType() androidExtension.buildTypes.configureEach { // The jacoco plugin is applied automatically when any of these are set + enableAndroidTestCoverage = true enableUnitTestCoverage = true } - - val extension = extensions.getByType() - } } - } diff --git a/core/database/src/test/kotlin/EmptyTest.kt b/core/database/src/test/kotlin/EmptyTest.kt new file mode 100644 index 000000000..b6a1d4919 --- /dev/null +++ b/core/database/src/test/kotlin/EmptyTest.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2024 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 + * + * https://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 org.junit.Test + +/** + * Workaround for https://issuetracker.google.com/329869184 + */ +class EmptyTest { + @Test + fun test1() { } +} diff --git a/core/ui/src/test/kotlin/EmptyTest.kt b/core/ui/src/test/kotlin/EmptyTest.kt new file mode 100644 index 000000000..b6a1d4919 --- /dev/null +++ b/core/ui/src/test/kotlin/EmptyTest.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2024 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 + * + * https://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 org.junit.Test + +/** + * Workaround for https://issuetracker.google.com/329869184 + */ +class EmptyTest { + @Test + fun test1() { } +} diff --git a/sync/work/src/test/kotlin/EmptyTest.kt b/sync/work/src/test/kotlin/EmptyTest.kt new file mode 100644 index 000000000..b6a1d4919 --- /dev/null +++ b/sync/work/src/test/kotlin/EmptyTest.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2024 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 + * + * https://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 org.junit.Test + +/** + * Workaround for https://issuetracker.google.com/329869184 + */ +class EmptyTest { + @Test + fun test1() { } +}