Avoid JavaScript and Python in Enso native launcher (#11279)

This commit is contained in:
Jaroslav Tulach 2024-10-11 06:22:28 +02:00 committed by GitHub
parent 2843dcbf4a
commit eccc3a0d1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 39 deletions

View File

@ -146,7 +146,7 @@ GatherLicenses.distributions := Seq(
"engine",
file("distribution/engine/THIRD-PARTY"),
Distribution.sbtProjects(
runtime,
`runtime-and-langs`,
`engine-runner`,
`language-server`
)
@ -2649,7 +2649,7 @@ lazy val runtime = (project in file("engine/runtime"))
version := ensoVersion,
commands += WithDebugCommand.withDebug,
inConfig(Compile)(truffleRunOptionsSettings),
libraryDependencies ++= GraalVM.langsPkgs ++ Seq(
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
"org.apache.tika" % "tika-core" % tikaVersion,
"com.lihaoyi" %% "fansi" % fansiVersion,
@ -2657,6 +2657,7 @@ lazy val runtime = (project in file("engine/runtime"))
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided",
"org.graalvm.regex" % "regex" % graalMavenPackagesVersion % "provided",
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
@ -2743,6 +2744,14 @@ lazy val runtime = (project in file("engine/runtime"))
.dependsOn(`connected-lock-manager`)
.dependsOn(testkit % Test)
lazy val `runtime-and-langs` = (project in file("engine/runtime-and-langs"))
.settings(
libraryDependencies ++= {
GraalVM.modules ++ GraalVM.langsPkgs
}
)
.dependsOn(runtime)
/** A project holding all the runtime integration tests. These tests require, among other things,
* the `org.enso.runtime` JPMS module, so it is easier to keep them in a separate project.
* For standard unit tests, use `runtime/Test`.
@ -2771,6 +2780,7 @@ lazy val `runtime-integration-tests` =
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test,
"org.yaml" % "snakeyaml" % snakeyamlVersion,
"org.slf4j" % "slf4j-api" % slf4jVersion
),
Test / fork := true,
@ -3441,7 +3451,7 @@ lazy val `engine-runner` = project
Compile / run / mainClass := Some("org.enso.runner.Main"),
commands += WithDebugCommand.withDebug,
inConfig(Compile)(truffleRunOptionsSettings),
libraryDependencies ++= Seq(
libraryDependencies ++= GraalVM.modules ++ Seq(
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion,
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % Provided,
"commons-cli" % "commons-cli" % commonsCliVersion,
@ -3675,8 +3685,7 @@ lazy val launcher = project
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
"-H:IncludeResources=.*Main.enso$"
),
includeRuntime = false,
mainClass = Some("org.enso.launcher.cli.Main")
mainClass = Some("org.enso.launcher.cli.Main")
)
.dependsOn(assembly)
.dependsOn(VerifyReflectionSetup.run)
@ -3833,6 +3842,7 @@ lazy val `bench-processor` = (project in file("lib/scala/bench-processor"))
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided",
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.graalvm.regex" % "regex" % graalMavenPackagesVersion % Test,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % Test
),
Compile / javacOptions := ((Compile / javacOptions).value ++

View File

@ -22,16 +22,6 @@ object JPMSUtils {
val slf4jVersion = "2.0.9"
val logbackClassicVersion = "1.3.7"
/** The list of modules that are included in the `component` directory in engine distribution.
* When invoking the `java` command, these modules need to be put on the module-path.
*/
val componentModules: Seq[ModuleID] =
GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"ch.qos.logback" % "logback-core" % logbackClassicVersion
)
/** Filters modules by their IDs from the given classpath.
*
* @param cp The classpath to filter

View File

@ -77,9 +77,6 @@ object NativeImage {
* time initialization is set to default
* @param initializeAtBuildtime a list of classes that should be initialized at
* build time.
* @param includeRuntime Whether `org.enso.runtime` should is included. If yes, then
* it will be passed as a module to the native-image along with other
* Graal and Truffle related modules.
* @param verbose whether to print verbose output from the native image.
*/
def buildNativeImage(
@ -92,8 +89,7 @@ object NativeImage {
initializeAtRuntime: Seq[String] = Seq.empty,
initializeAtBuildtime: Seq[String] = defaultBuildTimeInitClasses,
mainClass: Option[String] = None,
verbose: Boolean = false,
includeRuntime: Boolean = true
verbose: Boolean = false
): Def.Initialize[Task[Unit]] = Def
.task {
val log = state.value.log
@ -199,25 +195,10 @@ object NativeImage {
(LocalProject("engine-runner") / Runtime / fullClasspath).value
val ourCp = (Runtime / fullClasspath).value
val cpToSearch = (ourCp ++ runtimeCp ++ runnerCp).distinct
val componentModules: Seq[String] = JPMSUtils
.filterModulesFromClasspath(
cpToSearch,
JPMSUtils.componentModules,
log,
projName = (moduleName.value),
scalaBinaryVersion.value,
shouldContainAll = true
)
.map(_.data.getAbsolutePath)
val auxCp = additionalCp.value
val fullCp =
if (includeRuntime) {
componentModules ++ auxCp
} else {
ourCp.map(_.data.getAbsolutePath) ++ auxCp
}
val cpStr = fullCp.mkString(File.pathSeparator)
val auxCp = additionalCp.value
val fullCp = ourCp.map(_.data.getAbsolutePath) ++ auxCp
val cpStr = fullCp.mkString(File.pathSeparator)
log.debug("Class-path: " + cpStr)
val verboseOpt = if (verbose) Seq("--verbose") else Seq()

View File

@ -1,3 +1,3 @@
19F001BC871D58934CF6C85C14C7A446476DBA77F1C0D23AE14B885A65437915
52FC34657340F1EAE3735B0BA633B5094995DE44A1F97E83F380064946FBE72A
4023A94E9C4C20A053BCE1C592B04C6311759B9547E76748AD0F3DCB0A4C3ABC
0