Skip to content

Commit

Permalink
Clean up gradle-profiler build set up
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
liutikas committed Aug 12, 2024
1 parent 1125b1e commit 469c843
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ tasks.test {
.getOrElse(JavaVersion.current().majorVersion)
languageVersion.set(JavaLanguageVersion.of(javaVersion))
providers.gradleProperty("testJavaVendor").map {
when (it.lowercase()) {
when (it.lowercase(Locale.US)) {
"oracle" -> vendor.set(JvmVendorSpec.ORACLE)
"openjdk" -> vendor.set(JvmVendorSpec.ADOPTIUM)
}
Expand Down Expand Up @@ -144,7 +144,7 @@ val testReports = mapOf(
"testHtmlReportWithOps" to "example-with-build-operations",
"testHtmlReportRegression" to "example-regression"
)
testReports.forEach { taskName, fileName ->
testReports.forEach { (taskName, fileName) ->
tasks.register<ProcessResources>(taskName) {
val dataFile = file("src/test/resources/org/gradle/profiler/report/${fileName}.json")
inputs.file(dataFile)
Expand Down
7 changes: 6 additions & 1 deletion buildSrc/src/main/kotlin/profiler.java-library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ repositories {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.withType<AbstractCompile>().configureEach {
targetCompatibility = "8"
sourceCompatibility = "8"
}

tasks.withType<Test>().configureEach {
// Add OS as inputs since tests on different OS may behave differently https://github.com/gradle/gradle-private/issues/2831
// the version currently differs between our dev infrastructure, so we only track the name and the architecture
Expand Down
11 changes: 0 additions & 11 deletions subprojects/build-operations/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,3 @@ plugins {
dependencies {
api(gradleApi())
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

tasks.withType<AbstractCompile>().configureEach {
targetCompatibility = "8"
sourceCompatibility = "8"
}
6 changes: 0 additions & 6 deletions subprojects/studio-agent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ plugins {
id("profiler.embedded-library")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

dependencies {
implementation("org.ow2.asm:asm:9.2")
implementation(project(":client-protocol"))
Expand Down
7 changes: 6 additions & 1 deletion subprojects/studio-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ project.configurations

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.withType<AbstractCompile>().configureEach {
targetCompatibility = "11"
sourceCompatibility = "11"
}

tasks.test {
useJUnitPlatform()
// Disable IntelliJ file system access check for tests: having this check enabled can fail
Expand Down

0 comments on commit 469c843

Please sign in to comment.