Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin 1.6.10 #4277

Merged
merged 7 commits into from Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 1 addition & 8 deletions build-logic/src/main/kotlin/module.gradle.kts
Expand Up @@ -83,19 +83,12 @@ configurations.create("coverageDataElements") {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = Versions.JVM_TARGET
languageVersion = "1.5"
languageVersion = "1.6"
apiVersion = "1.4"
freeCompilerArgs = listOf(
"-progressive",
"-Xopt-in=kotlin.RequiresOptIn"
)
// Usage: <code>./gradlew build -PwarningsAsErrors=true</code>.
// Note: currently there are warnings for detekt-gradle-plugin that seemingly can't be fixed
// until Gradle releases an update (https://github.com/gradle/gradle/issues/16345)
allWarningsAsErrors = when (project.name) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the allWarningsAsErrors should be removed for the Gradle plugin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it's only off for the Gradle plugin because of the mismatched version warning.

This change turns it off for all modules (I'm not sure why).

I believe the article I linked above provides a workaround for the mismatched version issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change turns it off for all modules (I'm not sure why).

Because API version 1.4 is deprecated in Kotlin 1.6. All modules currently use API version 1.4, generating a deprecation warning. If warnings as errors is enabled the build then fails, so it has to be disabled.

Copy link
Member Author

@3flex 3flex Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just add that if API version used for all modules needs to change, or we make changes to the Gradle plugin build config, we should do that in another PR first. But as it stands, warnings as errors needs to be disabled to upgrade to 1.6.

"detekt-gradle-plugin" -> false
else -> (project.findProperty("warningsAsErrors") == "true" || System.getenv("CI") == "true")
}
}
}

Expand Down
Expand Up @@ -189,7 +189,7 @@ class CliArgs {
@Parameter(
names = ["--jvm-target"],
description = "EXPERIMENTAL: Target version of the generated JVM bytecode that was generated during " +
"compilation and is now being used for type resolution (1.6, 1.8, 9, 10, 11, 12, 13, 14, 15 or 16)"
"compilation and is now being used for type resolution (1.6, 1.8, 9, 10, 11, 12, 13, 14, 15, 16 or 17)"
)
var jvmTarget: String = JvmTarget.DEFAULT.description

Expand Down
16 changes: 16 additions & 0 deletions detekt-gradle-plugin/build.gradle.kts
@@ -1,3 +1,6 @@
import org.gradle.api.internal.classpath.ModuleRegistry
import org.gradle.kotlin.dsl.support.serviceOf

plugins {
id("module")
`java-gradle-plugin`
Expand All @@ -21,6 +24,19 @@ testing {
implementation(libs.kotlin.gradle)
implementation(gradleKotlinDsl())
runtimeOnly(libs.spek.runner)

// Workaround for gradle/gradle#16774, see
// https://github.com/gradle/gradle/issues/16774#issuecomment-853407822
// This should be reviewed and dropped if fixed as planned in Gradle 7.5
runtimeOnly(
files(
serviceOf<ModuleRegistry>()
.getModule("gradle-tooling-api-builders")
.classpath
.asFiles
.first()
)
)
}
}
register("functionalTest", JvmTestSuite::class) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
@@ -1,7 +1,7 @@
[versions]
dokka = "1.5.31"
jacoco = "0.8.7"
kotlin = "1.5.31"
kotlin = "1.6.10"
ktlint = "0.42.1"
spek = "2.0.17"

Expand Down