Skip to content

Commit

Permalink
Rip out dynamic image jre
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenbaker committed Dec 13, 2024
1 parent 2e95414 commit e883797
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ jobs:
distribution: 'corretto'

- name: Clean, build, test, and javadoc
run: ./gradlew clean build javadoc -PresolveImageJre -Plog-tests --stacktrace
run: ./gradlew clean build javadoc -Plog-tests --stacktrace

- name: Allow long file names in git for windows
if: matrix.os == 'windows-latest'
run: git config --system core.longpaths true

- name: Integration tests
run: ./gradlew integ -PresolveImageJre -Plog-tests --stacktrace
if: matrix.java == 17
run: ./gradlew integ -Plog-tests --stacktrace

- uses: actions/upload-artifact@v4
if: failure()
Expand Down
16 changes: 8 additions & 8 deletions smithy-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@ description = "This module implements the Smithy command line interface."
extra["displayName"] = "Smithy :: CLI"
extra["moduleName"] = "software.amazon.smithy.cli"

// If `resolveImageJre` is set, detect the current JVM version and use the same version for generating the runtime
// This is mainly used in CI to generate a valid runtime image for integration tests
val imageJreVersion = if (project.hasProperty("resolveImageJre")) {
JavaVersion.current().majorVersion
} else {
// Otherwise, just use 17
"17"
}
val imageJreVersion = "17"
val correttoRoot = "https://corretto.aws/downloads/latest/amazon-corretto-$imageJreVersion"

dependencies {
Expand Down Expand Up @@ -146,6 +139,13 @@ runtime {

// Because we're using target-platforms, it will use this property as a prefix for each target zip
imageZip = layout.buildDirectory.file("image/smithy-cli.zip")

// This is needed to ensure that jlink is available (jlink is Java 9+), we should use the JDK that
// is configured for the runtime
// NOTE: For the runtime task, you *must* have the right JDK set up in your environment (17 at the time of writing)
javaHome = javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(imageJreVersion))
}.map { it.metadata.installationPath.asFile.path }
}

tasks {
Expand Down

0 comments on commit e883797

Please sign in to comment.