summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config_help.txt2
-rw-r--r--configure.json2
-rw-r--r--configure.pri7
-rw-r--r--mkspecs/features/java.prf11
4 files changed, 20 insertions, 2 deletions
diff --git a/config_help.txt b/config_help.txt
index 2cb34865bf..7b918a7511 100644
--- a/config_help.txt
+++ b/config_help.txt
@@ -210,6 +210,8 @@ Build environment:
[$ANDROID_NDK_HOST]
-android-abis ....... Comma separated Android abis, default is:
armeabi-v7a,arm64-v8a,x86,x86_64
+ -android-javac-target Set the javac build target version [7]
+ -android-javac-source Set the javac build source version [7]
-android-style-assets Automatically extract style assets from the device at
run time. This option makes the Android style behave
correctly, but also makes the Android platform plugin
diff --git a/configure.json b/configure.json
index 6f62600090..4b339cf2ae 100644
--- a/configure.json
+++ b/configure.json
@@ -55,6 +55,8 @@
"android-ndk-host": "string",
"android-ndk-platform": "string",
"android-sdk": "string",
+ "android-javac-target": "string",
+ "android-javac-source": "string",
"android-style-assets": "boolean",
"appstore-compliant": "boolean",
diff --git a/configure.pri b/configure.pri
index bd282df0aa..a04aa17236 100644
--- a/configure.pri
+++ b/configure.pri
@@ -627,12 +627,17 @@ defineTest(qtConfOutput_prepareOptions) {
isEmpty(platform): \
platform = android-23
+ android_javac_target = $$eval(config.input.android-javac-target)
+ android_javac_source = $$eval(config.input.android-javac-source)
+
$${currentConfig}.output.devicePro += \
"DEFAULT_ANDROID_SDK_ROOT = $$val_escape(sdk_root)" \
"DEFAULT_ANDROID_NDK_ROOT = $$val_escape(ndk_root)" \
"DEFAULT_ANDROID_PLATFORM = $$platform" \
"DEFAULT_ANDROID_NDK_HOST = $$ndk_host" \
- "DEFAULT_ANDROID_ABIS = $$split(android_abis, ',')"
+ "DEFAULT_ANDROID_ABIS = $$split(android_abis, ',')" \
+ "ANDROID_JAVAC_TARGET_VERSION = $$android_javac_target" \
+ "ANDROID_JAVAC_SOURCE_VERSION = $$android_javac_source"
}
export($${currentConfig}.output.devicePro)
diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf
index 1d52f05e52..20dc719699 100644
--- a/mkspecs/features/java.prf
+++ b/mkspecs/features/java.prf
@@ -20,7 +20,16 @@ CONFIG += plugin no_plugin_name_prefix
javac.input = JAVASOURCES
javac.output = $$CLASS_DIR
javac.CONFIG += combine
-javac.commands = javac -source 7 -target 7 -Xlint:unchecked -bootclasspath $$ANDROID_JAR_FILE -cp $$shell_quote($$system_path($$join(JAVACLASSPATH, $$DIRLIST_SEPARATOR))) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
+
+# Check for user defined javac build version
+javac_target_version = $$ANDROID_JAVAC_TARGET_VERSION
+isEmpty(javac_target_version): javac_target_version = 7
+
+javac_source_version = $$ANDROID_JAVAC_SOURCE_VERSION
+isEmpty(javac_source_version): javac_source_version = 7
+
+javac.commands = javac -source $$javac_source_version -target $$javac_target_version -Xlint:unchecked -bootclasspath $$ANDROID_JAR_FILE -cp $$shell_quote($$system_path($$join(JAVACLASSPATH, $$DIRLIST_SEPARATOR))) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
+
# Force rebuild every time, because we don't know the paths of the destination files
# as they depend on the code.
javac.depends = FORCE