mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-07 01:53:24 +09:00
Build: -Pmobilegl.androidApi=29 builds a separate API 29 library and plugin; the default stays 26.
This commit is contained in:
+7
-4
@@ -118,12 +118,15 @@ if (ANDROID)
|
||||
"(gradle builds get this from minSdk ${MOBILEGL_ANDROID_API_LEVEL}, so "
|
||||
"check that minSdk instead of adding an override).")
|
||||
elseif (_mobilegl_android_api GREATER MOBILEGL_ANDROID_API_LEVEL)
|
||||
# A higher level is a separate artifact of the SAME source (gradle -Pmobilegl.androidApi=29:
|
||||
# native ELF TLS instead of emulated TLS). Any post-${MOBILEGL_ANDROID_API_LEVEL} API use must
|
||||
# sit behind a compile-time __ANDROID_API__ gate and never replace the API
|
||||
# ${MOBILEGL_ANDROID_API_LEVEL} path; the minSdk-${MOBILEGL_ANDROID_API_LEVEL} build stays the
|
||||
# enforcing compile.
|
||||
message(STATUS
|
||||
"MobileGL: configuring at Android API ${_mobilegl_android_api} "
|
||||
"(> shipping minimum ${MOBILEGL_ANDROID_API_LEVEL}). Allowed, but the "
|
||||
"tree must not use post-${MOBILEGL_ANDROID_API_LEVEL} APIs - the "
|
||||
"minSdk-${MOBILEGL_ANDROID_API_LEVEL} gradle build is the enforcing "
|
||||
"compile.")
|
||||
"(> shipping minimum ${MOBILEGL_ANDROID_API_LEVEL}): a separate artifact; "
|
||||
"post-${MOBILEGL_ANDROID_API_LEVEL} APIs only behind a compile-time __ANDROID_API__ gate.")
|
||||
endif()
|
||||
|
||||
message(STATUS "MobileGL: Android API level ${_mobilegl_android_api}")
|
||||
|
||||
@@ -52,6 +52,12 @@ fun Project.mobileGlDisaggregatedEnabled(): Boolean {
|
||||
fun Project.mobileGlApplicationIdSuffix(): String =
|
||||
(findProperty("mobilegl.applicationIdSuffix") ?: "").toString().trim()
|
||||
|
||||
// The Android API level of the build (the library's build.gradle reads the same property). Above
|
||||
// the shipped 26 the APK is a separate artifact: it gets an ".apiNN" id suffix and "-apiNN" version
|
||||
// suffix unless an explicit application-id suffix is given, so both installs can coexist.
|
||||
fun Project.mobileGlAndroidApi(): Int =
|
||||
(findProperty("mobilegl.androidApi") ?: System.getenv("MOBILEGL_ANDROID_API") ?: "26").toString().trim().toInt()
|
||||
|
||||
fun Project.runGit(vararg arguments: String): String? = runCatching {
|
||||
ProcessBuilder("git", *arguments)
|
||||
.directory(rootDir)
|
||||
@@ -123,8 +129,11 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "top.mobilegl.plugin"
|
||||
mobileGlApplicationIdSuffix().takeIf { it.isNotEmpty() }?.let { applicationIdSuffix = it }
|
||||
minSdk = 26
|
||||
val androidApi = mobileGlAndroidApi()
|
||||
val idSuffix = mobileGlApplicationIdSuffix().ifEmpty { if (androidApi > 26) ".api$androidApi" else "" }
|
||||
idSuffix.takeIf { it.isNotEmpty() }?.let { applicationIdSuffix = it }
|
||||
if (androidApi > 26) versionNameSuffix = "-api$androidApi"
|
||||
minSdk = androidApi
|
||||
targetSdk = 34
|
||||
versionCode = mobileGlVersionMajor * 1_000_000 + mobileGlVersionMinor * 10_000 + mobileGlMonthlyRevision
|
||||
versionName = "%d.%02d.%s".format(mobileGlVersionMajor, mobileGlVersionMinor, mobileGlGitShortHash)
|
||||
|
||||
+8
-1
@@ -51,6 +51,13 @@ def mobileGlBuildDisaggregated = {
|
||||
def mobileGlEnableLto = {
|
||||
(rootProject.findProperty('mobilegl.enableLto') ?: System.getenv('MOBILEGL_ENABLE_LTO') ?: 'ON') as String
|
||||
}
|
||||
// The Android API level the library is built for: minSdk, and with it the NDK's ANDROID_PLATFORM.
|
||||
// 26 is the shipped build. 29 is a SEPARATE artifact (its own library, plugin APK and FCL-embedded
|
||||
// copy, never selected at load time): at 29 the NDK uses native ELF TLS instead of emulated TLS.
|
||||
// -Pmobilegl.androidApi=29 (or MOBILEGL_ANDROID_API=29) selects it; the source is the same.
|
||||
def mobileGlAndroidApi = {
|
||||
(rootProject.findProperty('mobilegl.androidApi') ?: System.getenv('MOBILEGL_ANDROID_API') ?: '26') as String
|
||||
}
|
||||
def mobileGlBuildDisaggregatedInproc = {
|
||||
(rootProject.findProperty('mobilegl.buildDisaggregatedInproc') ?: System.getenv('MOBILEGL_BUILD_DISAGGREGATED_INPROC') ?: mobileGlBuildDisaggregated()) as String
|
||||
}
|
||||
@@ -60,7 +67,7 @@ android {
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
minSdk 26
|
||||
minSdk Integer.parseInt(mobileGlAndroidApi())
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user