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

Upgrade to gradle 8.6 #3056

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build-logic/basics/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
`kotlin-dsl`
}

tasks.withType<JavaCompile>().configureEach {
options.release.set((project.property("targetJavaVersion") as String).toInt())
}
Comment on lines +5 to +7
Copy link

Choose a reason for hiding this comment

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

Ensure that the "targetJavaVersion" project property is always defined and valid. If it's missing or not a valid integer, this code will throw an exception at runtime.

Consider adding error handling or a default value for "targetJavaVersion" to prevent build failures.

14 changes: 12 additions & 2 deletions build-logic/code-quality/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ repositories {

dependencies {
implementation("org.sonarqube:org.sonarqube.gradle.plugin:4.4.1.3373")
implementation("com.github.autostyle:autostyle-plugin-gradle:3.2")
implementation("com.github.autostyle:autostyle-plugin-gradle:4.0")
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(project.property("jdkBuildVersion") as String))
}
}

tasks.withType<JavaCompile>().configureEach {
options.release.set((project.property("targetJavaVersion") as String).toInt())
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
jvmTarget = project.property("targetJavaVersion") as String
}
}
12 changes: 11 additions & 1 deletion build-logic/jvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@ dependencies {
implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.6.21")
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(project.property("jdkBuildVersion") as String))
}
}

tasks.withType<JavaCompile>().configureEach {
options.release.set((project.property("targetJavaVersion") as String).toInt())
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
jvmTarget = project.property("targetJavaVersion") as String
}
}
6 changes: 4 additions & 2 deletions build-logic/jvm/src/main/kotlin/testng.java.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
toolchain {
languageVersion.set(JavaLanguageVersion.of(project.property("jdkBuildVersion") as String))
}
}

tasks.withType<JavaCompile>().configureEach {
options.release.set((project.property("targetJavaVersion") as String).toInt())
inputs.property("java.version", System.getProperty("java.version"))
inputs.property("java.vendor", System.getProperty("java.vendor"))
inputs.property("java.vm.version", System.getProperty("java.vm.version"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-stdlib")
}

tasks.withType<JavaCompile>().configureEach {
options.release.set((project.property("targetJavaVersion") as String).toInt())
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
jvmTarget = project.property("targetJavaVersion") as String
}
}
12 changes: 11 additions & 1 deletion build-logic/publishing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin")
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(project.property("jdkBuildVersion") as String))
}
}

tasks.withType<JavaCompile>().configureEach {
options.release.set((project.property("targetJavaVersion") as String).toInt())
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "11"
jvmTarget = project.property("targetJavaVersion") as String
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import org.gradle.api.artifacts.result.UnresolvedDependencyResult
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.kotlin.dsl.the
import java.util.*

/**
* Walks over the dependency tree and selects the first non-shaded dependencies.
Expand Down Expand Up @@ -57,7 +58,8 @@ fun Project.firstLayerDependencies(
vararg rest: Configuration,
): Configuration {
val optionalFeatures = (the<JavaPluginExtension>() as ExtensionAware).the<OptionalFeaturesExtension>()
val usageKind = usage.removePrefix("java-").capitalize()
val usageKind = usage.removePrefix("java-")
.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }

val allDependencies = configurations.create(conf.name + "${usageKind}AllDependencies") {
description = "Resolves the list of all dependencies for $usage in ${conf.name}"
Expand Down
7 changes: 6 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
org.gradle.parallel=true
systemProp.org.gradle.kotlin.dsl.precompiled.accessors.strict=true
kotlin.code.style=official
# See https://kotlinlang.org/docs/gradle.html#dependency-on-the-standard-library
# Note: testng.kotlin-library.gradle.kts adds kotlin-stdlib for testImplementation
kotlin.stdlib.default.dependency=false

testng.version=7.10.0
systemProp.org.gradle.project.targetJavaVersion=11
systemProp.org.gradle.project.jdkBuildVersion=17

group=org.testng

Expand All @@ -21,3 +22,7 @@ scm.url=https\://github.com/testng-team/testng.git
nexus.profile=org.testng
github.organization=testng-team
github.repository=testng

# Fix Gradle warning with sonarqube plugin v4.x
# See https://community.sonarsource.com/t/sonarscanner-for-gradle-you-can-now-decide-when-to-compile/102069
systemProp.sonar.gradle.skipCompile=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 4 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading