Skip to content

Commit

Permalink
Update GraalVM to 22.2.0 (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault authored Jul 29, 2022
1 parent c14a2fe commit 9d62cc5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .github/scripts/generate-native-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ set -e

COMMAND="cli.base-image.writeNativeImageScript"

# temporary, until we pass JPMS options to native-image,
# see https://www.graalvm.org/release-notes/22_2/#native-image
export USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false

# Using 'mill -i' so that the Mill process doesn't outlive this invocation

if [[ "$OSTYPE" == "msys" ]]; then
Expand Down
4 changes: 4 additions & 0 deletions mill
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,8 @@ eval "$(cs java --env --jvm temurin:17 || cs java --env --jvm openjdk:1.17.0)"
init_mill_jvm_opts
init_mill_cs_opts

# temporary, until we pass JPMS options to native-image,
# see https://www.graalvm.org/release-notes/22_2/#native-image
export USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false

exec "$cs" launch "$MILL_APP_NAME:$MILL_VERSION" "${mill_cs_opts[@]}" -- "$@"
4 changes: 2 additions & 2 deletions project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ object Deps {
if (force213) ivy"io.github.alexarchambault.scala-cli.snailgun:snailgun-core_2.13:0.4.1-sc2"
else ivy"io.github.alexarchambault.scala-cli.snailgun::snailgun-core:0.4.1-sc2"
def sttp = ivy"com.softwaremill.sttp.client3:core_2.13:3.7.1"
def svm = ivy"org.graalvm.nativeimage:svm:22.0.0.2"
def svm = ivy"org.graalvm.nativeimage:svm:$graalVmVersion"
def swoval = ivy"com.swoval:file-tree-views:2.1.9"
def testInterface = ivy"org.scala-sbt:test-interface:1.0"
def usingDirectives = ivy"org.virtuslab:using_directives:0.0.8"
Expand All @@ -151,7 +151,7 @@ object BuildDeps {
def scalaCliVersion = "0.1.9"
}

def graalVmVersion = "22.1.0"
def graalVmVersion = "22.2.0"
def graalVmJavaVersion = 17
def graalVmJvmId = s"graalvm-java$graalVmJavaVersion:$graalVmVersion"

Expand Down
28 changes: 18 additions & 10 deletions project/settings.sc
Original file line number Diff line number Diff line change
Expand Up @@ -285,28 +285,36 @@ trait CliLaunchers extends SbtModule { self =>
def launcherKind = "default"
}

private def maybePassNativeImageJpmsOption =
Option(System.getenv("USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM"))
.fold("") { value =>
"export USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=" + value + System.lineSeparator()
}

object `linux-docker-image` extends CliNativeImage {
def launcherKind = `base-image`.launcherKind
def nativeImageDockerParams = Some(
NativeImage.DockerParams(
imageName = "ubuntu:18.04",
prepareCommand =
"""apt-get update -q -y &&\
|apt-get install -q -y build-essential libz-dev locales
|locale-gen en_US.UTF-8
|export LANG=en_US.UTF-8
|export LANGUAGE=en_US:en
|export LC_ALL=en_US.UTF-8""",
maybePassNativeImageJpmsOption +
"""apt-get update -q -y &&\
|apt-get install -q -y build-essential libz-dev locales
|locale-gen en_US.UTF-8
|export LANG=en_US.UTF-8
|export LANGUAGE=en_US:en
|export LC_ALL=en_US.UTF-8""".stripMargin,
csUrl =
s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz",
extraNativeImageArgs = Nil
)
)
}

private def setupLocale(params: NativeImage.DockerParams): NativeImage.DockerParams =
private def setupLocaleAndOptions(params: NativeImage.DockerParams): NativeImage.DockerParams =
params.copy(
prepareCommand = params.prepareCommand +
prepareCommand = maybePassNativeImageJpmsOption +
params.prepareCommand +
"""
|set -v
|apt-get update
Expand All @@ -329,7 +337,7 @@ trait CliLaunchers extends SbtModule { self =>
Docker.muslBuilder,
s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz"
)
val dockerParams = setupLocale(baseDockerParams)
val dockerParams = setupLocaleAndOptions(baseDockerParams)
buildHelperImage()
Some(dockerParams)
}
Expand All @@ -351,7 +359,7 @@ trait CliLaunchers extends SbtModule { self =>
"ubuntu:18.04", // TODO Pin that
s"https://github.com/coursier/coursier/releases/download/v${deps.csDockerVersion}/cs-x86_64-pc-linux.gz"
)
val dockerParams = setupLocale(baseDockerParams)
val dockerParams = setupLocaleAndOptions(baseDockerParams)
Some(dockerParams)
}
}
Expand Down

0 comments on commit 9d62cc5

Please sign in to comment.