Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for --jvm option in Enso runner #10374

Merged
merged 29 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
43929db
Support for --jvm option in Enso launcher
JaroslavTulach Jun 26, 2024
7d31eab
Iterate installed GraalVM runtimes
JaroslavTulach Jun 26, 2024
67f1632
feat: engineDistributionRoot parameter
4e6 Jun 26, 2024
e67cc87
Generate NI executable as ./built-distribution/enso-engine-0.0.0-dev-…
JaroslavTulach Jun 26, 2024
8f18b2f
Ignore --jvm when already in the right JVM
JaroslavTulach Jun 28, 2024
54bb7d8
Recognize JAVA_OPTS environment variable and pass it to the JVM
JaroslavTulach Jun 28, 2024
ec51515
Let EditionManager work with any EditionProvider, not just updating one
JaroslavTulach Jun 28, 2024
f1ad21b
Don't use UpdatingEditionManager in regular execution
JaroslavTulach Jun 28, 2024
cfedcb6
Derive languageHome from code location
JaroslavTulach Jun 29, 2024
2f3e832
Search for the parser in component subdirectory
JaroslavTulach Jun 29, 2024
406291e
Setup logging before processing --jvm option
JaroslavTulach Jun 29, 2024
cc48ec3
Providing missing argument to makeEditionProvider
JaroslavTulach Jun 29, 2024
9c81fe5
Adding update flag to FakeEditionProvider
JaroslavTulach Jun 29, 2024
eafa192
Change log entry
JaroslavTulach Jun 29, 2024
5ea0814
Benchmarks need to be executed in --jvm mode
JaroslavTulach Jun 29, 2024
8c393bf
Merge remote-tracking branch 'origin/develop' into wip/jtulach/JvmOpt…
JaroslavTulach Jul 1, 2024
fa7a62d
Merge remote-tracking branch 'origin/develop' into wip/jtulach/JvmOpt…
JaroslavTulach Jul 3, 2024
13cb3d4
native-image needs location without .exe on Windows
JaroslavTulach Jul 3, 2024
3fb6a1b
There is no runner anymore
JaroslavTulach Jul 4, 2024
8e4834e
Use .exe in native runner tests
JaroslavTulach Jul 5, 2024
59f3087
run_benchmarks without bash script wrapper
JaroslavTulach Jul 5, 2024
83f31be
Supressing question mark operator is useless here warning
JaroslavTulach Jul 5, 2024
1ec943a
Updating documentation to new location of runner
JaroslavTulach Jul 6, 2024
13c9518
Just return benchmarks
JaroslavTulach Jul 6, 2024
ffb2fb8
No need to disable linter
JaroslavTulach Jul 6, 2024
60595ba
Use with_executable_extension
JaroslavTulach Jul 6, 2024
49700cd
Use with_executable_extension II
JaroslavTulach Jul 6, 2024
2bd08b1
cargo fmt
JaroslavTulach Jul 6, 2024
bbbbf25
Using longer local variable name
JaroslavTulach Jul 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
[10352]: https://github.com/enso-org/enso/pull/10352
[10353]: https://github.com/enso-org/enso/pull/10353

#### Enso Language & Runtime

- Support for [explicit --jvm option][10374] when launching `enso` CLI

[10374]: https://github.com/enso-org/enso/pull/10374

#### Enso Standard Library

