Skip to content

Commit

Permalink
Upgrade gradle build
Browse files Browse the repository at this point in the history
This commit upgrades the gradle build so that
- Java 21 is used in the build chain
- Upgrade graalvm plugin
- Use Oracle as Java vendor
- Add toolchain resolver to automatically download requires Java runtime
- Bump Gradle 8.10

Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Sep 4, 2024
1 parent 26d9ab3 commit 949e6eb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup Graalvm
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.8'
java-version: '21'
distribution: 'graalvm'
components: 'native-image'
native-image-musl: 'true'
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
- name: Setup Graalvm
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.8'
java-version: '21'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '17.0.8'
java-version: '21'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
- name: Setup Graalvm
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.8'
java-version: '21'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -340,7 +340,7 @@ jobs:
- name: Setup Java for JReleaser
uses: actions/setup-java@v4
with:
java-version: 17.0.8
java-version: '21'
distribution: 'adopt'

- name: Version
Expand Down
13 changes: 10 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'application'
id 'jacoco'
id 'org.cadixdev.licenser' version '0.6.1'
id 'org.graalvm.buildtools.native'
id 'org.graalvm.buildtools.native' version '0.10.2'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

Expand Down Expand Up @@ -67,6 +67,12 @@ task buildInfo {
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

compileJava {
sourceCompatibility = JavaVersion.toVersion("11")
targetCompatibility = JavaVersion.toVersion("11")
Expand All @@ -93,6 +99,7 @@ test {
}

graalvmNative {
toolchainDetection = true
binaries {
main {
imageName = 'tw'
Expand All @@ -109,14 +116,14 @@ graalvmNative {
buildArgs.add('-H:+ReportExceptionStackTraces')

javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.matching("Oracle Corporation")
}

}

test {
verbose = true
agent = false
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 7 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ pluginManagement {
}
}

plugins {
// required to download the toolchain (jdk) from a remote repository
// https://github.com/gradle/foojay-toolchains
// https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

rootProject.name = 'tower-cli'

0 comments on commit 949e6eb

Please sign in to comment.