Android: Make SDK detection its own qmake feature
To allow reusing the logic which detects the appropriate Android SDK version to use for building the Java code, this is now separated into its own .prf file. This is required by Qt Purchasing to avoid duplicating the logic there. Change-Id: Ief5f5e70dab79751ef9e5a9c4a019bfda686cd09 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
parent
7ba9863e32
commit
3010c38713
21
mkspecs/features/android/sdk.prf
Normal file
21
mkspecs/features/android/sdk.prf
Normal file
@ -0,0 +1,21 @@
|
||||
API_VERSION_TO_USE = $$(ANDROID_API_VERSION)
|
||||
isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = $$API_VERSION
|
||||
isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = android-16
|
||||
|
||||
ANDROID_JAR_FILE = $$ANDROID_SDK_ROOT/platforms/$$API_VERSION_TO_USE/android.jar
|
||||
!exists($$ANDROID_JAR_FILE) {
|
||||
ANDROID_API_VERSION = $$section(API_VERSION_TO_USE, -, 1, 1) # Get version number from android-XY to ensure numeric comparison
|
||||
ANDROID_API_VERSIONS = $$files($$ANDROID_SDK_ROOT/platforms/*)
|
||||
for (VERSION, ANDROID_API_VERSIONS) {
|
||||
BASENAME = $$basename(VERSION)
|
||||
BASENAME = $$section(BASENAME, -, 1, 1)
|
||||
greaterThan(BASENAME, $$ANDROID_API_VERSION): ANDROID_API_VERSION = $$BASENAME
|
||||
}
|
||||
API_VERSION_TO_USE = android-$$ANDROID_API_VERSION
|
||||
ANDROID_JAR_FILE = $$ANDROID_SDK_ROOT/platforms/$$API_VERSION_TO_USE/android.jar
|
||||
}
|
||||
!exists($$ANDROID_JAR_FILE) {
|
||||
error("No suitable Android SDK platform found. Minimum version is $${API_VERSION_TO_USE}.")
|
||||
}
|
||||
JAVACLASSPATH += $$ANDROID_JAR_FILE
|
||||
|
@ -1,25 +1,6 @@
|
||||
TEMPLATE = lib
|
||||
android {
|
||||
API_VERSION_TO_USE = $$(ANDROID_API_VERSION)
|
||||
isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = $$API_VERSION
|
||||
isEmpty(API_VERSION_TO_USE): API_VERSION_TO_USE = android-16
|
||||
|
||||
ANDROID_JAR_FILE = $$ANDROID_SDK_ROOT/platforms/$$API_VERSION_TO_USE/android.jar
|
||||
!exists($$ANDROID_JAR_FILE) {
|
||||
ANDROID_API_VERSION = $$section(API_VERSION_TO_USE, -, 1, 1) # Get version number from android-XY to ensure numeric comparison
|
||||
ANDROID_API_VERSIONS = $$files($$ANDROID_SDK_ROOT/platforms/*)
|
||||
for (VERSION, ANDROID_API_VERSIONS) {
|
||||
BASENAME = $$basename(VERSION)
|
||||
BASENAME = $$section(BASENAME, -, 1, 1)
|
||||
greaterThan(BASENAME, $$ANDROID_API_VERSION): ANDROID_API_VERSION = $$BASENAME
|
||||
}
|
||||
API_VERSION_TO_USE = android-$$ANDROID_API_VERSION
|
||||
ANDROID_JAR_FILE = $$ANDROID_SDK_ROOT/platforms/$$API_VERSION_TO_USE/android.jar
|
||||
}
|
||||
!exists($$ANDROID_JAR_FILE) {
|
||||
error("No suitable Android SDK platform found. Minimum version is $${API_VERSION_TO_USE}.")
|
||||
}
|
||||
JAVACLASSPATH += $$ANDROID_JAR_FILE
|
||||
load(sdk)
|
||||
|
||||
# FIXME: This is a hack to work around some hardcoded values in the android.prf. The
|
||||
# android.prf should be fixed and this should be removed.
|
||||
|
Loading…
Reference in New Issue
Block a user