Skip to content

Commit

Permalink
Use NI in IDE conditionally
Browse files Browse the repository at this point in the history
When `ENSO_LAUNCHER=native` NI is being triggered, otherwise the old
behaviour follows.

Added missing resource file.
  • Loading branch information
hubertp committed Feb 14, 2025
1 parent 4a6dadb commit 86bfbc6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"resources":{
"includes":[{
"pattern":"\\Qorg/apache/tika/mime/tika-mimetypes.xml\\E"
}]},
"bundles":[]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ case class NativeExecCommand(executablePath: Path) extends ExecCommand {
}

object NativeExecCommand {

private val LAUNCHER_ENV_NAME = "ENSO_LAUNCHER"

def apply(
version: String,
engine: Engine,
Expand All @@ -31,10 +34,11 @@ object NativeExecCommand {
val execName = OS.executableName("enso")
val fullExecPath =
dm.paths.engines.resolve(version).resolve("bin").resolve(execName)
val ensoLauncher = Option(System.getenv(LAUNCHER_ENV_NAME))

if (fullExecPath.toFile.exists() && isBinary(fullExecPath, logger)) {
Some(NativeExecCommand(fullExecPath))
} else {
} else if (ensoLauncher.map(_.equals("native")).getOrElse(false)) {
val component =
engine.componentDirPath.resolve("..").toAbsolutePath.normalize
val fallbackExecPath = component.resolve("bin").resolve("enso")
Expand All @@ -43,8 +47,14 @@ object NativeExecCommand {
) {
Some(NativeExecCommand(fallbackExecPath))
} else {
logger.debug(
"Failed to find native launcher at a pre-determined location: {}",
fallbackExecPath
)
None
}
} else {
None
}
}

Expand Down

0 comments on commit 86bfbc6

Please sign in to comment.