Skip to content

Commit

Permalink
Merge pull request #584 from alexarchambault/graalvm-22.0.0
Browse files Browse the repository at this point in the history
Update GraalVM to 22.0.0
  • Loading branch information
alexarchambault committed Jan 27, 2022
2 parents 1ef9a26 + d835482 commit 1174672
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .github/scripts/generate-native-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ COMMAND="cli.base-image.writeNativeImageScript"
# Using 'mill -i' so that the Mill process doesn't outlive this invocation

if [[ "$OSTYPE" == "msys" ]]; then
./mill.bat -i ci.copyJvm --dest jvm
export JAVA_HOME="$(pwd -W | sed 's,/,\\,g')\\jvm"
export GRAALVM_HOME="$JAVA_HOME"
export PATH="$(pwd)/bin:$PATH"
echo "PATH=$PATH"
./mill.bat -i "$COMMAND" generate-native-image.bat
# Ideally, the generated script should create that directory itself
mkdir -p out/cli/base-image/nativeImage/dest
Expand Down
21 changes: 20 additions & 1 deletion build.sc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
import $ivy.`io.get-coursier::coursier-launcher:2.1.0-M2`
import $ivy.`io.github.alexarchambault.mill::mill-native-image-upload:0.1.14`
import $ivy.`io.github.alexarchambault.mill::mill-native-image-upload:0.1.15`
import $file.project.deps, deps.{Deps, Docker, InternalDeps, Scala, TestDeps}
import $file.project.publish, publish.{ghOrg, ghName, ScalaCliPublishModule}
import $file.project.settings, settings.{
Expand Down Expand Up @@ -1069,4 +1069,23 @@ object ci extends Module {
def setShouldPublish() = T.command {
publish.setShouldPublish()
}

def copyJvm(jvm: String = deps.graalVmJvmId, dest: String = "jvm") = T.command {
import sys.process._
val command = Seq(
settings.cs(),
"java-home",
"--jvm",
jvm,
"--update",
"--ttl",
"0"
)
val baseJavaHome = os.Path(command.!!.trim, os.pwd)
System.err.println(s"Initial Java home $baseJavaHome")
val destJavaHome = os.Path(dest, os.pwd)
os.copy(baseJavaHome, destJavaHome, createFolders = true)
System.err.println(s"New Java home $destJavaHome")
destJavaHome
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import java.io.FileNotFoundException;

import com.oracle.svm.core.CErrorNumber;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.headers.LibC;
import coursier.jvm.ErrnoException;
import coursier.jvm.GraalvmErrnoExtras;
import org.graalvm.nativeimage.c.type.CTypeConversion;
Expand All @@ -26,7 +26,7 @@ public static void chdir(String path) throws ErrnoException {
int ret = GraalvmUnistdExtras.chdir(path0.get());

if (ret != 0) {
int n = CErrorNumber.getCErrorNumber();
int n = LibC.errno();
Throwable cause = null;
if (n == GraalvmErrnoExtras.ENOENT() || n == GraalvmErrnoExtras.ENOTDIR())
cause = new FileNotFoundException(path);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package scala.build.tests

import bloop.config.Config.ModuleKindJS
import com.eed3si9n.expecty.Expecty.expect
import dependency._
import org.scalajs.linker.interface.{ESVersion, ModuleKind, ModuleSplitStyle}
Expand Down
8 changes: 2 additions & 6 deletions project/deps.sc
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,8 @@ object Deps {
val metaconfigTypesafe = ivy"com.geirsson::metaconfig-typesafe-config:0.9.15"
}

private def graalVmVersion =
if (Properties.isWin) "21.2.0"
else "21.3.0"
def graalVmJvmId =
if (Properties.isWin) s"graalvm-java16:$graalVmVersion"
else s"graalvm-java17:$graalVmVersion"
private def graalVmVersion = "22.0.0"
def graalVmJvmId = s"graalvm-java17:$graalVmVersion"

def csDockerVersion = Deps.Versions.coursier

Expand Down
2 changes: 1 addition & 1 deletion project/settings.sc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import $ivy.`com.goyeau::mill-scalafix::0.2.8`
import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.14`
import $ivy.`io.github.alexarchambault.mill::mill-native-image::0.1.15`
import $file.deps, deps.{Deps, Docker, buildCsVersion}

import com.goyeau.mill.scalafix.ScalafixModule
Expand Down

0 comments on commit 1174672

Please sign in to comment.