Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Auto-generate version variables for build.gradle

Dmitry Kazakov2079dbca3582
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9ba1164d8..b043aca39c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -152,6 +152,12 @@ set(KRITA_VERSION_RELEASE 0)
# - Stable: Set to 100, bump to 101 if emergency update is needed
set(KRITA_VERSION_REVISION 0)
+# This version does **not** correspond to the patch version
+# of Krita. Instead, it is just incremented for every public
+# (including alpha and beta) release of KRITA_STABLE_VERSION_MINOR
+# branch
+set(KRITA_APK_VERSION_TRANSITIONAL 0)
+
# In MSI packages we cannot use the fourth digit for release numbering,
# since this digit is used by Microsoft Store internally. Hence we cannot
# release hotfix releases (like 6.0.1.1, 6.0.1.2) on Windows. Therefore we
@@ -1747,6 +1753,12 @@ if (ANDROID)
endif()
if(DEFINED QTANDROID_EXPORTED_TARGET AND NOT TARGET "create-apk")
+ # we don't need to add an explicit dependency to create-apk-krita,
+ # because ecm_androiddeployqt repopulates the project directory
+ # every time unconditionally
+ configure_file(${CMAKE_SOURCE_DIR}/packaging/android/apk/version.properties.in
+ ${CMAKE_SOURCE_DIR}/packaging/android/apk/version.properties)
+
set (_CMAKE_ANDROID_DIR "${ECM_DIR}/../toolchain")
list(LENGTH QTANDROID_EXPORTED_TARGET targetsCount)
include(${_CMAKE_ANDROID_DIR}/ECMAndroidDeployQt.cmake)
diff --git a/build-tools/ci-scripts/build-android-package.py b/build-tools/ci-scripts/build-android-package.py
index 0f8bcac48c..50742f23c0 100644
--- a/build-tools/ci-scripts/build-android-package.py
+++ b/build-tools/ci-scripts/build-android-package.py
@@ -144,7 +144,8 @@ if arguments.archive_artifacts:
'build.gradle',
'gradlew',
'gradle.properties',
- 'local.properties',]
+ 'local.properties',
+ 'version.properties']
for file in files:
shutil.move(os.path.join(repackagePath, file),
diff --git a/packaging/android/apk/.gitignore b/packaging/android/apk/.gitignore
new file mode 100644
index 0000000000..6015eb7ac9
--- /dev/null
+++ b/packaging/android/apk/.gitignore
@@ -0,0 +1 @@
+version.properties
\ No newline at end of file
diff --git a/packaging/android/apk/build.gradle b/packaging/android/apk/build.gradle
index be3b33441a..56ed9acb50 100644
--- a/packaging/android/apk/build.gradle
+++ b/packaging/android/apk/build.gradle
@@ -35,6 +35,15 @@ ext {
// tldr; at one time, either qt5AndroidDir or qtResPath is valid and points
// to the same files
qtResPath = System.getenv('KRITA_BUILD_APPBUNDLE') ? 'extra-bundle-deps/android/java' : ""
+
+ props = new Properties().tap {
+ def propsFile = file('version.properties')
+ if (propsFile.exists()) {
+ load(propsFile.newInputStream())
+ } else {
+ throw new FileNotFoundException('version.properties file is not found!')
+ }
+ }
}
tasks.register('configure') {
@@ -189,8 +198,8 @@ android {
project.ext.constant = 5
- def versionMajor = 5
- def versionMinor = 4
+ def versionMajor = project.ext.props['versionMajor'].toInteger()
+ def versionMinor = project.ext.props['versionMinor'].toInteger()
/**
* This version does **not** correspond to the patch version
@@ -198,7 +207,7 @@ android {
* (including alpha and beta) release of versionMajor.versionMinor
* branch
*/
- def versionRelease = 0
+ def versionRelease = project.ext.props['apkVersionTransitional'].toInteger()
defaultConfig {
compileSdk androidCompileSdkVersion.toInteger()
@@ -213,7 +222,7 @@ android {
targetSdkVersion 36
minSdkVersion 24
versionCode project.ext.constant * 1000000 + versionMajor * 10000 + versionMinor * 100 + versionRelease
- versionName "5.4.0-prealpha"
+ versionName project.ext.props['versionString']
def unstableSuffix = System.getenv('KRITA_UNSTABLE_PACKAGE_SUFFIX')
archivesBaseName = System.getenv('KRITA_BUILD_APPBUNDLE') ? "krita-$versionName$unstableSuffix" : "krita-$abi-$versionName$unstableSuffix"
}
diff --git a/packaging/android/apk/version.properties.in b/packaging/android/apk/version.properties.in
new file mode 100644
index 0000000000..21b0b35e45
--- /dev/null
+++ b/packaging/android/apk/version.properties.in
@@ -0,0 +1,7 @@
+# this file is autogenerated from version.properties.in,
+# do not edit!
+
+versionString=${KRITA_VERSION_STRING}
+versionMajor=${KRITA_STABLE_VERSION_MAJOR}
+versionMinor=${KRITA_STABLE_VERSION_MINOR}
+apkVersionTransitional=${KRITA_APK_VERSION_TRANSITIONAL}