- [Added Statistic.Product][10122]
Expand Down
103 changes: 56 additions & 47 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2614,55 +2614,60 @@ lazy val `engine-runner` = project
assembly := assembly
.dependsOn(`runtime-fat-jar` / assembly)
.value,
rebuildNativeImage :=
NativeImage
.buildNativeImage(
"runner",
staticOnLinux = false,
additionalOptions = Seq(
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
"-H:IncludeResources=.*Main.enso$",
"-H:+AddAllCharsets",
"-H:+IncludeAllLocales",
"-ea",
// useful perf & debug switches:
// "-g",
// "-H:+SourceLevelDebug",
// "-H:-DeleteLocalSymbols",
// you may need to set smallJdk := None to use following flags:
// "--trace-class-initialization=org.enso.syntax2.Parser",
"-Dnic=nic"
),
mainClass = Some("org.enso.runner.Main"),
initializeAtRuntime = Seq(
"org.jline.nativ.JLineLibrary",
"org.jline.terminal.impl.jna",
"io.methvin.watchservice.jna.CarbonAPI",
"zio.internal.ZScheduler$$anon$4",
"org.enso.runner.Main$",
"sun.awt",
"sun.java2d",
"sun.font",
"java.awt",
"com.sun.imageio",
"com.sun.jna.internal.Cleaner",
"com.sun.jna.Structure$FFIType",
"akka.http"
rebuildNativeImage := Def
.taskDyn {
NativeImage
.buildNativeImage(
"enso",
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
targetDir = engineDistributionRoot.value / "bin",
staticOnLinux = false,
additionalOptions = Seq(
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
"-H:IncludeResources=.*Main.enso$",
"-H:+AddAllCharsets",
"-H:+IncludeAllLocales",
"-ea",
// useful perf & debug switches:
// "-g",
// "-H:+SourceLevelDebug",
// "-H:-DeleteLocalSymbols",
// you may need to set smallJdk := None to use following flags:
// "--trace-class-initialization=org.enso.syntax2.Parser",
"-Dnic=nic"
),
mainClass = Some("org.enso.runner.Main"),
initializeAtRuntime = Seq(
"org.jline.nativ.JLineLibrary",
"org.jline.terminal.impl.jna",
"io.methvin.watchservice.jna.CarbonAPI",
"zio.internal.ZScheduler$$anon$4",
"org.enso.runner.Main$",
"sun.awt",
"sun.java2d",
"sun.font",
"java.awt",
"com.sun.imageio",
"com.sun.jna.internal.Cleaner",
"com.sun.jna.Structure$FFIType",
"akka.http"
)
)
)
.dependsOn(NativeImage.additionalCp)
.dependsOn(NativeImage.smallJdk)
.dependsOn(assembly)
.dependsOn(
buildEngineDistribution
)
.value,
buildNativeImage := NativeImage
.incrementalNativeImageBuild(
rebuildNativeImage,
"runner"
}
.dependsOn(NativeImage.additionalCp)
.dependsOn(NativeImage.smallJdk)
.dependsOn(assembly)
.dependsOn(
buildEngineDistribution
)
.value
.value,
buildNativeImage := Def.taskDyn {
NativeImage
.incrementalNativeImageBuild(
rebuildNativeImage,
"enso",
targetDir = engineDistributionRoot.value / "bin"
)
}.value
)
.dependsOn(`version-output`)
.dependsOn(yaml)
Expand Down Expand Up @@ -3559,6 +3564,10 @@ ThisBuild / buildEngineDistribution := {
buildEngineDistribution.result.value
}

ThisBuild / engineDistributionRoot := {
engineDistributionRoot.value
}

lazy val buildEngineDistributionNoIndex =
taskKey[Unit]("Builds the engine distribution without generating indexes")
buildEngineDistributionNoIndex := {
Expand Down
1 change: 0 additions & 1 deletion build/build/paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
bench-report.xml:
build.sbt:
run:
runner: # The runner native image (Linux only).
CHANGELOG.md:

# Launcher Package
Expand Down
15 changes: 13 additions & 2 deletions build/build/src/engine/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,15 @@ impl RunContext {
if self.config.build_native_runner {
debug!("Building and testing native engine runners");
runner_sanity_test(&self.repo_root, None).await?;
ide_ci::fs::remove_file_if_exists(&self.repo_root.runner)?;
let filename = format!("enso{}", if TARGET_OS == OS::Windows { ".exe" } else { "" });
let enso = self
.repo_root
.built_distribution
.enso_engine_triple
.engine_package
.bin
.join(filename);
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
ide_ci::fs::remove_file_if_exists(&enso)?;
if self.config.build_espresso_runner {
let enso_java = "espresso";
sbt.command()?
Expand Down Expand Up @@ -636,7 +644,10 @@ pub async fn runner_sanity_test(
// The engine package is necessary for running the native runner.
ide_ci::fs::tokio::require_exist(engine_package).await?;
if enso_java.is_none() {
let test_base = Command::new(&repo_root.runner)
let filename = format!("enso{}", if TARGET_OS == OS::Windows { ".exe" } else { "" });
let enso =
repo_root.built_distribution.enso_engine_triple.engine_package.bin.join(filename);
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
let test_base = Command::new(&enso)
.args(["--run", repo_root.test.join("Base_Tests").as_str()])
.set_env_opt(ENSO_JAVA, enso_java)?
.set_env(ENSO_DATA_DIRECTORY, engine_package)?
Expand Down
17 changes: 14 additions & 3 deletions build/build/src/enso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,23 @@ impl BuiltEnso {
self.paths.repo_root.built_distribution.enso_engine_triple.engine_package.bin.join(filename)
}

#[allow(clippy::needless_question_mark)]
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
pub async fn run_benchmarks(&self, opt: BenchmarkOptions) -> Result {
self.cmd()?
.with_args(["--run", self.paths.repo_root.test.benchmarks.as_str()])
let filename = format!("enso{}", if TARGET_OS == OS::Windows { ".exe" } else { "" });
let enso = self
.paths
.repo_root
.built_distribution
.enso_engine_triple
.engine_package
.bin
.join(filename);
let benchmarks = Command::new(&enso)
.args(["--jvm", "--run", self.paths.repo_root.test.benchmarks.as_str()])
.set_env(ENSO_BENCHMARK_TEST_DRY_RUN, &Boolean::from(opt.dry_run))?
.run_ok()
.await
.await;
Ok(benchmarks?)
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
}

pub fn run_test(&self, test_path: impl AsRef<Path>, ir_caches: IrCaches) -> Result<Command> {
Expand Down
2 changes: 1 addition & 1 deletion distribution/bin/enso
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ for opt in "$@"; do
done

JAVA_OPTS="--add-opens=java.base/java.nio=ALL-UNNAMED $JAVA_OPTS"
exec java --module-path $COMP_PATH -Dorg.graalvm.language.enso.home=$COMP_PATH $EXTRA_OPTS $JAVA_OPTS -m org.enso.runtime/org.enso.EngineRunnerBootLoader "$@"
exec java --module-path $COMP_PATH $EXTRA_OPTS $JAVA_OPTS -m org.enso.runtime/org.enso.EngineRunnerBootLoader "$@"
exit
2 changes: 1 addition & 1 deletion distribution/bin/enso.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ set EXTRA_OPTS=%EXTRA_OPTS% -Dgraal.Dump=Truffle:1
)
)
set JAVA_OPTS=%JAVA_OPTS% --add-opens=java.base/java.nio=ALL-UNNAMED
java --module-path %comp-dir% -Dorg.graalvm.language.enso.home=%comp-dir% -Dpolyglot.compiler.IterativePartialEscape=true %EXTRA_OPTS% %JAVA_OPTS% -m org.enso.runtime/org.enso.EngineRunnerBootLoader %*
java --module-path %comp-dir% -Dpolyglot.compiler.IterativePartialEscape=true %EXTRA_OPTS% %JAVA_OPTS% -m org.enso.runtime/org.enso.EngineRunnerBootLoader %*
exit /B %errorlevel%
Loading
Loading