You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2019/08/30 07:15:09 UTC
svn commit: r1866122 - in
/ofbiz/ofbiz-framework/branches/release17.12/gradle:
init-gradle-wrapper.ps1 init-gradle-wrapper.sh
Author: nmalin
Date: Fri Aug 30 07:15:09 2019
New Revision: 1866122
URL: http://svn.apache.org/viewvc?rev=1866122&view=rev
Log:
Improved: update init-gradle-wrapper.sh to load gradlew script
(OFBIZ-10145)
When you run 'sh gradle/init-gradle-wrapper.sh', if the script gradlew at the OFBiz root isn't present we download it from bintray.
Improvements to comments and messages in the init-gradle-wrapper.sh script do on r1865605 by Jacopo
Modified:
ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.ps1
ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.sh
Modified: ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.ps1
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.ps1?rev=1866122&r1=1866121&r2=1866122&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.ps1 (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.ps1 Fri Aug 30 07:15:09 2019
@@ -25,4 +25,5 @@ if ((Test-Path -Path ((Get-Item -Path ".
# Anyway I believe this should be only used in dev environment
wget -outf gradle\wrapper\gradle-wrapper.jar http://dl.bintray.com/apacheofbiz/GradleWrapper/v3.2.1/gradle-wrapper.jar
wget -outf gradle\wrapper\gradle-wrapper.properties http://dl.bintray.com/apacheofbiz/GradleWrapper/v3.2.1/gradle-wrapper.properties
+wget -outf gradlew.bat http://dl.bintray.com/apacheofbiz/GradleWrapper/v3.2.1/gradlew.bat
Modified: ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.sh
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.sh?rev=1866122&r1=1866121&r2=1866122&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.sh (original)
+++ ofbiz/ofbiz-framework/branches/release17.12/gradle/init-gradle-wrapper.sh Fri Aug 30 07:15:09 2019
@@ -26,19 +26,21 @@ RELEASE="3.2.1"
GRADLE_WRAPPER_URI="https://dl.bintray.com/apacheofbiz/GradleWrapper/v$RELEASE/"
GRADLE_WRAPPER_URI_BACKUP="https://github.com/gradle/gradle/raw/v$RELEASE/gradle/wrapper/"
-# Embded checksum shasum to control the download
+# checksum to verify the downloaded file
SHASUM_GRADLE_WRAPPER_FILES="12478d9829998a5433231ad971bae52978279a3d gradle/wrapper/gradle-wrapper.jar
-05d4ab69d3f2143e017710b0917b740f75a75c07 gradle/wrapper/gradle-wrapper.properties"
+05d4ab69d3f2143e017710b0917b740f75a75c07 gradle/wrapper/gradle-wrapper.properties
+aaa5fb4c074407cb4d7f8c89a80342f3130880c3 gradlew"
GRADLE_WRAPPER_JAR="gradle-wrapper.jar"
GRADLE_WRAPPER_PROPERTIES="gradle-wrapper.properties"
GRADLE_WRAPPER_FILES="$GRADLE_WRAPPER_JAR $GRADLE_WRAPPER_PROPERTIES"
+GRADLE_WRAPPER_SCRIPT="gradlew"
whereIsBinary() {
whereis $1 | grep /
}
-# Resolve the command to use for calling and realize the download
+# Perform the download using curl or wget
downloadFile() {
if [ -n "$(whereIsBinary curl)" ]; then
GET_CMD="curl -L -o $GRADLE_WRAPPER_OFBIZ_PATH/$1 -s -w %{http_code} $2/$1";
@@ -55,7 +57,7 @@ downloadFile() {
return 1
}
-# Call and if not succes try to use backup
+# Download the file from the main URI; if the download fails then use the backup URI
resolveFile() {
downloadFile $1 $GRADLE_WRAPPER_URI;
if [ $? -eq 1 ]; then
@@ -64,15 +66,18 @@ resolveFile() {
}
echo " === Prepare operation ===";
-# Control that we work the script on a good directory
+# Verify that the script is executed from the right location
if [ ! -d "$GRADLE_OFBIZ_PATH" ]; then
- echo "Location seems to be uncorrected, please take care to run 'sh gradle/init-gradle-wrapper.sh' at the Apache OFBiz home";
+ echo "Location seems to be incorrect, please run 'sh gradle/init-gradle-wrapper.sh' from the Apache OFBiz home";
exit 1;
fi
+if [ ! -d "$GRADLE_WRAPPER_OFBIZ_PATH" ]; then
+ mkdir $GRADLE_WRAPPER_OFBIZ_PATH;
+fi
# check if we have on binary to download missing wrapper
if [ -z "$(whereIsBinary curl)" ] && [ -z "$(whereIsBinary wget)" ]; then
- echo "No command curl or wget found, please install one or install yourself gradle (more information see README.adoc or https://gradle.org/install)";
+ echo "curl or wget not found, please install one of them or install yourself gradle (for more information see README.md or https://gradle.org/install)";
exit 1
fi
@@ -85,15 +90,23 @@ if [ ! -r "$GRADLE_WRAPPER_OFBIZ_PATH/$G
done
if [ ! $? -eq 0 ]; then
rm -f $GRADLE_WRAPPER_OFBIZ_PATH/*
- echo "\nDownload files $GRADLE_WRAPPER_FILES from $GRADLE_WRAPPER_URI failed.\nPlease check the log to found the reason and run the script again."
+ echo "\nDownload files $GRADLE_WRAPPER_FILES from $GRADLE_WRAPPER_URI failed.\nPlease check the logs, fix the problem and run the script again."
+ fi
+
+ if [ ! -r "$GRADLE_WRAPPER_SCRIPT" ]; then
+ echo " === Download script wrapper ==="
+ resolveFile $GRADLE_WRAPPER_SCRIPT
+ mv "$GRADLE_WRAPPER_OFBIZ_PATH/$GRADLE_WRAPPER_SCRIPT" .
+ chmod u+x $GRADLE_WRAPPER_SCRIPT
fi
+
echo " === Control downloaded files ==="
if [ -n "$(whereIsBinary shasum)" ]; then
echo "$SHASUM_GRADLE_WRAPPER_FILES" | shasum -c -;
exit 0;
fi
- echo " Warning: shasum not found, skip the control process"
+ echo " Warning: shasum not found, the downloaded files could not be verified"
exit 1;
fi
-echo " Nothing todo"
+echo " Nothing to be done"