-
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
Package libraries Java code as Java Modules #10714
base: develop
Are you sure you want to change the base?
Conversation
ba4db96
to
873c418
Compare
engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java
Outdated
Show resolved
Hide resolved
Question for @radeusgd - we seem to get the encapsulation with all the consequences. There is dozen of failures:
I can think of ways to fix the tests, but some failures show intended cross-library usage we don't have any alternative yet. |
I imagine we can come up with some workarounds, although that may not be trivial. I'm worried the most about the read autodetection - does it look like the classpath separation breaks the SPI? How can we fix that? Alternatively, as suggested in #7082 (title Re-exporting), could we provide a way for a library to opt-in to being able to access modules of another lib? e.g. |
My plan was: enso$ git diff distribution/ test/Base_Tests/src/Data/Text/Utils_Spec.enso
diff --git distribution/lib/Standard/Base/0.0.0-dev/src/Internal/Extra_Imports.enso distribution/lib/Standard/Base/0.0.0-dev/src/Internal/Extra_Imports.enso
index 7771401cf4..c42ee36ec6 100644
--- distribution/lib/Standard/Base/0.0.0-dev/src/Internal/Extra_Imports.enso
+++ distribution/lib/Standard/Base/0.0.0-dev/src/Internal/Extra_Imports.enso
@@ -9,7 +9,7 @@ private
polyglot java import java.io.PrintStream
# needed by Util_Spec
-polyglot java import org.enso.base.text.CaseFoldedString
+polyglot java import org.enso.base.text.CaseFoldedString as JCaseFoldedString
polyglot java import org.enso.base.text.CaseFoldedString.Grapheme
# needed by Comparator_Spec:
@@ -29,3 +29,5 @@ polyglot java import java.util.function.Function
polyglot java import java.lang.Thread
polyglot java import java.lang.Thread.State
polyglot java import java.lang.Float
+
+CaseFoldedString = JCaseFoldedString
diff --git test/Base_Tests/src/Data/Text/Utils_Spec.enso test/Base_Tests/src/Data/Text/Utils_Spec.enso
index d0b987bea2..7d8d006ff7 100644
--- test/Base_Tests/src/Data/Text/Utils_Spec.enso
+++ test/Base_Tests/src/Data/Text/Utils_Spec.enso
@@ -1,7 +1,7 @@
from Standard.Base import all
polyglot java import org.enso.base.Text_Utils
-polyglot java import org.enso.base.text.CaseFoldedString
+import Standard.Base.Internal.Extra_Imports.CaseFoldedString
polyglot java import com.ibm.icu.text.BreakIterator
from Standard.Test import all but that requires us to run with
I guess we cannot have both: Run with |
Fixes ServiceConfigurationError.
And DataLinkSPI is implemented with Lookup instead of ServiceLoader.
Heuréka. JVM tests are green. |
…et.http.UrlencodedBodyBuilder UnresolvedSymbol<new>)
@@ -3633,7 +3633,7 @@ lazy val `engine-runner` = project | |||
val NI_MODULES = | |||
"org.graalvm.nativeimage,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.base,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.objectfile,org.graalvm.nativeimage.pointsto,com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise" | |||
val JDK_MODULES = | |||
"jdk.localedata,jdk.httpserver,java.naming,java.net.http" | |||
"jdk.localedata,jdk.httpserver,java.naming,java.net.http,java.desktop,java.xml.crypto,jdk.xml.dom,java.sql.rowset" |
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.
This will very likely break Espresso support. We had to remove java.desktop
because of Espresso in #9866
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.
java.desktop
is required by org.apache.poi.poi
. The NI failed on Base_Tests
because of that.
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.
java.desktop
is required byorg.apache.poi.poi
. The NI failed onBase_Tests
because of that.
That's scary. Probably another dependency on java.beans
- we should change upstream to make this dependency optional.
Pull Request Description
Implements #7082 by creating a module layer per library. Removes the obsolete add_to_class_path concept as there is no longer a single
ClassPath
to load from. Each library withpolyglot/java
JARs gets its own. Need a way to express dependencies between Java APIs among multiple libraries - createdrequires:
flag inpackage.yaml
.Important Notes
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.