svn commit: r1861766 - in /ofbiz/ofbiz-framework/trunk: .gitignore .hgignore README.adoc gradle/init-gradle-wrapper.ps1 gradle/init-gradle-wrapper.sh gradle/wrapper/gradle-wrapper.jar gradle/wrapper/gradle-wrapper.properties gradlew gradlew.bat

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1861766 - in /ofbiz/ofbiz-framework/trunk: .gitignore .hgignore README.adoc gradle/init-gradle-wrapper.ps1 gradle/init-gradle-wrapper.sh gradle/wrapper/gradle-wrapper.jar gradle/wrapper/gradle-wrapper.properties gradlew gradlew.bat

nmalin
Author: nmalin
Date: Fri Jun 21 09:26:55 2019
New Revision: 1861766

URL: http://svn.apache.org/viewvc?rev=1861766&view=rev
Log:
Implemented: Remove the Gradle wrapper jar
(OFBIZ-10145) (LEGAL-288)

As regards to LEGAL-288 [1] we remove the gradle-wrapper.jar from the source and future release packages.
Now when you run ./gradlew (or gradlew), we check before that gradle/wrapper/gradle-wrapper.jar is present
otherwise we download it before calling the wrapper.

To realize the download, we need as a prerequisite to have:
Unix-like: curl or wget
MS windows: wget

If any issue appears, it's possible to set gradle-wrapper.jar and gradle-wrapper.properties by hand on the directory gradle/wrapper/
Thanks to Jacques Leroux and Swapnil M Mane for their help

[1] https://issues.apache.org/jira/browse/LEGAL-288

Added:
    ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.ps1
    ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh   (with props)
Removed:
    ofbiz/ofbiz-framework/trunk/gradle/wrapper/gradle-wrapper.jar
    ofbiz/ofbiz-framework/trunk/gradle/wrapper/gradle-wrapper.properties
Modified:
    ofbiz/ofbiz-framework/trunk/.gitignore
    ofbiz/ofbiz-framework/trunk/.hgignore
    ofbiz/ofbiz-framework/trunk/README.adoc
    ofbiz/ofbiz-framework/trunk/gradlew
    ofbiz/ofbiz-framework/trunk/gradlew.bat

Modified: ofbiz/ofbiz-framework/trunk/.gitignore
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/.gitignore?rev=1861766&r1=1861765&r2=1861766&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/.gitignore (original)
+++ ofbiz/ofbiz-framework/trunk/.gitignore Fri Jun 21 09:26:55 2019
@@ -2,6 +2,7 @@ bin/
 build/
 applications/*/build
 framework/*/build
