-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
165 lines (142 loc) · 4.23 KB
/
build.bat
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@echo off
setlocal enabledelayedexpansion
:: 개발 중 표시
echo ===================================
echo WARNING: This build script is under development
echo Current status: ALPHA
echo ===================================
echo.
echo Build script is currently disabled for testing
echo Please wait until development is complete
exit /b 1
:: 개발 중 확인
set /p CONTINUE="Do you want to continue? (Y/N): "
if /i not "!CONTINUE!"=="Y" (
echo Build process cancelled by user
exit /b 0
)
:: Node.js와 Yarn 설치 여부 및 버전 체크
echo Checking Node.js and Yarn installation...
:: Node.js 설치 확인
where node >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo Error: Node.js is not installed
echo Please install Node.js version 20 or higher
exit /b 1
)
:: Yarn 설치 확인
where yarn >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo Error: Yarn is not installed
echo Please install Yarn version 4.0.0 or higher
exit /b 1
)
:: Node.js 버전 체크
for /f "tokens=1,2,3 delims=." %%a in ('node -v') do (
set NODE_MAJOR=%%a
set NODE_MAJOR=!NODE_MAJOR:~1!
)
if !NODE_MAJOR! LSS 20 (
echo Error: Node.js version 20 or higher is required
echo Current version: !NODE_MAJOR!
exit /b 1
)
:: Yarn 버전 체크
for /f "tokens=1,2,3 delims=." %%a in ('yarn -v') do (
set YARN_MAJOR=%%a
if %%a LSS 4 (
echo Error: Yarn version 4.0.0 or higher is required
echo Current version: %%a.%%b.%%c
exit /b 1
)
)
echo Version check passed
:: 버전 정보 추출
for /f "tokens=2 delims=:, " %%a in ('findstr "version" package.json') do (
set VERSION=%%~a
set VERSION=!VERSION:"=!
)
echo Building version %VERSION%...
:: 빌드 디렉토리 생성
set BUILD_DIR=.\package
if not exist %BUILD_DIR% mkdir %BUILD_DIR%
:: 필요한 모듈 설치
echo Installing dependencies...
call yarn install
:: Android 환경 체크 함수
:check_android_env
if not defined ANDROID_HOME (
echo Error: ANDROID_HOME environment variable is not set
echo Please install Android Studio and set ANDROID_HOME in your environment
echo Example: set ANDROID_HOME=C:\Users\YourUser\AppData\Local\Android\Sdk
exit /b 1
)
if not exist "%ANDROID_HOME%\platform-tools" (
echo Error: Android SDK platform-tools not found
echo Please install platform-tools using Android Studio SDK Manager
exit /b 1
)
if not exist "%ANDROID_HOME%\build-tools" (
echo Error: Android SDK build-tools not found
echo Please install build-tools using Android Studio SDK Manager
exit /b 1
)
goto :eof
:: Windows 빌드 함수
:build_windows
echo Building Windows version...
call quasar build -m electron -T win32
if errorlevel 1 (
echo Windows build failed
exit /b 1
) else (
echo Windows build completed successfully
move /Y dist\electron\Packaged\*.exe "%BUILD_DIR%\QCalc-%VERSION%-win32.exe"
)
goto :eof
:: Android 빌드 함수
:build_android
echo Building Android version...
call :check_android_env
call quasar build -m capacitor -T android
if errorlevel 1 (
echo Android build failed
exit /b 1
) else (
echo Android build completed successfully
set KEYSTORE_PATH=src-capacitor\android\app\my-release-key.jks
if not exist "!KEYSTORE_PATH!" (
echo Warning: Keystore file not found at !KEYSTORE_PATH!
echo Android app will be unsigned
) else (
echo Building signed APK...
cd src-capacitor\android
call gradlew assembleRelease
cd ..\..
copy /Y src-capacitor\android\app\build\outputs\apk\release\app-release.apk "%BUILD_DIR%\QCalc-%VERSION%-android.apk"
)
)
goto :eof
:: 메인 실행 부분
set BUILD_TYPE=%1
if "%BUILD_TYPE%"=="" set BUILD_TYPE=all
:: 개발 중인 기능 체크
if "%BUILD_TYPE%"=="android" (
echo Android build is currently under development
echo This feature is not fully implemented yet
exit /b 1
)
if "%BUILD_TYPE%"=="all" (
call :build_windows
echo Android build is skipped (under development)
) else if "%BUILD_TYPE%"=="win" (
call :build_windows
) else if "%BUILD_TYPE%"=="android" (
call :build_android
) else (
echo Invalid build type. Available options: all, win, android
exit /b 1
)
echo Build completed!
echo You can find the build files in the %BUILD_DIR% directory
endlocal