From 25ff91e28fa98c38ebaa9328f3ea0430d7b5a17a Mon Sep 17 00:00:00 2001 From: Guillermo Mazzola Date: Tue, 12 Sep 2023 10:50:42 +0200 Subject: [PATCH] Fixed incompatibility with `android.testFixtures.enable = true` --- demo-project/login/build.gradle.kts | 1 + .../test/aggregation/AndroidTestCoverageAggregationPlugin.kt | 2 ++ .../test/aggregation/AndroidTestResultsAggregationPlugin.kt | 3 +++ 3 files changed, 6 insertions(+) diff --git a/demo-project/login/build.gradle.kts b/demo-project/login/build.gradle.kts index 976b790..618aa35 100644 --- a/demo-project/login/build.gradle.kts +++ b/demo-project/login/build.gradle.kts @@ -7,6 +7,7 @@ android { namespace = "com.example.login" compileSdk = libs.versions.android.sdk.get().toInt() buildFeatures.viewBinding = true + testFixtures.enable = true defaultConfig { minSdk = 21 diff --git a/plugin/src/main/kotlin/io/github/gmazzo/android/test/aggregation/AndroidTestCoverageAggregationPlugin.kt b/plugin/src/main/kotlin/io/github/gmazzo/android/test/aggregation/AndroidTestCoverageAggregationPlugin.kt index d1ae935..af8fe35 100644 --- a/plugin/src/main/kotlin/io/github/gmazzo/android/test/aggregation/AndroidTestCoverageAggregationPlugin.kt +++ b/plugin/src/main/kotlin/io/github/gmazzo/android/test/aggregation/AndroidTestCoverageAggregationPlugin.kt @@ -95,6 +95,7 @@ abstract class AndroidTestCoverageAggregationPlugin : Plugin { isCanBeResolved = false isVisible = false attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(USAGE_TEST_AGGREGATION)) attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION)) attribute( TestSuiteType.TEST_SUITE_TYPE_ATTRIBUTE, @@ -129,6 +130,7 @@ abstract class AndroidTestCoverageAggregationPlugin : Plugin { isCanBeResolved = false isVisible = false attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(USAGE_TEST_AGGREGATION)) attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION)) attribute( TestSuiteType.TEST_SUITE_TYPE_ATTRIBUTE, diff --git a/plugin/src/main/kotlin/io/github/gmazzo/android/test/aggregation/AndroidTestResultsAggregationPlugin.kt b/plugin/src/main/kotlin/io/github/gmazzo/android/test/aggregation/AndroidTestResultsAggregationPlugin.kt index c232189..30352bc 100644 --- a/plugin/src/main/kotlin/io/github/gmazzo/android/test/aggregation/AndroidTestResultsAggregationPlugin.kt +++ b/plugin/src/main/kotlin/io/github/gmazzo/android/test/aggregation/AndroidTestResultsAggregationPlugin.kt @@ -5,9 +5,11 @@ import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.attributes.Category import org.gradle.api.attributes.TestSuiteType +import org.gradle.api.attributes.Usage import org.gradle.api.attributes.VerificationType import org.gradle.api.tasks.testing.Test import org.gradle.configurationcache.extensions.capitalized +import org.gradle.kotlin.dsl.USAGE_TEST_AGGREGATION import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.named @@ -21,6 +23,7 @@ abstract class AndroidTestResultsAggregationPlugin : Plugin { isCanBeResolved = false isVisible = false attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(USAGE_TEST_AGGREGATION)) attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.VERIFICATION)) attribute( TestSuiteType.TEST_SUITE_TYPE_ATTRIBUTE,