+gradle/wrapper
 plugins/
 runtime/git-rebase/*
 runtime/SvnInfo.ftl

Modified: ofbiz/ofbiz-framework/trunk/.hgignore
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/.hgignore?rev=1861766&r1=1861765&r2=1861766&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/.hgignore (original)
+++ ofbiz/ofbiz-framework/trunk/.hgignore Fri Jun 21 09:26:55 2019
@@ -1,5 +1,6 @@
 syntax: regexp
 ^(framework|applications|plugins)/[^/]+/build/.*$
+^gradle/wrapper/.*$
 ^ofbiz\.jar$
 ^runtime/data/derby/.*$
 ^runtime/logs/.*(log|html)(|.\d+)$

Modified: ofbiz/ofbiz-framework/trunk/README.adoc
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/README.adoc?rev=1861766&r1=1861765&r2=1861766&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/README.adoc (original)
+++ ofbiz/ofbiz-framework/trunk/README.adoc Fri Jun 21 09:26:55 2019
@@ -72,6 +72,19 @@ the command line at the OFBiz top level
 [[prepare-ofbiz]]
 === Prepare OFBiz:
 
+==== Setting up the Gradle Wrapper
+
+*Unix-like OS*: ensure that your system have `curl` or `wget` and run `./gradlew`
+
+*MS Windows*: ensure that your system have `wget` and run `gradlew`
+
+if some inconveniences appear please remove `OFBiz-root/gradle/wrapper` directory and run again.
+
+*Manual setting*
+* Get to https://github.com/gradle/gradle/blob/v5.0.0/gradle/wrapper, gradle-wrapper.jar and gradle-wrapper.properties
+* Copy both files in your OFBiz-root\gradle\wrapper directory, that's it.
+
+==== Clean system and load the complete OFBiz data
 _________________________________________________________________________________________________________________________________________________________________________________________________________________
 _Note_: Depending on your Internet connection speed it might take a long time
 for this step to complete if you are using OFBiz for the first time as it needs

Added: ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.ps1
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.ps1?rev=1861766&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.ps1 (added)
+++ ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.ps1 Fri Jun 21 09:26:55 2019
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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
+#
+# http://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.
+
+if (! (Test-Path -Path ((Get-Item -Path ".\").FullName + "\gradle\"))) {
+    Write-Host "Location seems to be incorrect, please run the 'sh gradle/init-gradle-wrapper.ps1' script from Apache OFBiz root.";
+    exit
+}
+
+# This uses  PowerShell Invoke-WebRequest command (aliased as wget here)
+# https is not used because we don't want users to be asked for a credential (not sure about that, maybe https is OK)
+wget -outf gradle\wrapper\gradle-wrapper.jar https://svn.apache.org/repos/asf/ofbiz/tools/Buildbot/Gradle/Wrapper/trunk/gradle-wrapper.jar
+wget -outf gradle\wrapper\gradle-wrapper.properties https://svn.apache.org/repos/asf/ofbiz/tools/Buildbot/Gradle/Wrapper/trunk/gradle-wrapper.properties

Added: ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh?rev=1861766&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh (added)
+++ ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh Fri Jun 21 09:26:55 2019
@@ -0,0 +1,62 @@
+#!/usr/bin/env sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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
+#
+# http://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.
+
+OFBIZ_HOME="$(pwd)"
+GRADLE_OFBIZ_PATH="$OFBIZ_HOME/gradle"
+GRADLE_WRAPPER_OFBIZ_PATH="$GRADLE_OFBIZ_PATH/wrapper"
+RELEASE="5.0.0"
+#GRADLE_WRAPPER_URI="https://github.com/gradle/gradle/blob/v${RELEASE}/gradle/wrapper"
+GRADLE_WRAPPER_URI="https://svn.apache.org/repos/asf/ofbiz/tools/Buildbot/Gradle/Wrapper/trunk/"
+GRADLE_WRAPPER_JAR="gradle-wrapper.jar"
+GRADLE_WRAPPER_PROPERTIES="gradle-wrapper.properties"
+GRADLE_WRAPPER_FILES="$GRADLE_WRAPPER_JAR $GRADLE_WRAPPER_PROPERTIES"
+
+whereIsBinary() {
+    whereis $1 | grep /
+}
+
+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";
+    exit -1;
+fi
+
+if [ ! -d "$GRADLE_WRAPPER_OFBIZ_PATH" ]; then
+    mkdir $GRADLE_WRAPPER_OFBIZ_PATH
+fi
+
+if [ ! -r "$GRADLE_WRAPPER_OFBIZ_PATH/$GRADLE_WRAPPER_JAR" ]; then
+    echo "$GRADLE_WRAPPER_OFBIZ_PATH/$GRADLE_WRAPPER_JAR not found, we download it"
+
+    if [ ! -r "$GRADLE_ZIP_RELEASE" ]; then
+        if [ -n "$(whereIsBinary curl)" ]; then
+            GET_CMD="curl -L -o";
+        elif [ -n "$(whereIsBinary wget)" ]; then
+            GET_CMD="wget -O";
+        else
+           echo "No command curl or wget found, please install one or install yourself gradle (more information see https://gradle.org/install)";
+           exit -1
+        fi
+        for fileToDownload in $GRADLE_WRAPPER_FILES; do
+            $GET_CMD $GRADLE_WRAPPER_OFBIZ_PATH/$fileToDownload $GRADLE_WRAPPER_URI/$fileToDownload?raw=true;
+        done
+    fi
+    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."
+    fi
+fi

Propchange: ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/ofbiz-framework/trunk/gradle/init-gradle-wrapper.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/ofbiz-framework/trunk/gradlew
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/gradlew?rev=1861766&r1=1861765&r2=1861766&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/gradlew (original)
+++ ofbiz/ofbiz-framework/trunk/gradlew Fri Jun 21 09:26:55 2019
@@ -1,4 +1,11 @@
 #!/usr/bin/env sh
+#####################################################################
+# Apache OFBiz part
+# if the gradle-wrapper.jar isn't present, call init to download it
+#####################################################################
+if [ ! -r ./gradle/wrapper/gradle-wrapper.jar ]; then
+    sh ./gradle/init-gradle-wrapper.sh
+fi
 
 #####################################################################
 ##  Gradle start up script for UN*X

Modified: ofbiz/ofbiz-framework/trunk/gradlew.bat
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/gradlew.bat?rev=1861766&r1=1861765&r2=1861766&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/gradlew.bat (original)
+++ ofbiz/ofbiz-framework/trunk/gradlew.bat Fri Jun 21 09:26:55 2019
@@ -80,6 +80,13 @@ set CMD_LINE_ARGS=%*
 
 set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
 
+@rem check if Gradle is installed
+if exist "%CLASSPATH%" goto GradleOK
+
+md %APP_HOME%\gradle\wrapper\
+Powershell.exe -executionpolicy remotesigned -File  %APP_HOME%\init-gradle-wrapper.ps1
+
+:GradleOK
 @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%