Skip to content

Commit 282f51d

Browse files
committed
Clean up gradle-profiler build set up
- Reduce number of java toolchains used from 3 to 1 (just need JDK 17 now) - Move to a shared place for setting java source and target version to 8 Signed-off-by: Aurimas Liutikas <[email protected]>
1 parent 1125b1e commit 282f51d

File tree

6 files changed

+17
-24
lines changed

6 files changed

+17
-24
lines changed

build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ tasks.test {
107107
.getOrElse(JavaVersion.current().majorVersion)
108108
languageVersion.set(JavaLanguageVersion.of(javaVersion))
109109
providers.gradleProperty("testJavaVendor").map {
110-
when (it.lowercase()) {
110+
when (it.lowercase(Locale.US)) {
111111
"oracle" -> vendor.set(JvmVendorSpec.ORACLE)
112112
"openjdk" -> vendor.set(JvmVendorSpec.ADOPTIUM)
113113
}
@@ -144,7 +144,7 @@ val testReports = mapOf(
144144
"testHtmlReportWithOps" to "example-with-build-operations",
145145
"testHtmlReportRegression" to "example-regression"
146146
)
147-
testReports.forEach { taskName, fileName ->
147+
testReports.forEach { (taskName, fileName) ->
148148
tasks.register<ProcessResources>(taskName) {
149149
val dataFile = file("src/test/resources/org/gradle/profiler/report/${fileName}.json")
150150
inputs.file(dataFile)

buildSrc/src/main/kotlin/profiler.java-library.gradle.kts

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@ repositories {
1818

1919
java {
2020
toolchain {
21-
languageVersion.set(JavaLanguageVersion.of(8))
21+
languageVersion.set(JavaLanguageVersion.of(17))
2222
}
2323
}
2424

25+
tasks.withType<AbstractCompile>().configureEach {
26+
targetCompatibility = "8"
27+
sourceCompatibility = "8"
28+
}
29+
2530
tasks.withType<Test>().configureEach {
2631
// Add OS as inputs since tests on different OS may behave differently https://github.com/gradle/gradle-private/issues/2831
2732
// the version currently differs between our dev infrastructure, so we only track the name and the architecture

settings.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ rootProject.children.forEach {
2020
}
2121

2222
/**
23-
* Intellij-gradle-plugin requires Java 11.
23+
* Building gradle-profile requires JDK 17.
2424
*/
2525
fun checkIfCurrentJavaIsCompatible() {
26-
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_11)) {
27-
throw GradleException("This project should be run with Java 11 or later, but it was run with Java ${JavaVersion.current()}.")
26+
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
27+
throw GradleException("This project should be build with JDK 17, but it was run with Java ${JavaVersion.current()}.")
2828
}
2929
}

subprojects/build-operations/build.gradle.kts

-11
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,3 @@ plugins {
55
dependencies {
66
api(gradleApi())
77
}
8-
9-
java {
10-
toolchain {
11-
languageVersion.set(JavaLanguageVersion.of(11))
12-
}
13-
}
14-
15-
tasks.withType<AbstractCompile>().configureEach {
16-
targetCompatibility = "8"
17-
sourceCompatibility = "8"
18-
}

subprojects/studio-agent/build.gradle.kts

-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ plugins {
22
id("profiler.embedded-library")
33
}
44

5-
java {
6-
toolchain {
7-
languageVersion.set(JavaLanguageVersion.of(11))
8-
}
9-
}
10-
115
dependencies {
126
implementation("org.ow2.asm:asm:9.2")
137
implementation(project(":client-protocol"))

subprojects/studio-plugin/build.gradle.kts

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,15 @@ project.configurations
3737

3838
java {
3939
toolchain {
40-
languageVersion.set(JavaLanguageVersion.of(11))
40+
languageVersion.set(JavaLanguageVersion.of(17))
4141
}
4242
}
4343

44+
tasks.withType<AbstractCompile>().configureEach {
45+
targetCompatibility = "11"
46+
sourceCompatibility = "11"
47+
}
48+
4449
tasks.test {
4550
useJUnitPlatform()
4651
// Disable IntelliJ file system access check for tests: having this check enabled can fail

0 commit comments

Comments
 (0)