From 22232a66dd51998bd7f2ecd0fbc6768686d1ecb8 Mon Sep 17 00:00:00 2001 From: Dawid Weiss Date: Tue, 18 Feb 2020 19:38:11 +0100 Subject: [PATCH] LUCENE-9232: don't fork daemon on the initial run that writes local settings. --- gradlew | 8 +++++++- gradlew.bat | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gradlew b/gradlew index 83f2acfdc31..6ccf783b233 100755 --- a/gradlew +++ b/gradlew @@ -104,6 +104,12 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi +# Don't fork a daemon mode on initial run that generates local defaults. +GRADLE_DAEMON_CTRL= +if [ ! -e "$APP_HOME/gradle.properties" ]; then + GRADLE_DAEMON_CTRL=--no-daemon +fi + # Increase the maximum file descriptors if we can. if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` @@ -178,7 +184,7 @@ save () { APP_ARGS=$(save "$@") # Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain $GRADLE_DAEMON_CTRL "$APP_ARGS" # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then diff --git a/gradlew.bat b/gradlew.bat index 24467a141f7..6f874881f96 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -81,8 +81,12 @@ set CMD_LINE_ARGS=%* set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +@rem Don't fork a daemon mode on initial run that generates local defaults. +SET GRADLE_DAEMON_CTRL= +IF NOT EXIST %DIRNAME%\gradle.properties SET GRADLE_DAEMON_CTRL=--no-daemon + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %GRADLE_DAEMON_CTRL% %CMD_LINE_ARGS% :end @rem End local scope for the variables with windows NT shell