-
Notifications
You must be signed in to change notification settings - Fork 21
Reduce dependencies from Full JRE to compact1 profile #10559
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
Comments
highly relevant here: scala/scala#5677 (with more such work planned before 2.13 ships, and participation highly welcome). so for example scala.sys will move to a module, which will fix the compact3 requirement you found. I'm curious about the java.rmi dependency. what's that doing, have you looked yet...? |
No, I have not looked into rmi dependency, but I did look into java.beans dependency. And it turned out it is very strong dependency based on inheritance from java.beans.SimpleBeanInfo. |
The |
I'll submit a PR that removes all dependencies on |
Yay! Library and reflect now only depend on the compact1 profile: scala/scala#6164 |
Great! Big step forward. |
As verify by running `jdep -s -P` on the dotty-compiler jar. See scala/bug#10559 for why this is useful and scala/scala#6164 for how this was implemented in scalac.
As verify by running `jdep -s -P` on the dotty-compiler jar. See scala/bug#10559 for why this is useful and scala/scala#6164 for how this was implemented in scalac.
As verify by running `jdep -s -P` on the dotty-compiler jar. See scala/bug#10559 for why this is useful and scala/scala#6164 for how this was implemented in scalac.
As verify by running `jdep -s -P` on the dotty-compiler jar. See scala/bug#10559 for why this is useful and scala/scala#6164 for how this was implemented in scalac.
What's left to do to close this ticket? |
Add the test to the build to close scala/scala-dev#437 |
Enforcement of scala#6164 Tested manually by reverting the sys.process.javaVmArguments change 07ff7ac and then running testJDepsImpl: > testJDeps [info] Compiling 1 Scala source to /d/scala/build/quick/classes/library... [info] Packaging /d/scala/build/pack/lib/scala-library.jar ... [info] Packaging /d/scala/build/pack/lib/scala-reflect.jar ... [info] Done packaging. [info] Done packaging. [trace] Stack trace suppressed: run last root/*:testJDeps for the full output. [error] (root/*:testJDeps) Detected dependency outside of compact1: [error] scala-library.jar -> /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar (compact3) [error] scala-reflect.jar -> /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar (compact1) [error] scala-reflect.jar -> /d/scala/build/pack/lib/scala-library.jar [error] Total time: 4 s, completed 14-Jun-2018 14:20:02 Fixes scala/scala-dev#437 Fixes scala/bug#10559
Enforcement of scala#6164 Tested manually by reverting the sys.process.javaVmArguments change 07ff7ac and then running testJDepsImpl: > testJDeps [info] Compiling 1 Scala source to /d/scala/build/quick/classes/library... [info] Packaging /d/scala/build/pack/lib/scala-library.jar ... [info] Packaging /d/scala/build/pack/lib/scala-reflect.jar ... [info] Done packaging. [info] Done packaging. [trace] Stack trace suppressed: run last root/*:testJDeps for the full output. [error] (root/*:testJDeps) Detected dependency outside of compact1: [error] scala-library.jar -> /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar (compact3) [error] scala-reflect.jar -> /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar (compact1) [error] scala-reflect.jar -> /d/scala/build/pack/lib/scala-library.jar [error] Total time: 4 s, completed 14-Jun-2018 14:20:02 Fixes scala/scala-dev#437 Fixes scala/bug#10559
Uh oh!
There was an error while loading. Please reload this page.
We have got few applications written in Scala. Now we would like to reduce footprint of deliverable binaries. Two reasons: be able to deploy to embedded IoT-like devices and reduce size of docker images.
Resolution of this ticket will also make very positive effect on the size of Java 9 modules required by scala-library, when scala becomes ready for Java 9 jlink tool.
We downsized binaries of compiled OpenJDK JRE from 90MB to 13MB (we achieve it with
minimal1
variant of strippedlibjvm
and compressedcompact1
profile ofrt.jar
). This is big gain, but scala libraries have got unfortunate dependencies which triggerFull JRE
requirement instead ofcompact1
.There 3 places of interest:
Full JRE
profile of rt.jar)compact3
profile of rt.jar, FYI:compact3
profile is 2 times bigger in size thancompact1
)compact2
profile of rt.jar, FYI:compact
2 profile is about 50% bigger thancompact1
)I wonder if it is possible to reduce these dependencies?
Maybe there is a way to disable part of functionally by testing dependency class availability in runtime and using reflection to invoke it?
Alternatively, it maybe possible to split 2 scala jars into more pieces, for example: libs required only for compilation and libs required for runtimes with various profiles (like scala-library-compact1, scala-library-compact2, scala-library-compact3, scala-library-extra instead of a single big one).
I am keen on to contribute the change if you could advise what can be done.
Here are the details and commands, which I used to analyse this:
and:
The text was updated successfully, but these errors were encountered: