summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2020-09-11 11:07:44 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-09-16 22:45:37 +0000
commit11cd29687c4e338f12112819d6eed28243b0394b (patch)
treeed95fa64fea5cbdfaf97d0b4725e7bc9a7aa1c95
parent09d79fb103dbe41da242a55e3dffc29793b03fe1 (diff)
Android: allow setting javac build version from the configure script
The configure options -android-javac-source and -android-javac-target can be used to set the version numbers. Fixes: QTBUG-86282 Change-Id: I36b0665de2c31e16bf6d138859b5503455eb8e66 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit 675805e9eb0dc68a6e96622353073fd54161bdaf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-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 d9ff8e598e..bce61577e7 100644
--- a/config_help.txt
+++ b/config_help.txt
@@ -207,6 +207,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 50d69b740d..c273aeeef1 100644
--- a/configure.json
+++ b/configure.json
@@ -56,6 +56,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 3dedffcace..49755f7abf 100644
--- a/configure.pri
+++ b/configure.pri
@@ -629,12 +629,17 @@ defineTest(qtConfOutput_prepareOptions) {
isEmpty(platform): \
platform = android-21
+ 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