37 lines
1.2 KiB
Batchfile
37 lines
1.2 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions
|
|
|
|
set "GRADLE_VERSION=9.7.1"
|
|
set "APP_HOME=%~dp0"
|
|
if "%APP_HOME:~-1%"=="\" set "APP_HOME=%APP_HOME:~0,-1%"
|
|
set "DIST_ROOT=%USERPROFILE%\.gradle\pixelbanners-bootstrap"
|
|
set "DIST_DIR=%DIST_ROOT%\gradle-%GRADLE_VERSION%"
|
|
set "DIST_ZIP=%DIST_ROOT%\gradle-%GRADLE_VERSION%-bin.zip"
|
|
set "GRADLE_BAT=%DIST_DIR%\bin\gradle.bat"
|
|
|
|
if exist "%GRADLE_BAT%" goto run
|
|
|
|
if not exist "%DIST_ROOT%" mkdir "%DIST_ROOT%"
|
|
|
|
echo [AstraFertilizers] Gradle %GRADLE_VERSION% not found. Downloading...
|
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; Invoke-WebRequest -UseBasicParsing 'https://services.gradle.org/distributions/gradle-%GRADLE_VERSION%-bin.zip' -OutFile '%DIST_ZIP%'"
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo [AstraFertilizers] ERROR: Could not download Gradle %GRADLE_VERSION%.
|
|
exit /b 1
|
|
)
|
|
|
|
echo [AstraFertilizers] Extracting Gradle...
|
|
powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; Expand-Archive -LiteralPath '%DIST_ZIP%' -DestinationPath '%DIST_ROOT%' -Force"
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo [AstraFertilizers] ERROR: Could not extract Gradle.
|
|
exit /b 1
|
|
)
|
|
|
|
del /q "%DIST_ZIP%" >nul 2>&1
|
|
|
|
:run
|
|
call "%GRADLE_BAT%" -p "%APP_HOME%" %*
|
|
exit /b %ERRORLEVEL%
|