mirror of https://github.com/sbt/sbt.git
Handle JDK_JAVA_OPTIONS
This commit is contained in:
parent
6d62c345aa
commit
d48895df85
|
|
@ -718,6 +718,7 @@ if defined sbt_args_verbose (
|
||||||
if defined _JAVA_OPTS ( call :echolist !_JAVA_OPTS! )
|
if defined _JAVA_OPTS ( call :echolist !_JAVA_OPTS! )
|
||||||
if defined _SBT_OPTS ( call :echolist !_SBT_OPTS! )
|
if defined _SBT_OPTS ( call :echolist !_SBT_OPTS! )
|
||||||
if defined JAVA_TOOL_OPTIONS ( call :echolist %JAVA_TOOL_OPTIONS% )
|
if defined JAVA_TOOL_OPTIONS ( call :echolist %JAVA_TOOL_OPTIONS% )
|
||||||
|
if defined JDK_JAVA_OPTIONS ( call :echolist %JDK_JAVA_OPTIONS% )
|
||||||
echo -cp
|
echo -cp
|
||||||
echo "!sbt_jar!"
|
echo "!sbt_jar!"
|
||||||
echo xsbt.boot.Boot
|
echo xsbt.boot.Boot
|
||||||
|
|
@ -725,7 +726,7 @@ if defined sbt_args_verbose (
|
||||||
echo.
|
echo.
|
||||||
)
|
)
|
||||||
|
|
||||||
"!_JAVACMD!" !_JAVA_OPTS! !_SBT_OPTS! %JAVA_TOOL_OPTIONS% -cp "!sbt_jar!" xsbt.boot.Boot %*
|
"!_JAVACMD!" !_JAVA_OPTS! !_SBT_OPTS! %JAVA_TOOL_OPTIONS% %JDK_JAVA_OPTIONS% -cp "!sbt_jar!" xsbt.boot.Boot %*
|
||||||
|
|
||||||
goto :eof
|
goto :eof
|
||||||
|
|
||||||
|
|
@ -859,7 +860,7 @@ exit /B 0
|
||||||
exit /B 0
|
exit /B 0
|
||||||
|
|
||||||
:addDefaultMemory
|
:addDefaultMemory
|
||||||
rem if we detect any of these settings in ${JAVA_OPTS} or ${JAVA_TOOL_OPTIONS} we need to NOT output our settings.
|
rem if we detect any of these settings in ${JAVA_OPTS} or ${JAVA_TOOL_OPTIONS} or ${JDK_JAVA_OPTIONS} we need to NOT output our settings.
|
||||||
rem The reason is the Xms/Xmx, if they don't line up, cause errors.
|
rem The reason is the Xms/Xmx, if they don't line up, cause errors.
|
||||||
|
|
||||||
set _has_memory_args=
|
set _has_memory_args=
|
||||||
|
|
@ -878,6 +879,13 @@ exit /B 0
|
||||||
if "!p:~0,4!" == "-Xss" set _has_memory_args=1
|
if "!p:~0,4!" == "-Xss" set _has_memory_args=1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if defined JDK_JAVA_OPTIONS for %%g in (%JDK_JAVA_OPTIONS%) do (
|
||||||
|
set "p=%%g"
|
||||||
|
if "!p:~0,4!" == "-Xmx" set _has_memory_args=1
|
||||||
|
if "!p:~0,4!" == "-Xms" set _has_memory_args=1
|
||||||
|
if "!p:~0,4!" == "-Xss" set _has_memory_args=1
|
||||||
|
)
|
||||||
|
|
||||||
if defined _SBT_OPTS for %%g in (%_SBT_OPTS%) do (
|
if defined _SBT_OPTS for %%g in (%_SBT_OPTS%) do (
|
||||||
set "p=%%g"
|
set "p=%%g"
|
||||||
if "!p:~0,4!" == "-Xmx" set _has_memory_args=1
|
if "!p:~0,4!" == "-Xmx" set _has_memory_args=1
|
||||||
|
|
|
||||||
17
sbt
17
sbt
|
|
@ -303,7 +303,7 @@ addMemory () {
|
||||||
}
|
}
|
||||||
|
|
||||||
addDefaultMemory() {
|
addDefaultMemory() {
|
||||||
# if we detect any of these settings in ${JAVA_OPTS} or ${JAVA_TOOL_OPTIONS} we need to NOT output our settings.
|
# if we detect any of these settings in ${JAVA_OPTS} or ${JAVA_TOOL_OPTIONS} or ${JDK_JAVA_OPTIONS} we need to NOT output our settings.
|
||||||
# The reason is the Xms/Xmx, if they don't line up, cause errors.
|
# The reason is the Xms/Xmx, if they don't line up, cause errors.
|
||||||
if [[ "${java_args[@]}" == *-Xmx* ]] || \
|
if [[ "${java_args[@]}" == *-Xmx* ]] || \
|
||||||
[[ "${java_args[@]}" == *-Xms* ]] || \
|
[[ "${java_args[@]}" == *-Xms* ]] || \
|
||||||
|
|
@ -323,6 +323,15 @@ addDefaultMemory() {
|
||||||
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:MaxRAMPercentage* ]] || \
|
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:MaxRAMPercentage* ]] || \
|
||||||
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:MinRAMPercentage* ]] ; then
|
[[ "${JAVA_TOOL_OPTIONS}" == *-XX:MinRAMPercentage* ]] ; then
|
||||||
:
|
:
|
||||||
|
elif [[ "${JDK_JAVA_OPTIONS}" == *-Xmx* ]] || \
|
||||||
|
[[ "${JDK_JAVA_OPTIONS}" == *-Xms* ]] || \
|
||||||
|
[[ "${JDK_JAVA_OPTIONS}" == *-Xss* ]] || \
|
||||||
|
[[ "${JDK_JAVA_OPTIONS}" == *-XX:+UseCGroupMemoryLimitForHeap* ]] || \
|
||||||
|
[[ "${JDK_JAVA_OPTIONS}" == *-XX:MaxRAM* ]] || \
|
||||||
|
[[ "${JDK_JAVA_OPTIONS}" == *-XX:InitialRAMPercentage* ]] || \
|
||||||
|
[[ "${JDK_JAVA_OPTIONS}" == *-XX:MaxRAMPercentage* ]] || \
|
||||||
|
[[ "${JDK_JAVA_OPTIONS}" == *-XX:MinRAMPercentage* ]] ; then
|
||||||
|
:
|
||||||
elif [[ "${sbt_options[@]}" == *-Xmx* ]] || \
|
elif [[ "${sbt_options[@]}" == *-Xmx* ]] || \
|
||||||
[[ "${sbt_options[@]}" == *-Xms* ]] || \
|
[[ "${sbt_options[@]}" == *-Xms* ]] || \
|
||||||
[[ "${sbt_options[@]}" == *-Xss* ]] || \
|
[[ "${sbt_options[@]}" == *-Xss* ]] || \
|
||||||
|
|
@ -406,16 +415,19 @@ jdk_version() {
|
||||||
# - SBT_OPTS environment variable,
|
# - SBT_OPTS environment variable,
|
||||||
# - _JAVA_OPTIONS environment variable and
|
# - _JAVA_OPTIONS environment variable and
|
||||||
# - JAVA_TOOL_OPTIONS environment variable
|
# - JAVA_TOOL_OPTIONS environment variable
|
||||||
|
# - JDK_JAVA_OPTIONS environment variable
|
||||||
# in that order.
|
# in that order.
|
||||||
findProperty() {
|
findProperty() {
|
||||||
local -a java_opts_array
|
local -a java_opts_array
|
||||||
local -a sbt_opts_array
|
local -a sbt_opts_array
|
||||||
local -a _java_options_array
|
local -a _java_options_array
|
||||||
local -a java_tool_options_array
|
local -a java_tool_options_array
|
||||||
|
local -a jdk_java_options_array
|
||||||
read -a java_opts_array <<< "$JAVA_OPTS"
|
read -a java_opts_array <<< "$JAVA_OPTS"
|
||||||
read -a sbt_opts_array <<< "$SBT_OPTS"
|
read -a sbt_opts_array <<< "$SBT_OPTS"
|
||||||
read -a _java_options_array <<< "$_JAVA_OPTIONS"
|
read -a _java_options_array <<< "$_JAVA_OPTIONS"
|
||||||
read -a java_tool_options_array <<< "$JAVA_TOOL_OPTIONS"
|
read -a java_tool_options_array <<< "$JAVA_TOOL_OPTIONS"
|
||||||
|
read -a jdk_java_options_array <<< "$JDK_JAVA_OPTIONS"
|
||||||
|
|
||||||
local args_to_check=(
|
local args_to_check=(
|
||||||
"${java_args[@]}"
|
"${java_args[@]}"
|
||||||
|
|
@ -423,6 +435,7 @@ findProperty() {
|
||||||
"${sbt_opts_array[@]}"
|
"${sbt_opts_array[@]}"
|
||||||
"${_java_options_array[@]}"
|
"${_java_options_array[@]}"
|
||||||
"${java_tool_options_array[@]}")
|
"${java_tool_options_array[@]}")
|
||||||
|
"${jdk_java_options_array[@]}")
|
||||||
|
|
||||||
for opt in "${args_to_check[@]}"; do
|
for opt in "${args_to_check[@]}"; do
|
||||||
if [[ "$opt" == -D$1=* ]]; then
|
if [[ "$opt" == -D$1=* ]]; then
|
||||||
|
|
@ -577,6 +590,7 @@ run() {
|
||||||
"${java_args[@]}" \
|
"${java_args[@]}" \
|
||||||
"${sbt_options[@]}" \
|
"${sbt_options[@]}" \
|
||||||
"${java_tool_options[@]}" \
|
"${java_tool_options[@]}" \
|
||||||
|
"${jdk_java_options[@]}" \
|
||||||
-jar "$sbt_jar" \
|
-jar "$sbt_jar" \
|
||||||
"${sbt_commands[@]}" \
|
"${sbt_commands[@]}" \
|
||||||
"${residual_args[@]}"
|
"${residual_args[@]}"
|
||||||
|
|
@ -856,6 +870,7 @@ fi
|
||||||
java_args=($JAVA_OPTS)
|
java_args=($JAVA_OPTS)
|
||||||
sbt_options0=(${SBT_OPTS:-$default_sbt_opts})
|
sbt_options0=(${SBT_OPTS:-$default_sbt_opts})
|
||||||
java_tool_options=($JAVA_TOOL_OPTIONS)
|
java_tool_options=($JAVA_TOOL_OPTIONS)
|
||||||
|
jdk_java_options=($JDK_JAVA_OPTIONS)
|
||||||
if [[ "$SBT_NATIVE_CLIENT" == "true" ]]; then
|
if [[ "$SBT_NATIVE_CLIENT" == "true" ]]; then
|
||||||
use_sbtn=1
|
use_sbtn=1
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue