-
Notifications
You must be signed in to change notification settings - Fork 324
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
Better detection for Enso's NI when launching Language Server #12034
base: develop
Are you sure you want to change the base?
Conversation
Previosly we were wrongly relying on the presence of the file. That way, a bash script meant that NI integration was wrongly used. This change uses Tika, but it has already been present in other subprojects so no additional dependency shall be added. Follow up on #11880.
It was probably not too bad to invoke |
} else None | ||
} | ||
|
||
private def isBinary(path: Path): Boolean = { |
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.
Alternative check would be:
return !Files.readLines("bin/enso").get(0).startsWith("#!/bin/sh");
that is a common prefix of most of the shell scripts. However we'd have to add such header to our shell script:
enso$ git diff
diff --git distribution/bin/enso distribution/bin/enso
index 1939fc99dc..93a45f4a6e 100755
--- distribution/bin/enso
+++ distribution/bin/enso
@@ -1,3 +1,5 @@
+#!/bin/sh
+
COMP_PATH=$(dirname "$0")/../component
JAVA_OPTS="--add-opens=java.base/java.nio=ALL-UNNAMED $JAVA_OPTS"
but as you say, Tika was already available as it is used somewhere.
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.
That wouldn't work on Windows
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.
But on windows the difference is in extension:
enso.bat
- is the shell scriptenso.exe
- is the native binary
We only need the content file check for Unixes.
"org.scalatest" %% "scalatest" % scalatestVersion % Test | ||
), | ||
Compile / moduleDependencies ++= Seq( | ||
"org.apache.commons" % "commons-compress" % commonsCompressVersion, | ||
"org.apache.tika" % "tika-core" % tikaVersion, |
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.
tika is added as a moduleDependency, but module-info.java
for runtime-version-manager is not changed? How is it possible that this works? There should be something like requires org.apache.tika
added to the module descriptor.
It compiles because you are using tika in Scala source, but my gut feeling is that it might crash in runtime at some point on NoClassDefFound
.
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.
Are you sure that the new functionality in NativeExecCommand
is tested?
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.
Ensure that NativeExecCommand
is tested. I strongly doubt this will not crash with NoClassDefFoundError
when no module descriptor was changed.
Pull Request Description
Previosly we were wrongly relying on the presence of the file. That way,
a bash script meant that NI integration was wrongly used.
This change uses Tika, but it has already been present in other
subprojects so no additional dependency shall be added.
Follow up on #11880.
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.