diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa24657..93b1a92 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: build: - timeout-minutes: 40 + timeout-minutes: 60 runs-on: ubuntu-latest steps: # See: https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ diff --git a/README.md b/README.md index bb754e1..fc8e258 100644 --- a/README.md +++ b/README.md @@ -150,10 +150,10 @@ for specific modules: generateHtml = true generateXml = false - // Since 1.2: Same as executeTests except that this only affects the instrumented Android tests + // Since 1.2: When true this plugin will run the necessary Gradle tasks to execute instrumented Android tests executeAndroidTests = true - // Since 1.2: Same as executeTests except that this only affects the unit tests + // Since 1.2: When true this plugin will run the necessary Gradle tasks to execute unit tests executeUnitTests = true // Since 1.2: When true include results from instrumented Android tests into the coverage report @@ -173,7 +173,7 @@ for specific modules: // Since 1.7 (experimental): The name of the Gradle Managed device to run instrumented tests on. // This is only used if `runOnGradleManagedDevices` is set to true. If not given tests will be // run on all available Gradle Managed Devices - gradleManagedDeviceName = "nexusoneapi30" + gradleManagedDeviceName = "smallphoneapi32" } ``` @@ -195,11 +195,11 @@ for specific modules: generateCsv false generateHtml true generateXml false - - // Since 1.2: Same as executeTests except that this only affects the instrumented Android tests + + // Since 1.2: When true this plugin will run the necessary Gradle tasks to execute instrumented Android tests executeAndroidTests true - - // Since 1.2: Same as executeTests except that this only affects the unit tests + + // Since 1.2: When true this plugin will run the necessary Gradle tasks to execute unit tests executeUnitTests true // Since 1.2: When true include results from instrumented Android tests into the coverage report @@ -219,29 +219,30 @@ for specific modules: // Since 1.7 (experimental): The name of the Gradle Managed device to run instrumented tests on. // This is only used if `runOnGradleManagedDevices` is set to true. If not given tests will be // run on all available Gradle Managed Devices - gradleManagedDeviceName "nexusoneapi30" + gradleManagedDeviceName "smallphoneapi32" } ``` # 4. Compatibility -| Version | [Android Gradle plugin version](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle) | Gradle version | -|------------|--------------------------------------------------------------------------------------------------------------|------------------------| -| **1.11.0** | 8.11+ | 8.13+ | -| **1.10.0** | 8.8+ | 8.10.2+ | -| **1.9.0** | 8.6+ | 8.7+ | -| **1.8.0** | 8.5.2
8.4.2
8.3.0-alpha05 - 8.3.2 | 8.6+
8.5+
8.4+ | -| **Note 1** | 8.0 - 8.3.0-alpha04 | n.a. | -| **1.7.1** | 7.4 | 7.5+ | -| **1.6.0** | 7.3 | 7.4+ | -| **1.5.3** | 7.2 | 7.3+ | -| **Note 2** | 7.0 - 7.2.0-alpha05 | n.a. | -| **1.4.0** | 4.2
4.1 | 6.7.1+
6.5+ | -| **1.3.1** | 4.0
3.6 | 6.1.1+
5.6.4+ | -| **1.2.1** | 3.5 | 5.4.1+ | -| **1.1.2** | 3.4 | 5.1.1+ | -| **1.1.1** | 3.3 | 4.10.1+ | -| **1.0.2** | 3.2 | 4.6+ | +| Version | [Android Gradle plugin version](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle) | Gradle version | +|---------------------|--------------------------------------------------------------------------------------------------------------|------------------------| +| **1.12.0-SNAPSHOT** | 9.0+ | 9.1+ | +| **1.11.0** | 8.11+ | 8.13+ | +| **1.10.0** | 8.8+ | 8.10.2+ | +| **1.9.0** | 8.6+ | 8.7+ | +| **1.8.0** | 8.5.2
8.4.2
8.3.0-alpha05 - 8.3.2 | 8.6+
8.5+
8.4+ | +| **Note 1** | 8.0 - 8.3.0-alpha04 | n.a. | +| **1.7.1** | 7.4 | 7.5+ | +| **1.6.0** | 7.3 | 7.4+ | +| **1.5.3** | 7.2 | 7.3+ | +| **Note 2** | 7.0 - 7.2.0-alpha05 | n.a. | +| **1.4.0** | 4.2
4.1 | 6.7.1+
6.5+ | +| **1.3.1** | 4.0
3.6 | 6.1.1+
5.6.4+ | +| **1.2.1** | 3.5 | 5.4.1+ | +| **1.1.2** | 3.4 | 5.1.1+ | +| **1.1.1** | 3.3 | 4.10.1+ | +| **1.0.2** | 3.2 | 4.6+ |
Note 1: AGP 8.0-8.3.0-alpha04 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8187ab3..54bdbfe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,9 @@ [versions] -androidMinSdk = "21" -androidTargetSdk = "35" +androidMinSdk = "24" +androidTargetSdk = "36" androidCompileSdk = "36" -kotlin = "2.2.0" -androidGradlePlugin = "8.11.1" +kotlin = "2.3.10" +androidGradlePlugin = "9.0.0" [libraries] appCompat = { module = "androidx.appcompat:appcompat", version = "1.7.1" } @@ -12,17 +12,17 @@ androidGradlePluginApi = { module = "com.android.tools.build:gradle-api", vers # Test dependencies junit = { module = "junit:junit", version = "4.13.2" } -testOrchestrator = { module = "androidx.test:orchestrator", version = "1.5.1" } +testOrchestrator = { module = "androidx.test:orchestrator", version = "1.6.1" } truth = { module = "com.google.truth:truth", version = "1.4.4" } supportTestRunner = { module = "androidx.test:runner", version = "1.6.2" } -espressoCore = { module = "androidx.test.espresso:espresso-core", version = "3.6.1" } -androidJUnit = { module = "androidx.test.ext:junit", version = "1.2.1" } -commonsCsv = { module = "org.apache.commons:commons-csv", version = "1.14.0" } +espressoCore = { module = "androidx.test.espresso:espresso-core", version = "3.7.0" } +androidJUnit = { module = "androidx.test.ext:junit", version = "1.3.0" } +commonsCsv = { module = "org.apache.commons:commons-csv", version = "1.14.1" } kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } -robolectric = { module = "org.robolectric:robolectric", version = "4.15.1" } -mockk = { module = "io.mockk:mockk", version = "1.14.5" } -jacksonYaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version = "2.19.2"} -jacksonKotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version = "2.19.2"} +robolectric = { module = "org.robolectric:robolectric", version = "4.16.1" } +mockk = { module = "io.mockk:mockk", version = "1.14.9" } +jacksonYaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version = "2.21.0"} +jacksonKotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version = "2.21.0"} [bundles] androidInstrumentedTest = ["supportTestRunner", "espressoCore", "androidJUnit"] @@ -31,7 +31,6 @@ jvmTest = ["kotlinTest", "junit", "truth", "commonsCsv"] [plugins] kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlinDokka = { id = "org.jetbrains.dokka", version = "2.0.0" } pluginPortalPublish = { id = "com.gradle.plugin-publish", version = "1.3.1" } mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.34.0" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d4081da..2e11132 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f5feea6..23d15a9 100755 --- a/gradlew +++ b/gradlew @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -115,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -206,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -214,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 9b42019..5eed7ee 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,11 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/plugin/build.gradle b/plugin/build.gradle index b60de83..2b2cf06 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -102,7 +102,7 @@ pluginManager.withPlugin("jacoco") { // Extracts the JaCoCo runtime jar from the configured JaCoCo Agent def extractJacocoRuntimeTask = tasks.register("extractJacocoTestKitRuntime", Copy) { from { - zipTree(project.configurations.getByName(JacocoPlugin.AGENT_CONFIGURATION_NAME).asPath).matching { include 'jacocoagent.jar' }.singleFile + zipTree(project.configurations.named(JacocoPlugin.AGENT_CONFIGURATION_NAME).map {it.asPath }).matching { include 'jacocoagent.jar' }.singleFile } into project.layout.buildDirectory.dir("testkit") } @@ -118,12 +118,12 @@ pluginManager.withPlugin("jacoco") { it.group = "reporting" it.description = "Generates testkit-gradle.properties file which can be read and added to a TestKit build as gradle.properties" it.dependsOn(extractJacocoRuntimeTask) - it.outputFile = new File(buildDir, "testkit/${javaTestTask.name}/gradle.properties") - it.property("org.gradle.jvmargs", "\"-javaagent:${buildDir}/testkit/jacocoagent.jar=destfile=${destinationFileProvider.get()}\"") + it.destinationFile.set(project.layout.buildDirectory.file("testkit/${javaTestTask.name}/gradle.properties")) + it.property("org.gradle.jvmargs", "\"-javaagent:${project.layout.buildDirectory.get()}/testkit/jacocoagent.jar=destfile=${destinationFileProvider.get()}\"") } // Make the generated gradle.properties file available on the test classpath as resource - dependencies.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, files(new File(buildDir, "testkit/${javaTestTask.name}"))) + dependencies.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, files(project.layout.buildDirectory.file("testkit/${javaTestTask.name}"))) // "Fixes": https://github.com/gradle/gradle/issues/16603 def jacocoTestReport = tasks.named("jacocoTestReport") diff --git a/plugin/gradle.properties b/plugin/gradle.properties index 611c12b..126b99f 100644 --- a/plugin/gradle.properties +++ b/plugin/gradle.properties @@ -1,4 +1,4 @@ POM_ARTIFACT_ID=android-root-coverage-plugin -VERSION_NAME=1.11.0 +VERSION_NAME=1.12.0-SNAPSHOT POM_NAME=Android Root Coverage Plugin POM_DESCRIPTION=A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules. diff --git a/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/CustomJacocoReportTask.kt b/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/CustomJacocoReportTask.kt index 10e2820..db32644 100644 --- a/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/CustomJacocoReportTask.kt +++ b/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/CustomJacocoReportTask.kt @@ -1,6 +1,5 @@ package org.neotech.plugin.rootcoverage -import org.gradle.api.file.ConfigurableFileTree import org.gradle.api.file.Directory import org.gradle.api.file.FileTree import org.gradle.api.file.RegularFile @@ -10,7 +9,6 @@ import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.util.PatternSet import org.gradle.testing.jacoco.tasks.JacocoReport -import org.neotech.plugin.rootcoverage.utilities.fileTree abstract class CustomJacocoReportTask : JacocoReport() { diff --git a/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePlugin.kt b/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePlugin.kt index f1ffc9f..0d8d281 100644 --- a/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePlugin.kt +++ b/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePlugin.kt @@ -3,11 +3,11 @@ package org.neotech.plugin.rootcoverage import com.android.build.api.AndroidPluginVersion import com.android.build.api.artifact.ScopedArtifact import com.android.build.api.dsl.BuildType +import com.android.build.api.dsl.CommonExtension import com.android.build.api.variant.ApplicationAndroidComponentsExtension import com.android.build.api.variant.LibraryAndroidComponentsExtension import com.android.build.api.variant.ScopedArtifacts import com.android.build.api.variant.Variant -import com.android.build.gradle.BaseExtension import org.gradle.api.GradleException import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.Plugin @@ -24,7 +24,7 @@ import java.io.File class RootCoveragePlugin : Plugin { - private val minimumRequiredAgpVersion = AndroidPluginVersion(8, 8, 0) + private val minimumRequiredAgpVersion = AndroidPluginVersion(9, 0, 0) private lateinit var rootProjectExtension: RootCoveragePluginExtension @@ -201,7 +201,7 @@ class RootCoveragePlugin : Plugin { // - A user provided Gradle Managed Device. // - All Gradle Managed Devices if any is available. // - All through ADB connected devices. - val gradleManagedDevices = subProject.extensions.getByType(BaseExtension::class.java).testOptions.managedDevices.devices + val gradleManagedDevices = subProject.extensions.getByType(CommonExtension::class.java).testOptions.managedDevices.allDevices if (rootProjectExtension.runOnGradleManagedDevices && !rootProjectExtension.gradleManagedDeviceName.isNullOrEmpty()) { return AndroidTestTask( diff --git a/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePluginExtension.kt b/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePluginExtension.kt index adc8f08..eb48758 100644 --- a/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePluginExtension.kt +++ b/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePluginExtension.kt @@ -30,8 +30,6 @@ open class RootCoveragePluginExtension { * Same as executeUnitTests except that this only disables/enables the instrumented Android tests. * * Default: true - * - * @see executeTests */ var executeAndroidTests: Boolean = true @@ -47,18 +45,9 @@ open class RootCoveragePluginExtension { * Same as executeUnitTests except that this only disables/enables the instrumented Android tests. * * Default: true - * - * @see executeTests */ var executeUnitTests: Boolean = true - /** - * @see executeAndroidTests - * @see executeUnitTests - */ - @Deprecated("Instead use executeAndroidTests and/or executeUnitTests") - var executeTests: Boolean = true - /** * Whether to include results from instrumented Android tests into the final coverage report. If disabled this also causes the plugin to * not automatically execute instrumented Android tests (if not already disabled by `executeAndroidTests`). @@ -91,7 +80,7 @@ open class RootCoveragePluginExtension { */ var runOnGradleManagedDevices: Boolean = false - internal fun shouldExecuteAndroidTests() = executeTests && executeAndroidTests && includeAndroidTestResults + internal fun shouldExecuteAndroidTests() = executeAndroidTests && includeAndroidTestResults - internal fun shouldExecuteUnitTests() = executeTests && executeUnitTests && includeUnitTestResults + internal fun shouldExecuteUnitTests() = executeUnitTests && includeUnitTestResults } diff --git a/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/utilities/AndroidGradlePluginExtensions.kt b/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/utilities/AndroidGradlePluginExtensions.kt index 8c303b1..f21957b 100644 --- a/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/utilities/AndroidGradlePluginExtensions.kt +++ b/plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/utilities/AndroidGradlePluginExtensions.kt @@ -16,16 +16,14 @@ fun AndroidComponentsExtension<*, *, *>.assertMinimumRequiredAGPVersion(required } fun Project.onVariant(variantName: String, action: (variant: Variant?) -> Unit){ - var variant: Variant? = null val androidComponents = extensions.getByType(AndroidComponentsExtension::class.java) - androidComponents.onVariants { - if (it.name.replaceFirstChar(Char::titlecase) == variantName.replaceFirstChar(Char::titlecase)) { - variant = it + androidComponents.onVariants { variant -> + if (variant.name.replaceFirstChar(Char::titlecase) == variantName.replaceFirstChar(Char::titlecase)) { + afterEvaluate { + action(variant) + } } } - afterEvaluate { - action(variant) - } } fun Project.afterAndroidPluginApplied(notFoundAction: () -> Unit = {}, action: (AppliedPlugin) -> Unit) { diff --git a/plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/IntegrationTest.kt b/plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/IntegrationTest.kt index 2a90e82..2ca23e9 100644 --- a/plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/IntegrationTest.kt +++ b/plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/IntegrationTest.kt @@ -52,11 +52,11 @@ class IntegrationTest( "managedDevices", if (configuration.projectConfiguration.addGradleManagedDevice) { """ managedDevices { - devices { - nexusoneapi30 (com.android.build.api.dsl.ManagedVirtualDevice) { - device = "Nexus One" - apiLevel = 30 - systemImageSource = "aosp-atd" + localDevices { + smallphoneapi32 { + device = "Small Phone" + apiLevel = 32 + systemImageSource = "aosp" } } } @@ -99,7 +99,7 @@ class IntegrationTest( if (!runOnGradleManagedDevices) { executeGradleTasks(listOf("clean", "connectedDebugAndroidTest", "connectedDemoDebugAndroidTest")) } else { - executeGradleTasks(listOf("clean", "nexusoneapi30DebugAndroidTest", "nexusoneapi30DemoDebugAndroidTest")) + executeGradleTasks(listOf("clean", "smallphoneapi32DebugAndroidTest", "smallphoneapi32DemoDebugAndroidTest")) } listOf("coverageReport", "rootCodeCoverageReport", "--stacktrace") @@ -232,7 +232,7 @@ class IntegrationTest( val fixture = File("src/test/test-fixtures/multi-module") - val gradleVersions = arrayOf("8.13", "8.14.3") + val gradleVersions = arrayOf("9.1.0", "9.2.1", "9.3.1") val configurations = File(fixture, "configurations").listFiles() ?: error("Configurations folder not found in $fixture") return configurations.flatMap { configuration -> diff --git a/plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePluginExtensionTest.kt b/plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePluginExtensionTest.kt index 27de0e5..389a9e4 100644 --- a/plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePluginExtensionTest.kt +++ b/plugin/src/test/kotlin/org/neotech/plugin/rootcoverage/RootCoveragePluginExtensionTest.kt @@ -13,46 +13,4 @@ class RootCoveragePluginExtensionTest { assertEquals(true, config.shouldExecuteUnitTests()) assertEquals(true, config.shouldExecuteAndroidTests()) } - - @Test - fun `executeTests=false overrules execute(Unit or Android)Tests`() { - val config = RootCoveragePluginExtension().apply { - executeTests = false - } - - config.apply { - executeAndroidTests = true - executeUnitTests = true - } - assertEquals(false, config.shouldExecuteUnitTests()) - assertEquals(false, config.shouldExecuteAndroidTests()) - - config.apply { - executeAndroidTests = false - executeUnitTests = false - } - assertEquals(false, config.shouldExecuteUnitTests()) - assertEquals(false, config.shouldExecuteAndroidTests()) - } - - @Test - fun `executeTests=true does not overrule execute(Unit or AndroidInstrumented)Tests`() { - val config = RootCoveragePluginExtension().apply { - executeTests = true - } - - config.apply { - executeAndroidTests = false - executeUnitTests = false - } - assertEquals(false, config.shouldExecuteUnitTests()) - assertEquals(false, config.shouldExecuteAndroidTests()) - - config.apply { - executeAndroidTests = true - executeUnitTests = true - } - assertEquals(true, config.shouldExecuteUnitTests()) - assertEquals(true, config.shouldExecuteAndroidTests()) - } } \ No newline at end of file diff --git a/plugin/src/test/test-fixtures/multi-module/app/build.gradle.tmp b/plugin/src/test/test-fixtures/multi-module/app/build.gradle.tmp index c5c245d..33bdda3 100644 --- a/plugin/src/test/test-fixtures/multi-module/app/build.gradle.tmp +++ b/plugin/src/test/test-fixtures/multi-module/app/build.gradle.tmp @@ -1,6 +1,8 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { id "com.android.application" - alias(libs.plugins.kotlinAndroid) + // Kotlin cannot be applied here again, as the plugin is already on the class path via withPluginClasspath() } android { @@ -35,7 +37,7 @@ android { release { matchingFallbacks = ['full'] minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } @@ -53,9 +55,11 @@ android { {{managedDevices}} } +} - kotlinOptions { - jvmTarget = "21" +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_21) } } diff --git a/plugin/src/test/test-fixtures/multi-module/build.gradle.tmp b/plugin/src/test/test-fixtures/multi-module/build.gradle.tmp index aa29b6e..8d7eaf5 100644 --- a/plugin/src/test/test-fixtures/multi-module/build.gradle.tmp +++ b/plugin/src/test/test-fixtures/multi-module/build.gradle.tmp @@ -17,7 +17,7 @@ task clean(type: Delete) { jacoco { // https://www.jacoco.org/jacoco/trunk/doc/changes.html - toolVersion = "0.8.12" + toolVersion = "0.8.14" } rootCoverage { diff --git a/plugin/src/test/test-fixtures/multi-module/configurations/connected-device.yaml b/plugin/src/test/test-fixtures/multi-module/configurations/connected-device.yaml index 1403139..b4fbccf 100644 --- a/plugin/src/test/test-fixtures/multi-module/configurations/connected-device.yaml +++ b/plugin/src/test/test-fixtures/multi-module/configurations/connected-device.yaml @@ -15,8 +15,6 @@ pluginConfiguration: value: ":library_android_flavors": "demoDebug" - - name: executeTests - value: true - name: includeUnitTestResults value: true - name: includeAndroidTestResults diff --git a/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-clear-package-data.yaml b/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-clear-package-data.yaml index 18e7f1c..d98caa1 100644 --- a/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-clear-package-data.yaml +++ b/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-clear-package-data.yaml @@ -17,9 +17,6 @@ pluginConfiguration: value: ":library_android_flavors": "demoDebug" - - name: executeTests - value: true - - name: includeUnitTestResults value: true - name: includeAndroidTestResults @@ -30,4 +27,4 @@ pluginConfiguration: - name: runOnGradleManagedDevices value: true - name: gradleManagedDeviceName - value: nexusoneapi30 \ No newline at end of file + value: smallphoneapi32 \ No newline at end of file diff --git a/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-dont-execute-android-tests.yaml b/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-dont-execute-android-tests.yaml index f034656..73c507a 100644 --- a/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-dont-execute-android-tests.yaml +++ b/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-dont-execute-android-tests.yaml @@ -30,4 +30,4 @@ pluginConfiguration: - name: runOnGradleManagedDevices value: true - name: gradleManagedDeviceName - value: nexusoneapi30 \ No newline at end of file + value: smallphoneapi32 \ No newline at end of file diff --git a/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device.yaml b/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device.yaml index 501b9de..6e0b3a4 100644 --- a/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device.yaml +++ b/plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device.yaml @@ -15,9 +15,6 @@ pluginConfiguration: value: ":library_android_flavors": "demoDebug" - - name: executeTests - value: true - - name: includeUnitTestResults value: true - name: includeAndroidTestResults @@ -28,4 +25,4 @@ pluginConfiguration: - name: runOnGradleManagedDevices value: true - name: gradleManagedDeviceName - value: nexusoneapi30 \ No newline at end of file + value: smallphoneapi32 \ No newline at end of file diff --git a/plugin/src/test/test-fixtures/multi-module/library_android/build.gradle b/plugin/src/test/test-fixtures/multi-module/library_android/build.gradle index 170186a..0fcf3eb 100644 --- a/plugin/src/test/test-fixtures/multi-module/library_android/build.gradle +++ b/plugin/src/test/test-fixtures/multi-module/library_android/build.gradle @@ -1,6 +1,8 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { id "com.android.library" - alias(libs.plugins.kotlinAndroid) + // Kotlin cannot be applied here again, as the plugin is already on the class path via withPluginClasspath() } android { @@ -28,7 +30,7 @@ android { } release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } @@ -39,18 +41,20 @@ android { testOptions { managedDevices { - devices { - nexusoneapi30 (com.android.build.api.dsl.ManagedVirtualDevice) { - device = "Nexus One" - apiLevel = 30 - systemImageSource = "aosp-atd" + localDevices { + smallphoneapi32 { + device = "Small Phone" + apiLevel = 32 + systemImageSource = "aosp" } } } } +} - kotlinOptions { - jvmTarget = "21" +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_21) } } diff --git a/plugin/src/test/test-fixtures/multi-module/library_android_flavors/build.gradle b/plugin/src/test/test-fixtures/multi-module/library_android_flavors/build.gradle index a3521a1..2e5ca93 100644 --- a/plugin/src/test/test-fixtures/multi-module/library_android_flavors/build.gradle +++ b/plugin/src/test/test-fixtures/multi-module/library_android_flavors/build.gradle @@ -1,6 +1,8 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { id "com.android.library" - alias(libs.plugins.kotlinAndroid) + // Kotlin cannot be applied here again, as the plugin is already on the class path via withPluginClasspath() } android { @@ -28,7 +30,7 @@ android { } release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } @@ -49,18 +51,20 @@ android { testOptions { managedDevices { - devices { - nexusoneapi30 (com.android.build.api.dsl.ManagedVirtualDevice) { - device = "Nexus One" - apiLevel = 30 - systemImageSource = "aosp-atd" + localDevices { + smallphoneapi32 { + device = "Small Phone" + apiLevel = 32 + systemImageSource = "aosp" } } } } +} - kotlinOptions { - jvmTarget = "21" +kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_21) } } diff --git a/plugin/src/test/test-fixtures/multi-module/library_java/build.gradle b/plugin/src/test/test-fixtures/multi-module/library_java/build.gradle index ab48789..018e166 100644 --- a/plugin/src/test/test-fixtures/multi-module/library_java/build.gradle +++ b/plugin/src/test/test-fixtures/multi-module/library_java/build.gradle @@ -6,5 +6,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) } -sourceCompatibility = JavaVersion.VERSION_21 -targetCompatibility = JavaVersion.VERSION_21 +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} diff --git a/plugin/src/test/test-fixtures/multi-module/library_nested/java/build.gradle b/plugin/src/test/test-fixtures/multi-module/library_nested/java/build.gradle index ab48789..018e166 100644 --- a/plugin/src/test/test-fixtures/multi-module/library_nested/java/build.gradle +++ b/plugin/src/test/test-fixtures/multi-module/library_nested/java/build.gradle @@ -6,5 +6,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) } -sourceCompatibility = JavaVersion.VERSION_21 -targetCompatibility = JavaVersion.VERSION_21 +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +}