forked from BuildCLI/BuildCLI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
72 lines (72 loc) · 2.15 KB
/
install.bat
File metadata and controls
72 lines (72 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@echo off
setlocal
echo Validating current directory...
for %%i in ("%cd%") do (
if /i "%%~nxi"=="BuildCLI" (
echo Current directory is 'BuildCLI'. Checking for Git repository...
if exist ".git" (
echo '.git' directory found. Skipping repository setup.
) else (
echo '.git' directory not found. Ensure this is the correct repository.
pause
exit /b 1
)
) else (
echo Current directory is NOT 'BuildCLI'. Checking if BuildCLI exists...
if not exist "BuildCLI" (
echo 'BuildCLI' directory not found. Cloning repository...
git clone https://github.com/BuildCLI/BuildCLI.git || (
echo Failed to clone repository. Make sure Git is installed.
pause
exit /b 1
)
)
cd BuildCLI || (
echo Failed to access BuildCLI directory.
pause
exit /b 1
)
)
)
echo Checking if Maven is installed...
where mvn >nul 2>nul
if %errorlevel% neq 0 (
echo Maven not found. Please install Maven.
pause
exit /b 1
)
echo Checking if Java is installed...
where java >nul 2>nul
if %errorlevel% neq 0 (
echo Java not found. Please install Java.
pause
exit /b 1
)
echo Building and packaging the project...
call mvn clean package -DskipTests || (
echo Maven build failed.
pause
exit /b 1
)
echo Configuring BuildCLI for global access...
if not exist "%USERPROFILE%\bin" (
echo Creating directory %USERPROFILE%\bin...
mkdir "%USERPROFILE%\bin"
)
echo Copying BuildCLI JAR to %USERPROFILE%\bin...
copy /Y cli\target\buildcli.jar "%USERPROFILE%\bin\buildcli.jar" >nul
echo Creating buildcli.bat shortcut...
(
echo @echo off
echo java --enable-preview --add-modules jdk.incubator.vector -jar "%USERPROFILE%\bin\buildcli.jar" %*
) > "%USERPROFILE%\bin\buildcli.bat"
echo Ensuring %USERPROFILE%\bin is in the PATH...
echo If the command fails, add this manually to your environment variables:
echo.
echo setx PATH "%%PATH%%;%USERPROFILE%\bin"
echo.
echo Installation completed!
echo You can now run BuildCLI using:
echo buildcli
pause
endlocal