#39793 closed enhancement (fixed)
Allow custom Java options to launch sbt
Reported by: | luc-j-bourhis (Luc J. Bourhis) | Owned by: | blair (Blair Zajac) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | haspatch | Cc: | cooljeanius (Eric Gallager) |
Port: | sbt |
Description
The default Java options in /opt/local/share/sbt/sbt may not suit every user. For example, I like to reduce the memory footprint for some projects by using -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC and then by tuning -Xms and -Xmx. Thus I propose the attached patch that lets user define their custom option in ~/.sbtconfig
Attachments (2)
Change History (11)
Changed 11 years ago by luc-j-bourhis (Luc J. Bourhis)
comment:1 Changed 11 years ago by mf2k (Frank Schima)
Keywords: | haspatch added |
---|---|
Owner: | changed from macports-tickets@… to blair@… |
Type: | request → enhancement |
Version: | 2.1.3 |
Changed 11 years ago by luc-j-bourhis (Luc J. Bourhis)
comment:2 Changed 11 years ago by luc-j-bourhis (Luc J. Bourhis)
Better patch (sbt2.diff) that is more compatible with current behaviour.
comment:4 follow-up: 5 Changed 11 years ago by blair (Blair Zajac)
Here's my new proposed patch which doesn't assume that ~/.sbtconfig sets SBT_JAVA_OPTS. Let me know if this works for you.
Index: sbt.sh =================================================================== --- sbt.sh (revision 108610) +++ sbt.sh (working copy) @@ -17,9 +17,15 @@ # Is the location of the SBT launcher JAR file. LAUNCHJAR="__SBT_LAUNCHER_PATH__" -# Ensure enough heap space is created for sbt. These settings are the -# default settings from Typesafe's sbt wrapper. +# Customization: this may define a variable SBT_JAVA_OPTS +SBTCONF=~/.sbtconfig +if [ -f "$SBTCONF" ]; then + . $SBTCONF + JAVA_OPTS="$SBT_JAVA_OPTS" +fi if [ -z "$JAVA_OPTS" ]; then + # Ensure enough heap space is created for sbt. These settings are + # the default settings from Typesafe's sbt wrapper. JAVA_OPTS="-XX:+CMSClassUnloadingEnabled -Xms1536m -Xmx1536m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=192m -Dfile.encoding=UTF8" fi
comment:5 Changed 11 years ago by luc-j-bourhis (Luc J. Bourhis)
Replying to blair@…:
Here's my new proposed patch which doesn't assume that ~/.sbtconfig sets SBT_JAVA_OPTS. Let me know if this works for you.
It works. But written in this way, shall we set JAVA_OPTS instead of SBT_JAVA_OPTS in ~/.sbtconfig then? This would make it more obvious, wouldn't it?
comment:6 Changed 11 years ago by blair (Blair Zajac)
Sure, we can do this:
Index: files/sbt.sh =================================================================== --- files/sbt.sh (revision 108610) +++ files/sbt.sh (working copy) @@ -17,9 +17,14 @@ # Is the location of the SBT launcher JAR file. LAUNCHJAR="__SBT_LAUNCHER_PATH__" -# Ensure enough heap space is created for sbt. These settings are the -# default settings from Typesafe's sbt wrapper. +# Customization: this may define JAVA_OPTS. +SBTCONF=~/.sbtconfig +if [ -f "$SBTCONF" ]; then + . $SBTCONF +fi if [ -z "$JAVA_OPTS" ]; then + # Ensure enough heap space is created for sbt. These settings are + # the default settings from Typesafe's sbt wrapper. JAVA_OPTS="-XX:+CMSClassUnloadingEnabled -Xms1536m -Xmx1536m -XX:MaxPermSize=384m -XX:ReservedCodeCacheSize=192m -Dfile.encoding=UTF8" fi
comment:7 Changed 11 years ago by luc-j-bourhis (Luc J. Bourhis)
Yes, exactly, I think that's the better version.
comment:8 Changed 11 years ago by blair (Blair Zajac)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in r108615. I changed ~ to $HOME also in the final commit.
In the future, please Cc the port maintainer(s).