mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 08:11:30 +03:00
Adjusting to GraalVM for JDK21+ (#7855)
Changes required to build on GraalVM for JDK21+ while keeping the support for building on GraalVM for JDK17.
This commit is contained in:
parent
12c4f2981d
commit
15b1989418
53
build.sbt
53
build.sbt
@ -894,7 +894,6 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager"))
|
||||
)
|
||||
)
|
||||
.dependsOn(VerifyReflectionSetup.run)
|
||||
.dependsOn(installNativeImage)
|
||||
.dependsOn(assembly)
|
||||
.value,
|
||||
buildNativeImage := NativeImage
|
||||
@ -1293,55 +1292,6 @@ def runGu(logger: ManagedLogger, args: Seq[String]): String = {
|
||||
)
|
||||
}
|
||||
|
||||
def installedGuComponents(logger: ManagedLogger): Seq[String] = {
|
||||
val componentList = runGu(
|
||||
logger,
|
||||
Seq("list")
|
||||
)
|
||||
val components = componentList.linesIterator
|
||||
.drop(2)
|
||||
.map { line =>
|
||||
line
|
||||
.split(" ")
|
||||
.head
|
||||
}
|
||||
.toList
|
||||
logger.debug(s"Installed GU components = $components")
|
||||
if (!components.contains("graalvm")) {
|
||||
throw new RuntimeException(s"graalvm components is not in $components")
|
||||
}
|
||||
components
|
||||
}
|
||||
|
||||
lazy val installGraalJs = taskKey[Unit]("Install graaljs GraalVM component")
|
||||
ThisBuild / installGraalJs := {
|
||||
val logger = streams.value.log
|
||||
if (!installedGuComponents(logger).contains("js")) {
|
||||
logger.info("Installing js GraalVM component")
|
||||
runGu(
|
||||
logger,
|
||||
Seq("install", "js")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
lazy val installNativeImage =
|
||||
taskKey[Unit]("Install native-image GraalVM component")
|
||||
ThisBuild / installNativeImage := {
|
||||
val logger = streams.value.log
|
||||
if (!installedGuComponents(logger).contains("native-image")) {
|
||||
logger.info("Installing native-image GraalVM component")
|
||||
runGu(
|
||||
logger,
|
||||
Seq("install", "native-image")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
ThisBuild / installNativeImage := {
|
||||
(ThisBuild / installNativeImage).result.value
|
||||
}
|
||||
|
||||
lazy val runtime = (project in file("engine/runtime"))
|
||||
.configs(Benchmark)
|
||||
.settings(
|
||||
@ -1413,7 +1363,6 @@ lazy val runtime = (project in file("engine/runtime"))
|
||||
.settings(
|
||||
(Compile / compile) := (Compile / compile)
|
||||
.dependsOn(Def.task { (Compile / sourceManaged).value.mkdirs })
|
||||
.dependsOn(installGraalJs)
|
||||
.value
|
||||
)
|
||||
.settings(
|
||||
@ -1734,7 +1683,6 @@ lazy val `engine-runner` = project
|
||||
"akka.http"
|
||||
)
|
||||
)
|
||||
.dependsOn(installNativeImage)
|
||||
.dependsOn(assembly)
|
||||
.value,
|
||||
buildNativeImage := NativeImage
|
||||
@ -1778,7 +1726,6 @@ lazy val launcher = project
|
||||
"-H:IncludeResources=.*Main.enso$"
|
||||
)
|
||||
)
|
||||
.dependsOn(installNativeImage)
|
||||
.dependsOn(assembly)
|
||||
.dependsOn(VerifyReflectionSetup.run)
|
||||
.value,
|
||||
|
@ -198,7 +198,7 @@ impl RunContext {
|
||||
graalvm.install_if_missing(&self.cache).await?;
|
||||
graal::Gu.require_present().await?;
|
||||
|
||||
let required_components = [graal::ComponentId::NativeImage];
|
||||
let required_components = [graal::ComponentId::NativeImage, graal::ComponentId::JS];
|
||||
// Some GraalVM components depend on Sulong and are not available on all platforms (like
|
||||
// Windows or M1 macOS). Thus, we treat them as optional. See e.g.
|
||||
// https://github.com/oracle/graalpython/issues/156
|
||||
|
@ -83,6 +83,11 @@ object CopyTruffleJAR {
|
||||
libraryUpdates: UpdateReport,
|
||||
log: ManagedLogger
|
||||
): Boolean = {
|
||||
val version = System.getProperty("java.version").split("\\.");
|
||||
if (Integer.parseInt(version(0)) >= 21) {
|
||||
// skip all checks on GraalVM for JDK21 and newer
|
||||
return false;
|
||||
}
|
||||
var truffleInstancesFound = 0
|
||||
var restartRequired = false
|
||||
libraryUpdates.allFiles.foreach { f =>
|
||||
|
@ -73,7 +73,6 @@ object GraalVersionCheck {
|
||||
val logger = newState.log
|
||||
if (!graalVersionOk(graalVersion, logger)) {
|
||||
logger.error("GraalVM version check failed.")
|
||||
System.exit(1)
|
||||
}
|
||||
newState
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user