From cc533bda1aaa2ea7940458f9a2522fa027354b6b Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Thu, 17 Feb 2022 00:16:16 +0100 Subject: [PATCH 1/4] Autobuild: Allow overriding checkout's fetch-depth --- .github/workflows/autobuild.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index ae2ec97ebb..95bb831e9f 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -171,6 +171,7 @@ jobs: uses: actions/checkout@v2 with: submodules: true + fetch-depth: ${{ matrix.config.checkout_fetch_depth || '1' }} # Enable caching of downloaded dependencies - name: "Cache Mac dependencies" From 1afc082de264b6efcfe81b1f9c1ef36146b8c99c Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Tue, 15 Feb 2022 00:11:39 +0100 Subject: [PATCH 2/4] Android: Set ANDROID_VERSION_{CODE,NAME} android/AndroidManifest.xml uses specific macros (%%INSERT_VERSION...). Those macros are replaced by the ANDROID_VERSION_* qmake variables, which were previously unset and therefore defaulted to "1". This made it impossible to update the APK without uninstalling first. This commit populates these variables. The user-visible ANDROID_VERSION_NAME is set similar to VERSION for other platforms. The Android-internal ANDROID_VERSION_CODE is set to the number of git commits in the current branch. This seems to be the most straightforward solution which guarantees unique, increasing integers within the scope of the master branch. Feature branches will break this logic, so developers may still be required to uninstall/reinstall. In order to get the commit count, the autobuild Android logic had to be modified to fetch the repo in full depth instead of only the most-recent commit. Tested via `apktool d` and by checking `apktool.yml`. Related: #1760 --- .github/workflows/autobuild.yml | 1 + Jamulus.pro | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 95bb831e9f..4ef640fde1 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -99,6 +99,7 @@ jobs: cmd2_build: "./autobuild/android/autobuild_apk_2_build.sh" cmd3_postbuild: "./autobuild/android/autobuild_apk_3_copy_files.sh" uses_codeql: true + checkout_fetch_depth: '0' # Jamulus.pro needs to count git history length for android versioning - config_name: Linux (artifacts+codeQL) target_os: linux diff --git a/Jamulus.pro b/Jamulus.pro index 51c0341d11..226b74e7ad 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -203,6 +203,10 @@ win32 { LIBS += -framework AVFoundation \ -framework AudioToolbox } else:android { + ANDROID_VERSION_NAME = $$VERSION + ANDROID_VERSION_CODE = $$system(git log --oneline | wc -l) + message("Setting ANDROID_VERSION_NAME=$${ANDROID_VERSION_NAME} ANDROID_VERSION_CODE=$${ANDROID_VERSION_CODE}") + # we want to compile with C++14 CONFIG += c++14 From b49dec456ef915b5504cc9e5c4212d6aead98fad Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Thu, 17 Feb 2022 00:26:25 +0100 Subject: [PATCH 3/4] Jamulus.pro: Move ANDROID_ABIS to conditional The variable was set globally, but is only required for the Android target. Git history does not show a specific reason for placing it globally (a3558aa61). --- Jamulus.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jamulus.pro b/Jamulus.pro index 226b74e7ad..7602c38083 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -203,6 +203,7 @@ win32 { LIBS += -framework AVFoundation \ -framework AudioToolbox } else:android { + ANDROID_ABIS = armeabi-v7a arm64-v8a x86 x86_64 ANDROID_VERSION_NAME = $$VERSION ANDROID_VERSION_CODE = $$system(git log --oneline | wc -l) message("Setting ANDROID_VERSION_NAME=$${ANDROID_VERSION_NAME} ANDROID_VERSION_CODE=$${ANDROID_VERSION_CODE}") @@ -1170,5 +1171,3 @@ contains(CONFIG, "disable_version_check") { message(The version check is disabled.) DEFINES += DISABLE_VERSION_CHECK } - -ANDROID_ABIS = armeabi-v7a arm64-v8a x86 x86_64 From 079a52a35b7c2d63491e0d42fca68097a41d9ed1 Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Thu, 17 Feb 2022 00:28:04 +0100 Subject: [PATCH 4/4] Jamulus.pro: Use DISTFILES for AndroidManifest.xml Official docs suggest using DISTFILES: https://doc.qt.io/qt-5/deployment-android.html OTHER_FILES is undocumented, while DISTFILES is. https://doc.qt.io/qt-5/qmake-variable-reference.html#distfiles https://stackoverflow.com/questions/38102160/in-qt-when-should-you-use-resources-vs-distfiles-vs-other-files/38102991#38102991 --- Jamulus.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jamulus.pro b/Jamulus.pro index 7602c38083..9afc875aba 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -226,7 +226,7 @@ win32 { LIBS += -lOpenSLES ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - OTHER_FILES += android/AndroidManifest.xml + DISTFILES += android/AndroidManifest.xml # if compiling for android you need to use Oboe library which is included as a git submodule # make sure you git pull with submodules to pull the latest Oboe library