mirror of https://github.com/sbt/sbt.git
Don't pass MaxPermSize to Java 8+
This change stops this annoying message being written to stderr (which can cause IntelliJ to freak): ``` Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 ``` See also: https://bugs.openjdk.java.net/browse/JDK-6964458 https://github.com/sbt/sbt-native-packager/issues/203 https://github.com/typesafehub/activator/issues/422
This commit is contained in:
parent
c2deacbcbb
commit
f716915f52
|
|
@ -17,6 +17,7 @@ declare -a java_args
|
||||||
declare -a scalac_args
|
declare -a scalac_args
|
||||||
declare -a sbt_commands
|
declare -a sbt_commands
|
||||||
declare java_cmd=java
|
declare java_cmd=java
|
||||||
|
declare java_version
|
||||||
declare -r sbt_bin_dir="$(dirname "$(realpath "$0")")"
|
declare -r sbt_bin_dir="$(dirname "$(realpath "$0")")"
|
||||||
declare -r sbt_home="$(dirname "$sbt_bin_dir")"
|
declare -r sbt_home="$(dirname "$sbt_bin_dir")"
|
||||||
|
|
||||||
|
|
@ -86,12 +87,17 @@ get_mem_opts () {
|
||||||
# a ham-fisted attempt to move some memory settings in concert
|
# a ham-fisted attempt to move some memory settings in concert
|
||||||
# so they need not be messed around with individually.
|
# so they need not be messed around with individually.
|
||||||
local mem=${1:-1024}
|
local mem=${1:-1024}
|
||||||
local perm=$(( $mem / 4 ))
|
local codecache=$(( $mem / 8 ))
|
||||||
(( $perm > 256 )) || perm=256
|
(( $codecache > 128 )) || codecache=128
|
||||||
(( $perm < 1024 )) || perm=1024
|
(( $codecache < 512 )) || codecache=512
|
||||||
local codecache=$(( $perm / 2 ))
|
|
||||||
|
|
||||||
echo "-Xms${mem}m -Xmx${mem}m -XX:MaxPermSize=${perm}m -XX:ReservedCodeCacheSize=${codecache}m"
|
local common_opts="-Xms${mem}m -Xmx${mem}m -XX:ReservedCodeCacheSize=${codecache}m"
|
||||||
|
if [[ "$java_version" < "1.8" ]]; then
|
||||||
|
local perm=$(( $codecache * 2 ))
|
||||||
|
echo "$common_opts -XX:MaxPermSize=${perm}m"
|
||||||
|
else
|
||||||
|
echo "$common_opts"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,13 +142,15 @@ process_args () {
|
||||||
residual_args=()
|
residual_args=()
|
||||||
process_my_args "${myargs[@]}"
|
process_my_args "${myargs[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java_version=$("$java_cmd" -version 2>&1 | awk -F '"' '/version/ {print $2}')
|
||||||
|
vlog "[process_args] java_version = '$java_version'"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Detect that we have java installed.
|
# Detect that we have java installed.
|
||||||
checkJava() {
|
checkJava() {
|
||||||
local required_version="$1"
|
local required_version="$1"
|
||||||
# Now check to see if it's a good enough version
|
# Now check to see if it's a good enough version
|
||||||
declare -r java_version=$("$java_cmd" -version 2>&1 | awk -F '"' '/version/ {print $2}')
|
|
||||||
if [[ "$java_version" == "" ]]; then
|
if [[ "$java_version" == "" ]]; then
|
||||||
echo
|
echo
|
||||||
echo No java installations was detected.
|
echo No java installations was detected.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue