Ensure Win buildscript works

This commit is contained in:
saoqq
2022-11-25 21:52:22 +03:00
parent d87a59bcb0
commit e243522f95
3 changed files with 14 additions and 110 deletions
+4 -7
View File
@@ -104,25 +104,22 @@ task cleanVersionFile {
task buildVTL(type: Exec) {
dependsOn 'assembleRelease'
dependsOn 'exportDex'
workingDir(projectDir.toPath().resolve("../scripts").normalize().toString())
workingDir(projectDir.parentFile)
if (Os.isFamily("unix") || Os.isFamily("mac")) {
commandLine './build.sh'
} else {
throw RuntimeException("Not supported")
// FIXME not tested
commandLine 'cmd', '/C', 'start', 'build.bat'
// ugly workaround for https://github.com/gradle/gradle/issues/18716
commandLine 'cmd','/C','start','""','cmd','/K','".\\scripts\\build.bat && exit"'
}
}
task buildAndInstallVTL(type: Exec) {
dependsOn('buildVTL')
workingDir(projectDir.toPath().resolve("../smali").normalize().toString())
workingDir(projectDir.toPath().resolve("../scripts").normalize().toString())
ignoreExitValue true
if (Os.isFamily("unix") || Os.isFamily("mac")) {
commandLine 'bash', '-c', 'adb install VTLite.apk'
} else {
throw RuntimeException("Not supported")
// FIXME not tested
commandLine 'adb', 'install', 'VTLite.apk'
}
}
+7 -98
View File
@@ -11,32 +11,6 @@ setlocal
call :setESC
cls
echo.
echo %ESC%[1;4mBuild dex...%ESC%[0m
echo.
call gradlew clean
del app\src\main\assets\version.properties
del smali\assets\version.properties
call gradlew versionFile
call gradlew assembleRelease
if "%ERRORLEVEL%" == "0" (
echo %ESC%[92mSuccessful%ESC%[0m
) else (
echo %ESC%[31mFailed%ESC%[0m
exit /B 1
)
echo.
echo %ESC%[1;4mExport dex...%ESC%[0m
echo.
call gradlew exportDex
if "%ERRORLEVEL%" == "0" (
echo %ESC%[92mSuccessful%ESC%[0m
) else (
echo %ESC%[31mFailed%ESC%[0m
exit /B 1
)
echo.
echo %ESC%[1;4mMove dex6 to source dir...%ESC%[0m
echo.
@@ -45,7 +19,7 @@ if "%ERRORLEVEL%" == "0" (
echo %ESC%[92mSuccessful%ESC%[0m
) else (
echo %ESC%[31mFailed%ESC%[0m
exit /B 1
call :pauseThenExit
)
echo.
@@ -78,7 +52,7 @@ if "%ERRORLEVEL%" == "0" (
echo %ESC%[92mSuccessful%ESC%[0m
) else (
echo %ESC%[31mFailed%ESC%[0m
exit /B 1
call :pauseThenExit
)
del classes6.dex
del classes8.dex
@@ -92,81 +66,16 @@ if "%ERRORLEVEL%" == "0" (
echo %ESC%[92mSuccessful%ESC%[0m
) else (
echo %ESC%[31mFailed%ESC%[0m
exit /B 1
call :pauseThenExit
)
:startinstall
SET choice=
SET /p choice=Do you want to install APK?:
IF /i '%choice%'=='Y' GOTO yesinst
IF /i '%choice%'=='yes' GOTO yesinst
IF /i '%choice%'=='Yes' GOTO yesinst
IF /i '%choice%'=='y' GOTO yesinst
IF /i '%choice%'=='N' GOTO noinst
IF /i '%choice%'=='No' GOTO noinst
IF /i '%choice%'=='n' GOTO noinst
IF /i '%choice%'=='no' GOTO noinst
ECHO "%choice%" doesn't exist
ECHO.
GOTO startinstall
:yesinst
echo.
echo %ESC%[1;4mInstall apk...%ESC%[0m
echo.
call adb install ../scripts/VTLite.apk
if "%ERRORLEVEL%" == "0" (
echo %ESC%[92mSuccessful%ESC%[0m
) else (
echo %ESC%[31mFailed%ESC%[0m
exit /B 1
)
:noinst
:startapp
SET choice=
SET /p choice=Do you want to start app?:
IF /i '%choice%'=='Y' GOTO start
IF /i '%choice%'=='yes' GOTO start
IF /i '%choice%'=='Yes' GOTO start
IF /i '%choice%'=='y' GOTO start
IF /i '%choice%'=='N' GOTO skip
IF /i '%choice%'=='No' GOTO skip
IF /i '%choice%'=='n' GOTO skip
IF /i '%choice%'=='no' GOTO skip
ECHO "%choice%" doesn't exist
ECHO.
GOTO startapp
:start
echo.
echo %ESC%[1;4mOpen VTL...%ESC%[0m
echo.
call adb shell monkey -p com.vtosters.lite -c android.intent.category.LAUNCHER 1
if "%ERRORLEVEL%" == "0" (
echo %ESC%[92mSuccessful%ESC%[0m
) else (
echo %ESC%[31mFailed%ESC%[0m
exit /B 1
)
:skip
:setESC
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set ESC=%%b
exit /B 0
)
exit /B 0
exit
:pauseThenExit
pause
Exit /B 1
+3 -5
View File
@@ -5,8 +5,6 @@ NC='\033[0m'
BOLD='\033[1m'
UNDERLINE='\033[4m'
cd ../
echo -e "${BOLD}${UNDERLINE}Перенос dex6 в папку с исходным кодом..${NC}"
mv app/classes6.dex smali/
if [ $? -eq 0 ]; then
@@ -34,7 +32,7 @@ fi
echo -e "${BOLD}${UNDERLINE}Сборка apk..${NC}"
cd smali/
java -jar ../scripts/apktool.jar b . -o VTLite.apk --use-aapt2 -p ../scripts/framework/
java -jar ../scripts/apktool.jar b . -o ../scripts/VTLite.apk --use-aapt2 -p ../scripts/framework/
if [ $? -eq 0 ]; then
echo -e "${GREEN}Успех!${NC}\n"
else
@@ -44,14 +42,14 @@ fi
echo -e "\nПодписывание апк..."
cd ../scripts
./apksigner sign --ks debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android ../smali/VTLite.apk
./apksigner sign --ks debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android ../scripts/VTLite.apk
if [ $? -eq 0 ]; then
echo -e "${GREEN}Успех!${NC}"
else
echo -e "${RED}Провал.${NC}"
fi
echo -e "${BOLD}VTosters Lite успешно собран! APK находится в папке smali${NC}"
echo -e "${BOLD}VTosters Lite успешно собран! APK находится в папке scripts${NC}"
cd ../smali
rm classes6.dex