-
Notifications
You must be signed in to change notification settings - Fork 326
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
Native Language Server integration with PM #11880
Merged
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4ab1417
Native Language Server integration with PM
hubertp 61ce655
nit
hubertp c4d6873
Add missing reflect config
hubertp def1ea7
Ensure proper Context construction
hubertp 339493c
Add missing Akka entries in reflect-config
hubertp b6015e7
nit
hubertp cf8a3ed
Merge branch 'develop' into wip/hubert/11721-language-server-native
hubertp 96ae8c8
Partial revert
hubertp 8883d5c
Fix service registration
hubertp 60f8ffe
Merge branch 'develop' into wip/hubert/11721-language-server-native
hubertp 28650dd
Fix Base_Tests in native-image
hubertp cd0a8d8
Fix compilation issues
hubertp ebaf50c
Drop Truffle dependency
hubertp 08e1e4f
fmt
hubertp 5547b49
Merge branch 'develop' into wip/hubert/11721-language-server-native
hubertp 1588cec
Drop TruffleOptions dependency
hubertp 55f6623
Move NI config to LS resources
hubertp ea2f214
Remove automatically added module dependency
hubertp 6e8c05b
Move AOT Context-creation logic to factory
hubertp 3ce2577
PR review
hubertp e82bb61
Merge branch 'develop' into wip/hubert/11721-language-server-native
hubertp cadf616
Merge branch 'develop' into wip/hubert/11721-language-server-native
hubertp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...me-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/ExecCommand.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.enso.runtimeversionmanager.runner | ||
|
||
import org.enso.runtimeversionmanager.components.Engine | ||
|
||
/** Executable command used to trigger a Runner. Can be either a Java command or a native image executable. | ||
*/ | ||
trait ExecCommand { | ||
// Path to executable | ||
def path: String | ||
def cmdArguments(engine: Engine, jvmSettings: JVMSettings): Seq[String] | ||
def javaHome: Option[String] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
...me-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/JavaCommand.scala
This file was deleted.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
...ersion-manager/src/main/scala/org/enso/runtimeversionmanager/runner/JavaExecCommand.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.enso.runtimeversionmanager.runner | ||
|
||
import org.enso.runtimeversionmanager.components.{Engine, GraalRuntime} | ||
import org.enso.runtimeversionmanager.components.Manifest.JVMOptionsContext | ||
|
||
/** Represents a way of launching the JVM. | ||
* | ||
* @param executableName name of the `java` executable to run | ||
* @param javaHomeOverride if set, asks to override the JAVA_HOME environment | ||
* variable when launching the JVM | ||
*/ | ||
class JavaExecCommand( | ||
val executableName: String, | ||
val javaHome: Option[String] | ||
) extends ExecCommand { | ||
def path: String = executableName | ||
|
||
override def cmdArguments( | ||
engine: Engine, | ||
jvmSettings: JVMSettings | ||
): Seq[String] = { | ||
def translateJVMOption( | ||
option: (String, String), | ||
standardOption: Boolean | ||
): String = { | ||
val name = option._1 | ||
val value = option._2 | ||
if (standardOption) s"-D$name=$value" else s"--$name=$value" | ||
} | ||
|
||
val context = JVMOptionsContext(enginePackagePath = engine.path) | ||
|
||
val manifestOptions = | ||
engine.defaultJVMOptions | ||
.filter(_.isRelevant) | ||
.map(_.substitute(context)) | ||
val commandLineOptions = jvmSettings.jvmOptions.map( | ||
translateJVMOption(_, standardOption = true) | ||
) ++ jvmSettings.extraOptions.map( | ||
translateJVMOption(_, standardOption = false) | ||
) | ||
val componentPath = engine.componentDirPath.toAbsolutePath.normalize | ||
val modulePathOptions = | ||
Seq( | ||
"--module-path", | ||
componentPath.toString, | ||
"-m", | ||
"org.enso.runner/org.enso.runner.Main" | ||
) | ||
|
||
manifestOptions ++ commandLineOptions ++ modulePathOptions | ||
} | ||
} | ||
|
||
object JavaExecCommand { | ||
|
||
/** The [[JavaExecCommand]] representing the system-configured JVM. | ||
*/ | ||
def defaultSystem: JavaExecCommand = new JavaExecCommand("java", None) | ||
|
||
/** The [[JavaExecCommand]] representing a managed [[GraalRuntime]]. | ||
*/ | ||
def forRuntime(runtime: GraalRuntime): JavaExecCommand = | ||
new JavaExecCommand( | ||
executableName = runtime.javaExecutable.toAbsolutePath.normalize.toString, | ||
javaHome = Some(runtime.javaHome.toAbsolutePath.normalize.toString) | ||
) | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
...sion-manager/src/main/scala/org/enso/runtimeversionmanager/runner/NativeExecCommand.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.enso.runtimeversionmanager.runner | ||
|
||
import org.enso.cli.OS | ||
import org.enso.distribution.{DistributionManager, Environment} | ||
import org.enso.runtimeversionmanager.components.Engine | ||
|
||
import java.nio.file.Path | ||
|
||
case class NativeExecCommand(executablePath: Path) extends ExecCommand { | ||
override def path: String = executablePath.toString | ||
|
||
override def cmdArguments( | ||
engine: Engine, | ||
jvmSettings: JVMSettings | ||
): Seq[String] = | ||
Seq("-Dcom.oracle.graalvm.isaot=true") | ||
|
||
override def javaHome: Option[String] = None | ||
} | ||
|
||
object NativeExecCommand { | ||
def apply(version: String): Option[NativeExecCommand] = { | ||
val env = new Environment() {} | ||
val dm = new DistributionManager(env) | ||
val execName = OS.executableName("enso") | ||
val fullExecPath = | ||
dm.paths.engines.resolve(version).resolve("bin").resolve(execName) | ||
|
||
if (fullExecPath.toFile.exists()) Some(NativeExecCommand(fullExecPath)) | ||
else None | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
...sion-manager/src/main/scala/org/enso/runtimeversionmanager/runner/NativeJavaCommand.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Why do we need to provide this argument?
E.g. if we can access
org.graalvm.nativeimage.ImageInfo
then we can query "properly" and even distinguish between build time and runtime time.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property is completely missing during runtime, hence not allowing me to provide different Context configuration.