diff --git a/Changelog.md b/Changelog.md index 08a029c2..eb361b6b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Changed - Require using Kotlin 1.4 for all library consumers. Bump min supported Gradle version to 6.8.3 - Update Kotlin plugin to [1.5.0](https://github.com/JetBrains/kotlin/releases/tag/v1.5.0) +- Update Jacoco version to `0.8.7-SNAPSHOT` to [support Kotlin 1.5](https://github.com/detekt/detekt/pull/3718/files) ## [0.25.0] - 2021-04-15 ## Added diff --git a/android/build.gradle b/android/build.gradle index f70346db..0c9e6ce9 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,7 +21,7 @@ dependencies { testImplementation project(":testing") } -tasks.withType(Test) { +tasks.withType(Test).configureEach { useJUnitPlatform() } diff --git a/android/src/main/kotlin/com/project/starter/quality/internal/AndroidCoverage.kt b/android/src/main/kotlin/com/project/starter/quality/internal/AndroidCoverage.kt index d648afd6..e86586d3 100644 --- a/android/src/main/kotlin/com/project/starter/quality/internal/AndroidCoverage.kt +++ b/android/src/main/kotlin/com/project/starter/quality/internal/AndroidCoverage.kt @@ -6,13 +6,17 @@ import com.project.starter.modules.internal.daggerCoverageExclusions import org.gradle.api.DomainObjectSet import org.gradle.api.Project import org.gradle.api.tasks.testing.Test +import org.gradle.testing.jacoco.plugins.JacocoPluginExtension import org.gradle.testing.jacoco.plugins.JacocoTaskExtension import org.gradle.testing.jacoco.tasks.JacocoReport internal fun Project.configureAndroidCoverage(variants: DomainObjectSet, projectExclusions: List) { pluginManager.apply("jacoco") - tasks.withType(Test::class.java) { + extensions.configure(JacocoPluginExtension::class.java) { + it.toolVersion = "0.8.7-SNAPSHOT" + } + tasks.withType(Test::class.java).configureEach { it.extensions.getByType(JacocoTaskExtension::class.java).apply { isIncludeNoLocationClasses = true excludes = listOf("jdk.internal.*") diff --git a/android/src/test/kotlin/com/project/starter/quality/AndroidQualityPluginTest.kt b/android/src/test/kotlin/com/project/starter/quality/AndroidQualityPluginTest.kt index cf25591b..b85ba51a 100644 --- a/android/src/test/kotlin/com/project/starter/quality/AndroidQualityPluginTest.kt +++ b/android/src/test/kotlin/com/project/starter/quality/AndroidQualityPluginTest.kt @@ -62,7 +62,7 @@ internal class AndroidQualityPluginTest : WithGradleProjectTest() { repositories { google() - jcenter() + mavenCentral() } android { diff --git a/build.gradle b/build.gradle index f9c740b2..c442c8da 100644 --- a/build.gradle +++ b/build.gradle @@ -12,14 +12,15 @@ commonConfig { allprojects { tasks.withType(KotlinCompile).configureEach { kotlinOptions { + apiVersion = "1.4" + languageVersion = "1.4" useIR = true } } configurations.configureEach { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - def requested = details.requested + resolutionStrategy.eachDependency { if (requested.group == 'org.jetbrains.kotlin' && requested.name.startsWith("kotlin")) { - details.useVersion "1.5.0" + useVersion "1.5.0" } } } diff --git a/jvm/src/main/kotlin/com/project/starter/modules/internal/KotlinCoverage.kt b/jvm/src/main/kotlin/com/project/starter/modules/internal/KotlinCoverage.kt index 3ad844fc..6d0365a9 100644 --- a/jvm/src/main/kotlin/com/project/starter/modules/internal/KotlinCoverage.kt +++ b/jvm/src/main/kotlin/com/project/starter/modules/internal/KotlinCoverage.kt @@ -17,7 +17,7 @@ internal fun Project.configureKotlinCoverage() { } } extensions.configure(JacocoPluginExtension::class.java) { - it.toolVersion = "0.8.6" + it.toolVersion = "0.8.7-SNAPSHOT" } tasks.named("jacocoTestReport", JacocoReport::class.java) { it.dependsOn(":$path:test") diff --git a/jvm/src/main/kotlin/com/project/starter/modules/internal/Repositories.kt b/jvm/src/main/kotlin/com/project/starter/modules/internal/Repositories.kt index b9ee1ddf..107e2f2f 100644 --- a/jvm/src/main/kotlin/com/project/starter/modules/internal/Repositories.kt +++ b/jvm/src/main/kotlin/com/project/starter/modules/internal/Repositories.kt @@ -3,23 +3,24 @@ package com.project.starter.modules.internal import org.gradle.api.Project internal fun Project.configureRepositories(): Unit = with(repositories) { - google { repository -> - repository.mavenContent { content -> + exclusiveContent { content -> + content.forRepository { google() } + content.filter { val googleLibraries = listOf( "com\\.android.*", - "androidx.*", - "android.arch.*", - "com\\.google.*" + "androidx\\..*", + "android\\.arch\\..*", + "com\\.google\\.android\\..*", + "com\\.google\\.gms", ) - googleLibraries.forEach(content::includeGroupByRegex) + googleLibraries.forEach(it::includeGroupByRegex) } } - mavenCentral() - @Suppress("DEPRECATION") - jcenter { repository -> - repository.mavenContent { content -> - content.includeGroup("org.jetbrains.trove4j") - content.includeGroup("org.jetbrains.kotlinx") + exclusiveContent { content -> + content.forRepository { + maven { it.setUrl("https://oss.sonatype.org/content/repositories/snapshots") } } + content.filter { it.includeGroup("org.jacoco") } } + mavenCentral() } diff --git a/multiplatform/build.gradle b/multiplatform/build.gradle index d75c7be8..b6860eaa 100644 --- a/multiplatform/build.gradle +++ b/multiplatform/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java-gradle-plugin' id 'com.starter.library.kotlin' - id 'pl.droidsonroids.jacoco.testkit' version '1.0.7' + id 'pl.droidsonroids.jacoco.testkit' version '1.0.8' id 'com.starter.publishing' } @@ -18,9 +18,6 @@ dependencies { testImplementation project(":testing") } -jacoco { - toolVersion = "0.8.6" -} test { useJUnitPlatform() } diff --git a/multiplatform/src/main/kotlin/com/project/starter/modules/internal/MultiplatformCoverage.kt b/multiplatform/src/main/kotlin/com/project/starter/modules/internal/MultiplatformCoverage.kt index 310c947a..eeb3d6eb 100644 --- a/multiplatform/src/main/kotlin/com/project/starter/modules/internal/MultiplatformCoverage.kt +++ b/multiplatform/src/main/kotlin/com/project/starter/modules/internal/MultiplatformCoverage.kt @@ -10,7 +10,7 @@ import org.gradle.testing.jacoco.tasks.JacocoReport internal fun Project.configureMultiplatformCoverage() { pluginManager.apply("jacoco") - tasks.withType(Test::class.java) { + tasks.withType(Test::class.java).configureEach { it.extensions.getByType().apply { isIncludeNoLocationClasses = true excludes = listOf("jdk.internal.*") @@ -18,7 +18,7 @@ internal fun Project.configureMultiplatformCoverage() { } extensions.configure(JacocoPluginExtension::class.java) { - it.toolVersion = "0.8.6" + it.toolVersion = "0.8.7-SNAPSHOT" } tasks.register("jacocoTestReport", JacocoReport::class.java) { it.dependsOn(":$path:jvmTest") diff --git a/multiplatform/src/main/kotlin/com/project/starter/modules/internal/Repositories.kt b/multiplatform/src/main/kotlin/com/project/starter/modules/internal/Repositories.kt deleted file mode 100644 index 2a5d531f..00000000 --- a/multiplatform/src/main/kotlin/com/project/starter/modules/internal/Repositories.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.project.starter.modules.internal - -import org.gradle.api.Project - -internal fun Project.configureRepositories(): Unit = with(repositories) { - google { repository -> - repository.mavenContent { content -> - val googleLibraries = listOf( - "com\\.android.*", - "androidx.*", - "android.arch.*", - "com\\.google.*" - ) - googleLibraries.forEach(content::includeGroupByRegex) - } - } - mavenCentral() -} diff --git a/quality/src/main/kotlin/com/project/starter/quality/internal/Detekt.kt b/quality/src/main/kotlin/com/project/starter/quality/internal/Detekt.kt index 2837427e..bb88f3a3 100644 --- a/quality/src/main/kotlin/com/project/starter/quality/internal/Detekt.kt +++ b/quality/src/main/kotlin/com/project/starter/quality/internal/Detekt.kt @@ -33,7 +33,12 @@ internal fun Project.configureDetekt() { tasks.named(ProjectCodeStyleTask.TASK_NAME) { it.dependsOn("$path:detekt") } - tasks.withType(Detekt::class.java) { + tasks.withType(Detekt::class.java).configureEach { it.jvmTarget = rootConfig.javaVersion.toString() } + + // https://github.com/detekt/detekt/issues/3712 + configurations.named("detekt") { + it.resolutionStrategy.force("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.3") + } } diff --git a/quality/src/main/kotlin/com/project/starter/quality/plugins/QualityPlugin.kt b/quality/src/main/kotlin/com/project/starter/quality/plugins/QualityPlugin.kt index 78bc9bde..0f92f26c 100644 --- a/quality/src/main/kotlin/com/project/starter/quality/plugins/QualityPlugin.kt +++ b/quality/src/main/kotlin/com/project/starter/quality/plugins/QualityPlugin.kt @@ -23,12 +23,6 @@ class QualityPlugin : Plugin { override fun apply(project: Project) = with(project) { repositories.mavenCentral() - repositories.exclusiveContent { - it.forRepositories(repositories.jcenter()) - it.filter { - it.includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm") - } - } addProjectCodeStyleTask() configureKtlint() configureDetekt() diff --git a/quality/src/test/kotlin/com/project/starter/quality/QualityPluginTest.kt b/quality/src/test/kotlin/com/project/starter/quality/QualityPluginTest.kt index fc355cf9..3e36a2fe 100644 --- a/quality/src/test/kotlin/com/project/starter/quality/QualityPluginTest.kt +++ b/quality/src/test/kotlin/com/project/starter/quality/QualityPluginTest.kt @@ -22,7 +22,7 @@ internal class QualityPluginTest : WithGradleProjectTest() { id('org.jetbrains.kotlin.jvm') } - repositories.jcenter() + repositories.mavenCentral() """.trimIndent() ) }