75 lines
2.3 KiB
Batchfile
75 lines
2.3 KiB
Batchfile
@echo off
|
|
REM Create Gradle wrapper files
|
|
setlocal enabledelayedexpansion
|
|
|
|
set "PROJECT_DIR=%~1"
|
|
set "GRADLE_VERSION=8.9"
|
|
|
|
REM Create gradle wrapper directory
|
|
mkdir "%PROJECT_DIR%\gradle\wrapper" 2>nul
|
|
|
|
REM Create gradle-wrapper.properties
|
|
(
|
|
echo distributionBase=GRADLE_USER_HOME
|
|
echo distributionPath=wrapper/dists
|
|
echo distributionUrl=https\://services.gradle.org/distributions/gradle-%GRADLE_VERSION%-bin.zip
|
|
echo networkTimeout=10000
|
|
echo validateDistributionUrl=true
|
|
echo zipStoreBase=GRADLE_USER_HOME
|
|
echo zipStorePath=wrapper/dists
|
|
) > "%PROJECT_DIR%\gradle\wrapper\gradle-wrapper.properties"
|
|
|
|
REM Check if gradle is installed globally
|
|
where gradle >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ================================================================
|
|
echo ERROR: Gradle not found
|
|
echo ================================================================
|
|
echo.
|
|
echo The Gradle wrapper requires either:
|
|
echo 1. Gradle installed globally to generate wrapper files, OR
|
|
echo 2. Pre-bundled gradle-wrapper.jar file
|
|
echo.
|
|
echo TO FIX - Install Gradle:
|
|
echo Windows ^(Chocolatey^): choco install gradle
|
|
echo Windows ^(Scoop^): scoop install gradle
|
|
echo Manual download: https://gradle.org/install/
|
|
echo.
|
|
echo After installing Gradle:
|
|
echo 1. Restart your command prompt
|
|
echo 2. Run: gradle --version ^(to verify^)
|
|
echo 3. Re-run the project generator
|
|
echo.
|
|
echo ================================================================
|
|
echo.
|
|
exit /b 1
|
|
)
|
|
|
|
REM Verify gradle version
|
|
for /f "tokens=3" %%v in ('gradle --version 2^>^&1 ^| findstr /C:"Gradle"') do set INSTALLED_GRADLE=%%v
|
|
echo Found Gradle %INSTALLED_GRADLE%
|
|
|
|
REM Now use gradle to generate the wrapper
|
|
echo Generating wrapper using installed Gradle...
|
|
cd /d "%PROJECT_DIR%"
|
|
gradle wrapper --gradle-version %GRADLE_VERSION% --no-daemon >nul 2>&1
|
|
|
|
if not exist "%PROJECT_DIR%\gradle\wrapper\gradle-wrapper.jar" (
|
|
echo.
|
|
echo ERROR: Gradle wrapper generation failed
|
|
echo.
|
|
echo The 'gradle wrapper' command did not create gradle-wrapper.jar
|
|
echo This should not happen with a working Gradle installation.
|
|
echo.
|
|
echo Try manually:
|
|
echo cd %PROJECT_DIR%
|
|
echo gradle wrapper --gradle-version %GRADLE_VERSION%
|
|
echo.
|
|
exit /b 1
|
|
)
|
|
|
|
echo + Gradle wrapper generated successfully
|
|
|
|
endlocal
|
|
exit /b 0 |