[ofbiz-framework] branch release17.12 updated: Fixed: Replace Bintray by a new place to upload the Gradle Wrapper (OFBIZ-12192)

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

[ofbiz-framework] branch release17.12 updated: Fixed: Replace Bintray by a new place to upload the Gradle Wrapper (OFBIZ-12192)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release17.12 by this push:
     new 44cb8dd  Fixed: Replace Bintray by a new place to upload the Gradle Wrapper (OFBIZ-12192)
44cb8dd is described below

commit 44cb8dd327a55a8ae6a93996523baec100f1ba8a
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sat Mar 13 23:13:40 2021 +0100

    Fixed: Replace Bintray by a new place to upload the Gradle Wrapper (OFBIZ-12192)
   
    Updates init-gradle-wrapper.bat
      to exit if Gradle wrapper already exists
      to start PowerShell (>=7) in admin mode, this to be able to use Set-ItemProperty
   
    Updates init-gradle-wrapper.ps1
     to removes exit if Gradle wrapper already exists
     to create the gradle/wrapper dir if necessary
     to handle the ConstrainedLanguage mode if necessary
---
 gradle/init-gradle-wrapper.ps1 | 16 +++++++++++-----
 init-gradle-wrapper.bat        |  9 ++++++---
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/gradle/init-gradle-wrapper.ps1 b/gradle/init-gradle-wrapper.ps1
index 73dd083..c4911bd 100644
--- a/gradle/init-gradle-wrapper.ps1
+++ b/gradle/init-gradle-wrapper.ps1
@@ -15,10 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-if ((Test-Path -Path ((Get-Item -Path ".\").FullName + "\gradle\wrapper\gradle-wrapper.jar"))) {
-    Write-Host "The Gradle Wrapper has already been downloaded.";
-    exit
+md -force gradle/wrapper
+
+If ($ExecutionContext.SessionState.LanguageMode -eq "ConstrainedLanguage") {
+    Set-ItemProperty 'hklm:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -name "__PSLockdownPolicy" -Value 8
+    Invoke-WebRequest -outf gradle\wrapper\gradle-wrapper.jar https://github.com/gradle/gradle/raw/v4.5.1/gradle/wrapper/gradle-wrapper.jar
+    Set-ItemProperty 'hklm:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -name "__PSLockdownPolicy" -Value 4
+} else {
+    Invoke-WebRequest -outf gradle\wrapper\gradle-wrapper.jar https://github.com/gradle/gradle/raw/v4.5.1/gradle/wrapper/gradle-wrapper.jar
 }
 
-# HTTPS is not used because it gets complicated with Powershell and .Net framework versions depending on Windows versions
-Invoke-WebRequest -outf gradle\wrapper\gradle-wrapper.jar https://github.com/gradle/gradle/raw/v4.5.1/gradle/wrapper/gradle-wrapper.jar
+#Write-Host $ExecutionContext.SessionState.LanguageMode
+
+Start-Sleep -s 3
diff --git a/init-gradle-wrapper.bat b/init-gradle-wrapper.bat
index 05327d7..3440521 100755
--- a/init-gradle-wrapper.bat
+++ b/init-gradle-wrapper.bat
@@ -17,7 +17,10 @@ rem KIND, either express or implied.  See the License for the
 rem specific language governing permissions and limitations
 rem under the License.
 rem #####################################################################
-rem interactive DOS version of mergefromtrunk.sh.
-rem to use : launch and pass the trunk version number to merge in release
 
-Powershell.exe -executionpolicy bypass -File  gradle\init-gradle-wrapper.ps1
\ No newline at end of file
+if exist "%~dp0gradle\wrapper\gradle-wrapper.jar" (
+    echo The Gradle Wrapper has already been downloaded.
+    exit /b
+)
+
+pwsh  -command "  Start-Process pwsh -Verb RunAs \""-Command `\""cd '%cd%'; & 'gradle\init-gradle-wrapper.ps1';`\""\""   "