Skip to content

Commit

Permalink
Fix bundled engine after GraalVM upgrade (#9735)
Browse files Browse the repository at this point in the history
The change fixes the problem with suggestions loading by
1. Making sure that bundle is always the first on the search path for editions and engine
2. Passing language home to language server

Verified by building/running AppImage locally (previously would fail).

Closes #9728. Regressed in #9647.
  • Loading branch information
hubertp committed Apr 18, 2024
1 parent c8dcd48 commit a444934
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ case class DistributionPaths(
/** Sequence of paths to search for engine installations, in order of
* precedence.
*/
def engineSearchPaths: Seq[Path] = Seq(engines) ++ bundle.map(_.engines).toSeq
def engineSearchPaths: Seq[Path] = bundle.map(_.engines).toSeq ++ Seq(engines)

/** Sequence of paths to search for runtime installations, in order of
* precedence.
*/
def runtimeSearchPaths: Seq[Path] =
Seq(runtimes) ++ bundle.map(_.runtimes).toSeq
bundle.map(_.runtimes).toSeq ++ Seq(runtimes)

/** The directory for cached editions managed by us. */
def cachedEditions: Path = dataRoot / DistributionManager.EDITIONS_DIRECTORY
Expand All @@ -93,8 +93,8 @@ case class DistributionPaths(
* precedence.
*/
def editionSearchPaths: Seq[Path] =
customEditions ++ Seq(cachedEditions) ++
bundledWithEngines(DistributionManager.EDITIONS_DIRECTORY)
bundledWithEngines(DistributionManager.EDITIONS_DIRECTORY) ++
customEditions ++ Seq(cachedEditions)

/** Returns a sequence of paths to some subdirectory in all installed engines.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,16 @@ class Runner(
)
val shouldInvokeViaModulePath = engine.graalRuntimeVersion.isUnchained

val componentPath = engine.componentDirPath.toAbsolutePath.normalize
val langHomeOption = Seq(
s"-Dorg.graalvm.language.enso.home=$componentPath"
)
var jvmArguments =
manifestOptions ++ environmentOptions ++ commandLineOptions
manifestOptions ++ environmentOptions ++ commandLineOptions ++ langHomeOption
if (shouldInvokeViaModulePath) {
jvmArguments = jvmArguments :++ Seq(
"--module-path",
engine.componentDirPath.toAbsolutePath.normalize.toString,
componentPath.toString,
"-m",
"org.enso.runtime/org.enso.EngineRunnerBootLoader"
)
Expand Down

0 comments on commit a444934

Please sign in to comment.