You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2019/12/16 14:23:15 UTC

[lucene-solr] branch gradle-master updated: Upgrade gradlew. Add environment sanity check.

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch gradle-master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/gradle-master by this push:
     new 401ddc6  Upgrade gradlew. Add environment sanity check.
401ddc6 is described below

commit 401ddc6dd1838f7061155de1e9f7bc95931a2f24
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Mon Dec 16 15:23:06 2019 +0100

    Upgrade gradlew. Add environment sanity check.
---
 build.gradle                               |   3 +++
 gradle/validation/check-environment.gradle |  30 +++++++++++++++++++++++++++++
 gradle/wrapper/gradle-wrapper.jar          | Bin 56177 -> 55616 bytes
 gradle/wrapper/gradle-wrapper.properties   |   2 +-
 gradlew                                    |  22 ++++++++++++++++++---
 gradlew.bat                                |  18 ++++++++++++++++-
 6 files changed, 70 insertions(+), 5 deletions(-)

diff --git a/build.gradle b/build.gradle
index ed230e1..9d6797f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,6 +11,9 @@ allprojects {
   version = "9.0.0-SNAPSHOT"
 }
 
+// Make sure the build environment is consistent.
+apply from: file('gradle/validation/check-environment.gradle')
+
 // Include smaller chunks configuring dedicated build areas.
 // Some of these intersect or add additional functionality.
 // The order of inclusion of these files shouldn't matter (but may
diff --git a/gradle/validation/check-environment.gradle b/gradle/validation/check-environment.gradle
new file mode 100644
index 0000000..3acfbb3
--- /dev/null
+++ b/gradle/validation/check-environment.gradle
@@ -0,0 +1,30 @@
+// This checks that we're running the desired version of Gradle and
+// that the JVM is supported.
+
+import org.gradle.util.GradleVersion
+
+configure(rootProject) {
+  ext {
+    expectedGradleVersion = '5.6.4'
+    expectedJavaVersion = JavaVersion.VERSION_11
+  }
+
+  wrapper {
+    distributionType = Wrapper.DistributionType.ALL
+    gradleVersion = expectedGradleVersion
+  }
+
+  def currentJavaVersion = JavaVersion.current()
+  if (currentJavaVersion < expectedJavaVersion) {
+    throw new GradleException("Java version ${expectedJavaVersion} is required: this Java is ${currentJavaVersion} "
+      + "[${System.getProperty('java.vm.name')} ${System.getProperty('java.vm.version')}]")
+  }
+
+  // If we're regenerating the wrapper, skip the check.
+  if (!gradle.startParameter.taskNames.contains("wrapper")) {
+    def currentGradleVersion = GradleVersion.current()
+    if (currentGradleVersion != GradleVersion.version(expectedGradleVersion)) {
+      throw new GradleException("Gradle ${expectedGradleVersion} is required (hint: use the gradlew script): this gradle is ${currentGradleVersion}")
+    }
+  }
+}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 29953ea..5c2d1cf 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 51b873d..0ebb310 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https://services.gradle.org/distributions/gradle-5.6.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index cccdd3d..83f2acf 100755
--- a/gradlew
+++ b/gradlew
@@ -1,5 +1,21 @@
 #!/usr/bin/env sh
 
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
 ##############################################################################
 ##
 ##  Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
 APP_BASE_NAME=`basename "$0"`
 
 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
 
 # Use the maximum available, or set MAX_FD != -1 to use that value.
 MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
     GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
 fi
 
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
     APP_HOME=`cygpath --path --mixed "$APP_HOME"`
     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
     JAVACMD=`cygpath --unix "$JAVACMD"`
diff --git a/gradlew.bat b/gradlew.bat
index e95643d..24467a1 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
 @if "%DEBUG%" == "" @echo off
 @rem ##########################################################################
 @rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
 set APP_HOME=%DIRNAME%
 
 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
 
 @rem Find java.exe
 if defined JAVA_HOME goto findJavaFromJavaHome