diff --git a/distribution/bin/enso b/distribution/bin/enso index 439c7922b5..dc19615cc0 100755 --- a/distribution/bin/enso +++ b/distribution/bin/enso @@ -7,6 +7,6 @@ for opt in "$@"; do fi 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 "$@" exit diff --git a/distribution/bin/enso.bat b/distribution/bin/enso.bat index 8480c9cd4f..5387dd0073 100644 --- a/distribution/bin/enso.bat +++ b/distribution/bin/enso.bat @@ -6,5 +6,6 @@ if /I %%A==--dump-graphs ( 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 %* exit /B %errorlevel% diff --git a/distribution/lib/Standard/Snowflake/0.0.0-dev/src/Snowflake_Details.enso b/distribution/lib/Standard/Snowflake/0.0.0-dev/src/Snowflake_Details.enso index b84fddf18f..560fc05f25 100644 --- a/distribution/lib/Standard/Snowflake/0.0.0-dev/src/Snowflake_Details.enso +++ b/distribution/lib/Standard/Snowflake/0.0.0-dev/src/Snowflake_Details.enso @@ -45,8 +45,10 @@ type Snowflake_Details Provides the properties for the connection. jdbc_properties : Vector (Pair Text Text) jdbc_properties self = - ## Avoid the Arrow dependency (https://community.snowflake.com/s/article/SAP-BW-Java-lang-NoClassDefFoundError-for-Apache-arrow) - no_arrow = [Pair.new 'jdbc_query_result_format' 'json'] + ## If Arrow dependency is to be avoided (https://community.snowflake.com/s/article/SAP-BW-Java-lang-NoClassDefFoundError-for-Apache-arrow) + ## [Pair.new 'jdbc_query_result_format' 'json'] + ## should be prepended to properties. That would make it fallback to plain `json`. + account = [Pair.new 'account' self.account] credentials = [Pair.new 'user' self.credentials.username, Pair.new 'password' self.credentials.password] database = [Pair.new 'db' self.database] @@ -55,4 +57,4 @@ type Snowflake_Details ## Control the format of TIMESTAMP and TIME fields formats = [Pair.new "TIME_OUTPUT_FORMAT" "HH24:MI:SS.FF9", Pair.new "TIMESTAMP_OUTPUT_FORMAT" "YYYY-MM-DD HH24:MI:SS.FF9 TZHTZM", Pair.new "TIMESTAMP_NTZ_OUTPUT_FORMAT" "YYYY-MM-DD HH24:MI:SS.FF9", Pair.new "TIMESTAMP_LTZ_OUTPUT_FORMAT" "YYYY-MM-DD HH24:MI:SS.FF9"] - no_arrow + account + credentials + database + schema + warehouse + formats + account + credentials + database + schema + warehouse + formats diff --git a/engine/launcher/src/main/scala/org/enso/launcher/Launcher.scala b/engine/launcher/src/main/scala/org/enso/launcher/Launcher.scala index 8a525ee374..d791759639 100644 --- a/engine/launcher/src/main/scala/org/enso/launcher/Launcher.scala +++ b/engine/launcher/src/main/scala/org/enso/launcher/Launcher.scala @@ -96,7 +96,7 @@ case class Launcher(cliOptions: GlobalCLIOptions) { additionalArguments = additionalArguments ) .get, - JVMSettings(useSystemJVM, jvmOpts) + JVMSettings(useSystemJVM, jvmOpts, extraOptions = Seq.empty) ) { command => command.run().get } @@ -223,7 +223,7 @@ case class Launcher(cliOptions: GlobalCLIOptions) { additionalArguments ) .get, - JVMSettings(useSystemJVM, jvmOpts) + JVMSettings(useSystemJVM, jvmOpts, extraOptions = Seq()) ) { command => command.run().get } @@ -267,7 +267,7 @@ case class Launcher(cliOptions: GlobalCLIOptions) { additionalArguments ) .get, - JVMSettings(useSystemJVM, jvmOpts) + JVMSettings(useSystemJVM, jvmOpts, extraOptions = Seq()) ) { command => command.run().get } @@ -310,7 +310,7 @@ case class Launcher(cliOptions: GlobalCLIOptions) { additionalArguments ) .get, - JVMSettings(useSystemJVM, jvmOpts) + JVMSettings(useSystemJVM, jvmOpts, Seq()) ) { command => command.run().get } @@ -346,7 +346,7 @@ case class Launcher(cliOptions: GlobalCLIOptions) { additionalArguments = additionalArguments ) .get, - JVMSettings(useSystemJVM, jvmOpts) + JVMSettings(useSystemJVM, jvmOpts, extraOptions = Seq()) ) { command => command.run().get } @@ -413,8 +413,11 @@ case class Launcher(cliOptions: GlobalCLIOptions) { ) .get - runner.withCommand(settings, JVMSettings(useSystemJVM, jvmOpts)) { - command => command.run().get + runner.withCommand( + settings, + JVMSettings(useSystemJVM, jvmOpts, extraOptions = Seq()) + ) { command => + command.run().get } } @@ -530,7 +533,11 @@ case class Launcher(cliOptions: GlobalCLIOptions) { val runtimeVersionString = if (isEngineInstalled) { val output = runner.withCommand( runtimeVersionRunSettings, - JVMSettings(useSystemJVM = false, jvmOptions = Seq.empty) + JVMSettings( + useSystemJVM = false, + jvmOptions = Seq(), + extraOptions = Seq() + ) ) { runtimeVersionCommand => runtimeVersionCommand.captureOutput().get } diff --git a/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala b/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala index d99d55a2b6..eeeff4b1d2 100644 --- a/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala +++ b/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala @@ -92,7 +92,11 @@ class LauncherRunnerSpec extends RuntimeVersionManagerTest with FlakySpec { runner.withCommand( runSettings, - JVMSettings(useSystemJVM = true, jvmOptions = jvmOptions) + JVMSettings( + useSystemJVM = true, + jvmOptions = jvmOptions, + extraOptions = Seq() + ) ) { systemCommand => systemCommand.command.head shouldEqual "java" checkCommandLine(systemCommand) @@ -100,7 +104,11 @@ class LauncherRunnerSpec extends RuntimeVersionManagerTest with FlakySpec { runner.withCommand( runSettings, - JVMSettings(useSystemJVM = false, jvmOptions = jvmOptions) + JVMSettings( + useSystemJVM = false, + jvmOptions = jvmOptions, + extraOptions = Seq() + ) ) { managedCommand => managedCommand.command.head should include("java") val javaHome = diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/TestDistributionConfiguration.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/TestDistributionConfiguration.scala index d47fcc7bf9..5e84b2f0ec 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/TestDistributionConfiguration.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/TestDistributionConfiguration.scala @@ -100,7 +100,8 @@ class TestDistributionConfiguration( val javaCommand = JavaCommand(currentProcess, None) new JVMSettings( javaCommandOverride = Some(javaCommand), - jvmOptions = Seq() + jvmOptions = Seq(), + extraOptions = Seq() ) } diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala index eba353ca84..e254e8ac02 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala @@ -17,7 +17,8 @@ class ProjectCreateHandleMissingRuntimeSpec ) { override def defaultJVMSettings: JVMSettings = JVMSettings( javaCommandOverride = None, - jvmOptions = Seq() + jvmOptions = Seq(), + extraOptions = Seq() ) } diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/JVMSettings.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/JVMSettings.scala index a5f2ff99ad..39a03ad6b0 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/JVMSettings.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/JVMSettings.scala @@ -6,11 +6,13 @@ package org.enso.runtimeversionmanager.runner * instead of the default JVM provided with the * release; it can be an absolute path to a java * executable - * @param jvmOptions options that should be added to the launched JVM + * @param jvmOptions options that should be added to the launched JVM, will be prefixed with `-D` + * @param extraOptions extra options that should be added to the launched JVM */ case class JVMSettings( javaCommandOverride: Option[JavaCommand], - jvmOptions: Seq[(String, String)] + jvmOptions: Seq[(String, String)], + extraOptions: Seq[(String, String)] ) object JVMSettings { @@ -19,20 +21,31 @@ object JVMSettings { * * @param useSystemJVM if set, the system configured JVM is used instead of * the one managed by the launcher - * @param jvmOptions options that should be added to the launched JVM + * @param jvmOptions options that should be added to the launched JVM, will be prefixed with `-D` + * @param extraOptions extra options that should be added to the launched JVM */ def apply( useSystemJVM: Boolean, - jvmOptions: Seq[(String, String)] + jvmOptions: Seq[(String, String)], + extraOptions: Seq[(String, String)] ): JVMSettings = new JVMSettings( if (useSystemJVM) Some(JavaCommand.systemJavaCommand) else None, - jvmOptions + jvmOptions, + extraOptions ) + // See propositions in #9475 for alternatives + private val nioOpen: (String, String) = + ("add-opens", "java.base/java.nio=ALL-UNNAMED") + /** Creates a default instance of [[JVMSettings]] that just use the default * JVM with no options overrides. */ def default: JVMSettings = - JVMSettings(useSystemJVM = false, jvmOptions = Seq()) + JVMSettings( + useSystemJVM = false, + jvmOptions = Seq(), + extraOptions = Seq(nioOpen) + ) } diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala index 008167dcfa..86253ece23 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala @@ -168,10 +168,13 @@ class Runner( ) } - def translateJVMOption(option: (String, String)): String = { + def translateJVMOption( + option: (String, String), + standardOption: Boolean + ): String = { val name = option._1 val value = option._2 - s"-D$name=$value" + if (standardOption) s"-D$name=$value" else s"--$name=$value" } val context = JVMOptionsContext(enginePackagePath = engine.path) @@ -180,7 +183,12 @@ class Runner( engine.defaultJVMOptions.filter(_.isRelevant).map(_.substitute(context)) val environmentOptions = jvmOptsFromEnvironment.map(_.split(' ').toIndexedSeq).getOrElse(Seq()) - val commandLineOptions = jvmSettings.jvmOptions.map(translateJVMOption) + val commandLineOptions = jvmSettings.jvmOptions.map( + translateJVMOption(_, standardOption = true) + ) ++ + jvmSettings.extraOptions.map( + translateJVMOption(_, standardOption = false) + ) val shouldInvokeViaModulePath = engine.graalRuntimeVersion.isUnchained var jvmArguments =