script cleanups & gradle stub for android studio

handle the env var setting for the sdl3 aar build script
This commit is contained in:
Kylie C 2025-08-12 18:19:40 -04:00
parent 68b6f20ff3
commit 44a6dae4cd
4 changed files with 17 additions and 10 deletions

View File

@ -113,11 +113,11 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
- name: Setup SDK (Android)
- name: Get CMake (Android)
if: ${{ matrix.android }}
uses: android-actions/setup-android@v3
uses: lukka/get-cmake@latest
with:
packages: 'cmake;3.30.5'
cmakeVersion: 3.30.5
- name: Build (Android)
if: ${{ matrix.android }}
@ -125,12 +125,12 @@ jobs:
cd android-project && \
./gradlew assembleRelease \
--info \
-PcmakeArgs="-DCMAKE_BUILD_TYPE=Release
-PcmakeArgs="-DCMAKE_BUILD_TYPE=Release \
-DISLE_USE_DX5=${{ !!matrix.dx5 }} \
-DISLE_BUILD_CONFIG=${{ !!matrix.config }} \
-DENABLE_CLANG_TIDY=${{ !!matrix.clang-tidy }} \
-DISLE_WERROR=${{ !!matrix.werror }} \
-DISLE_DEBUG=OFF \
-DISLE_DEBUG=${{ matrix.debug || 'OFF' }} \
-Werror=dev"
- name: Configure (CMake)

View File

@ -47,6 +47,16 @@ android {
}
}
afterEvaluate {
def androidPath = System.getenv("ANDROID_HOME") ?: android.sdkDirectory
def ndkPath = System.getenv("ANDROID_NDK_HOME") ?: android.ndkDirectory
tasks.named('compileSDL3AndroidArchive').configure {
environment "ANDROID_HOME", androidPath
environment "ANDROID_NDK_HOME", ndkPath
}
}
tasks.register('compileSDL3AndroidArchive', Exec) {
def rootDir = projectDir.parentFile
def sdl3Dir = "build/_deps/sdl3-src"
@ -55,7 +65,7 @@ tasks.register('compileSDL3AndroidArchive', Exec) {
"--actions android " +
"--fast " +
"--force " +
"--root='build/_deps/sdl3-src/'"
"--root='${sdl3Dir}'"
def mvCommand = "mv ${sdl3Dir}/build-android/SDL3-*.aar ${projectDir}/libs/SDL3.aar"
commandLine 'sh', '-c', "cd ${rootDir} && ${cmakeCommand} && ${pythonCommand} && mkdir -p ${projectDir}/libs/ && ${mvCommand}"

View File

@ -2,7 +2,3 @@ plugins {
id 'com.android.application' version '8.7.0' apply false
id 'com.android.library' version '8.7.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
includeBuild('android-project')