From 816aa85b969bdb273bd9cbebcc08936179f738bb Mon Sep 17 00:00:00 2001 From: Remek Zajac Date: Mon, 17 Aug 2020 22:18:22 +0200 Subject: [PATCH] Do no duplicate AndroidManifest.xml, yet allow supplying it and the java sources --- android.pri | 17 ++-- android/AndroidManifest.xml | 1 + custom-example/android/AndroidManifest.xml | 84 ------------------- .../qgroundcontrol/CustomQGCActivity.java | 5 -- custom-example/custom.pri | 1 + 5 files changed, 12 insertions(+), 96 deletions(-) delete mode 100644 custom-example/android/AndroidManifest.xml delete mode 100644 custom-example/android/src/org/custom/qgroundcontrol/CustomQGCActivity.java diff --git a/android.pri b/android.pri index 83f574f22..2355bc934 100644 --- a/android.pri +++ b/android.pri @@ -3,17 +3,20 @@ message("Adding Serial Java Classes") QT += androidextras ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + exists($$PWD/custom/android) { message("Merging $$PWD/custom/android/ -> $$PWD/android/") + ANDROID_PACKAGE_SOURCE_DIR = $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR + android_source_dir_target.target = android_source_dir + PRE_TARGETDEPS += $$android_source_dir_target.target + QMAKE_EXTRA_TARGETS += android_source_dir_target - javaforce.target = custom_android - javaforce.commands = $$QMAKE_MKDIR $$ANDROID_PACKAGE_SOURCE_DIR && \ - $$QMAKE_COPY_DIR $$PWD/android/* $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR && \ - $$QMAKE_COPY_DIR $$PWD/custom/android/* $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR - javaforce.depends = FORCE - PRE_TARGETDEPS += $$javaforce.target - QMAKE_EXTRA_TARGETS += javaforce + android_source_dir_target.commands = $$QMAKE_MKDIR $$ANDROID_PACKAGE_SOURCE_DIR && \ + $$QMAKE_COPY_DIR $$PWD/android/* $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR && \ + $$QMAKE_COPY_DIR $$PWD/custom/android/* $$OUT_PWD/ANDROID_PACKAGE_SOURCE_DIR && \ + $$QMAKE_STREAM_EDITOR -i \"s/package="org.mavlink.qgroundcontrol"/package=\"$$QGC_ORG_DOMAIN.qgroundcontrol\"/\" $$ANDROID_PACKAGE_SOURCE_DIR/AndroidManifest.xml + android_source_dir_target.depends = FORCE } exists($$PWD/custom/android/AndroidManifest.xml) { diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 46bebf0fa..c3571cac7 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -82,3 +82,4 @@ + diff --git a/custom-example/android/AndroidManifest.xml b/custom-example/android/AndroidManifest.xml deleted file mode 100644 index e6a349cb5..000000000 --- a/custom-example/android/AndroidManifest.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/custom-example/android/src/org/custom/qgroundcontrol/CustomQGCActivity.java b/custom-example/android/src/org/custom/qgroundcontrol/CustomQGCActivity.java deleted file mode 100644 index c224ea748..000000000 --- a/custom-example/android/src/org/custom/qgroundcontrol/CustomQGCActivity.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.custom.qgroundcontrol; - -import org.mavlink.qgroundcontrol.QGCActivity; - -public class CustomQGCActivity extends QGCActivity {} diff --git a/custom-example/custom.pri b/custom-example/custom.pri index c5325f553..cc233b283 100644 --- a/custom-example/custom.pri +++ b/custom-example/custom.pri @@ -45,6 +45,7 @@ QGC_APP_NAME = "Custom QGroundControl" QGC_BINARY_NAME = "CustomQGroundControl" QGC_ORG_NAME = "Custom" QGC_ORG_DOMAIN = "org.custom" +QGC_ANDROID_PACKAGE = "org.custom.qgroundcontrol" QGC_APP_DESCRIPTION = "Custom QGroundControl" QGC_APP_COPYRIGHT = "Copyright (C) 2020 QGroundControl Development Team. All rights reserved." -- 2.22.0