Commit e96636c6 authored by Volker Krause's avatar Volker Krause
Browse files

Set the APK version based on what is defined in CMake

Most of the existing solutions we have do this by patching the manifest in
the source directory, due to what androiddeployqt expects. This approach
uses Gradle's built-in mechanisms instead, which basically gives us a
hook into the middle of androiddeployqt's processing. To pass values from
CMake to Gradle we use a file we can include in the build.gradle file and
that we place next to androiddeployqt's working directory.

This also does the automatic version code bumping via Gradle that is
currently done by the nightly build script on binary factory, as we need
the same for all other builds as well.
parent d9d2bafb
......@@ -95,6 +95,8 @@ if (ANDROID)
OpenSSL::SSL
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/version.gradle.in ${CMAKE_BINARY_DIR}/version.gradle)
kirigami_package_breeze_icons(ICONS
application-pdf
channel-insecure-symbolic
......
......@@ -7,8 +7,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.kde.itinerary"
android:versionName="0.0.1"
android:versionCode="1"
android:versionName="${versionName}"
android:versionCode="${versionCode}"
android:installLocation="auto">
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
......
......@@ -23,6 +23,8 @@ repositories {
apply plugin: 'com.android.application'
apply from: '../version.gradle'
def timestamp = (int)(new Date().getTime()/1000)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
......@@ -73,6 +75,7 @@ android {
defaultConfig {
minSdkVersion qtMinSdkVersion
targetSdkVersion qtTargetSdkVersion
manifestPlaceholders = [versionName: projectVersionFull, versionCode: timestamp]
}
packagingOptions {
......
// SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
// SPDX-License-Identifier: BSD-3-Clause
ext {
projectVersionFull = "@PROJECT_VERSION@"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment