updated java to 21 added some local .bat builds

This commit is contained in:
izzy2lost
2025-10-22 03:59:08 -04:00
parent 50c2003e0f
commit fa305ae1a2
6 changed files with 261 additions and 7 deletions
+1 -1
View File
@@ -259,7 +259,7 @@ jobs:
EMULATOR_VERSION_MAJOR: ${{ inputs.next_version_major }}
EMULATOR_VERSION_MINOR: ${{ inputs.next_version_minor }}
run: |
export JAVA_HOME=$JAVA_HOME_17_X64
export JAVA_HOME=$JAVA_HOME_21_X64
cd ./src/android
+3 -3
View File
@@ -13,11 +13,11 @@ jobs:
with:
submodules: recursive
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
- name: Install CMake
run: |
@@ -143,7 +143,7 @@ jobs:
### Requirements:
- Android NDK r28 (or compatible version)
- CMake 3.25+
- Java 17+
- Java 21+
### Troubleshooting:
+1
View File
@@ -56,3 +56,4 @@ bin/graphicPacks/*
# Ignore Finder view option files created by OS X
.DS_Store
.kilocode/mcp.json
vcpkg-android-arm64.tar.gz
+196
View File
@@ -0,0 +1,196 @@
@echo off
setlocal enabledelayedexpansion
echo ========================================
echo Wee U Android Build Script
echo ========================================
echo.
REM Check if we're in the right directory
if not exist "src\android" (
echo ERROR: src\android directory not found!
echo Please run this script from the root of the WeeU repository.
pause
exit /b 1
)
REM Check if vcpkg dependencies are installed
if not exist "dependencies\vcpkg\installed\arm64-android" (
echo WARNING: vcpkg dependencies not found at dependencies\vcpkg\installed\arm64-android
echo.
echo Please ensure you have extracted the vcpkg dependencies:
echo 1. Run the GitHub Actions workflow "Build vcpkg Android Dependencies"
echo 2. Download the vcpkg-android-arm64.tar.gz artifact
echo 3. Extract it: tar -xzf vcpkg-android-arm64.tar.gz -C dependencies\vcpkg\
echo.
set /p CONTINUE="Continue anyway? (y/N): "
if /i not "!CONTINUE!"=="y" (
echo Build cancelled.
pause
exit /b 1
)
)
REM Check for gettext (msgfmt/msgunfmt)
where msgunfmt >nul 2>&1
if errorlevel 1 (
echo WARNING: msgunfmt not found in PATH
echo Translation files will not be processed.
echo.
echo To install gettext on Windows:
echo - Using Chocolatey: choco install gettext
echo - Using Scoop: scoop install gettext
echo - Or download from: https://mlocati.github.io/articles/gettext-iconv-windows.html
echo.
set SKIP_TRANSLATIONS=1
) else (
set SKIP_TRANSLATIONS=0
)
REM Process translation files
if "!SKIP_TRANSLATIONS!"=="0" (
echo.
echo ========================================
echo Processing translation files...
echo ========================================
for /d %%L in (bin\resources\*) do (
if exist "%%L\cemu.mo" (
set "language_code=%%~nxL"
set "po_file=src\android\app\src\main\assets\translations\!language_code!\cemu.po"
echo Processing !language_code!...
if not exist "src\android\app\src\main\assets\translations\!language_code!" (
mkdir "src\android\app\src\main\assets\translations\!language_code!"
)
msgunfmt "%%L\cemu.mo" -o "!po_file!" 2>nul
if errorlevel 1 (
echo WARNING: Failed to process %%L\cemu.mo
) else (
echo Created !po_file!
)
)
)
echo Translation processing complete.
) else (
echo Skipping translation processing.
)
REM Set version if provided
set VERSION_MAJOR=%1
set VERSION_MINOR=%2
if not "!VERSION_MAJOR!"=="" (
if not "!VERSION_MINOR!"=="" (
echo.
echo Building version !VERSION_MAJOR!.!VERSION_MINOR!
set "EMULATOR_VERSION_MAJOR=!VERSION_MAJOR!"
set "EMULATOR_VERSION_MINOR=!VERSION_MINOR!"
)
)
REM Check for Java 21
echo.
echo ========================================
echo Checking Java version...
echo ========================================
java -version 2>&1 | findstr /i "version" >nul
if errorlevel 1 (
echo ERROR: Java not found in PATH
echo The build requires Java 21 or higher.
pause
exit /b 1
)
REM Check if Java 21 or higher
for /f "tokens=3" %%v in ('java -version 2>&1 ^| findstr /i "version"') do (
set JAVA_VERSION=%%v
set JAVA_VERSION=!JAVA_VERSION:"=!
for /f "tokens=1 delims=." %%a in ("!JAVA_VERSION!") do set JAVA_MAJOR=%%a
)
if !JAVA_MAJOR! LSS 21 (
echo WARNING: Java !JAVA_MAJOR! detected. Java 21 or higher is recommended.
echo.
set /p CONTINUE="Continue anyway? (y/N): "
if /i not "!CONTINUE!"=="y" (
echo Build cancelled.
pause
exit /b 1
)
) else (
echo Java !JAVA_MAJOR! detected.
)
REM Build the Android app
echo.
echo ========================================
echo Building Android APK...
echo ========================================
echo.
cd src\android
REM Clean previous builds (optional)
set /p CLEAN="Clean previous builds? (y/N): "
if /i "!CLEAN!"=="y" (
echo Cleaning...
call gradlew.bat clean
)
echo.
echo Building Release APK...
call gradlew.bat assembleRelease
if errorlevel 1 (
echo.
echo ========================================
echo BUILD FAILED!
echo ========================================
cd ..\..
pause
exit /b 1
)
echo.
echo ========================================
echo Running tests...
echo ========================================
call gradlew.bat testRelease
if errorlevel 1 (
echo.
echo WARNING: Tests failed!
echo The APK was built but tests did not pass.
)
cd ..\..
echo.
echo ========================================
echo BUILD SUCCESSFUL!
echo ========================================
echo.
echo APK files are located at:
echo src\android\app\build\outputs\apk\release\app-release.apk
echo src\android\app\build\outputs\apk\debug\app-debug.apk
echo.
REM List the APK files
if exist "src\android\app\build\outputs\apk\release\*.apk" (
echo Release APK:
dir /b "src\android\app\build\outputs\apk\release\*.apk"
echo.
)
if exist "src\android\app\build\outputs\apk\debug\*.apk" (
echo Debug APK:
dir /b "src\android\app\build\outputs\apk\debug\*.apk"
echo.
)
echo Build complete!
pause
+57
View File
@@ -0,0 +1,57 @@
@echo off
REM Simple Android build script for Wee U
REM Requires: Java 21+, Android SDK/NDK
REM Usage: build_android_simple.bat [version_major] [version_minor]
REM Example: build_android_simple.bat 2 1
setlocal enabledelayedexpansion
echo Building Wee U for Android...
echo.
REM Quick Java check
java -version >nul 2>&1
if errorlevel 1 (
echo ERROR: Java not found in PATH
exit /b 1
)
echo.
REM Set version if provided
if not "%1"=="" (
if not "%2"=="" (
set "EMULATOR_VERSION_MAJOR=%1"
set "EMULATOR_VERSION_MINOR=%2"
echo Building version %1.%2
)
)
REM Process translations if msgunfmt is available
where msgunfmt >nul 2>&1
if not errorlevel 1 (
echo Processing translations...
for /d %%L in (bin\resources\*) do (
if exist "%%L\cemu.mo" (
set "language_code=%%~nxL"
if not exist "src\android\app\src\main\assets\translations\!language_code!" mkdir "src\android\app\src\main\assets\translations\!language_code!"
msgunfmt "%%L\cemu.mo" -o "src\android\app\src\main\assets\translations\!language_code!\cemu.po" 2>nul
)
)
)
REM Build
cd src\android
call gradlew.bat assembleRelease
set BUILD_RESULT=%ERRORLEVEL%
if %BUILD_RESULT% equ 0 (
echo.
echo Build successful!
echo APK: src\android\app\build\outputs\apk\release\app-release.apk
) else (
echo.
echo Build failed with error code %BUILD_RESULT%
)
cd ..\..
exit /b %BUILD_RESULT%
+3 -3
View File
@@ -102,8 +102,8 @@ android {
}
compileOptions {
sourceCompatibility(JavaVersion.VERSION_17)
targetCompatibility(JavaVersion.VERSION_17)
sourceCompatibility(JavaVersion.VERSION_21)
targetCompatibility(JavaVersion.VERSION_21)
}
externalNativeBuild {
@@ -151,7 +151,7 @@ android {
}
kotlinOptions {
jvmTarget = "17"
jvmTarget = "21"
}
}