The open source OpenXR runtime

gradle: Upgrade gradle and packages

* Upgrades the gradle version (using AGP upgrade assistant)
* Upgrades android package dependencies to latest versions (using project settings upgrade tool)
* Bump compile platform SDK level to 34 (required for package updates)
* Bump java src compatibility version (required for api level 34)
* Fix deprecated warnings
* Code compile fixes to account for package changes
* explicitly specify cmake version
* bump NDK to latest LTS version

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2270>

authored by

Korcan Hussein and committed by
Marge Bot
ae37c1bf 9e46337a

+82 -45
+1 -1
.gitlab-ci.yml
··· 138 138 .monado.variables.debian:bookworm-ndk: 139 139 variables: 140 140 FDO_DISTRIBUTION_VERSION: "bookworm" 141 - FDO_DISTRIBUTION_TAG: "2024-01-16" 141 + FDO_DISTRIBUTION_TAG: "2024-07-02" 142 142 FDO_REPO_SUFFIX: ndk 143 143 144 144 # Variables for build and usage of Ubuntu focal image
+1
.gitlab-ci/ci-scripts.mk
··· 9 9 .gitlab-ci/distributions \ 10 10 .gitlab-ci/reprepro.sh \ 11 11 .gitlab-ci/install-android-sdk.sh \ 12 + .gitlab-ci/install-ndk.sh \ 12 13 13 14 CONFIG_FILE := .gitlab-ci/config.yml 14 15 OUTPUTS := .gitlab-ci.yml \
+6 -4
.gitlab-ci/config.yml
··· 131 131 distro_version: bookworm 132 132 repo_suffix: ndk 133 133 script: android_container_prep.sh 134 - tag: "2024-01-16" 134 + tag: "2024-07-02" 135 135 # This must match ext.sharedCompileSdk in build.gradle 136 - android_compile_sdk: 32 136 + android_compile_sdk: 34 137 137 # This must match buildscript.ext.buildToolsVersion in build.gradle 138 - android_build_tools: 32.0.0 138 + android_build_tools: 34.0.0 139 + # This must match ext.ndk_version in build.gradle 140 + android_ndk_version: r26d 139 141 # look up on https://developer.android.com/studio/index.html#downloads when updating other versions 140 - android_cli_tools: 9477386 142 + android_cli_tools: 11076708 141 143 142 144 packages: 143 145 git:
+3 -3
.gitlab-ci/install-android-sdk.sh
··· 12 12 # Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/ 13 13 14 14 set -eo pipefail 15 - VERSION=9477386 15 + VERSION=11076708 16 16 ROOT=${ROOT:-/opt/android-sdk} 17 - ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-32} 18 - ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-32.0.0} 17 + ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-34} 18 + ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-34.0.0} 19 19 20 20 mkdir -p "$ROOT" 21 21 FN=commandlinetools-linux-${VERSION}_latest.zip
+12 -4
.gitlab-ci/install-ndk.sh
··· 1 1 #!/bin/sh 2 - # Copyright 2018-2020, 2022, Collabora, Ltd. and the Monado contributors 2 + # Copyright 2018-2020, 2022, 2024 Collabora, Ltd. and the Monado contributors 3 3 # SPDX-License-Identifier: BSL-1.0 4 4 5 - # aka 21.4.7075529 6 - VERSION=r21e 7 - FN=android-ndk-${VERSION}-linux-x86_64.zip 5 + ## 6 + ####################################################### 7 + # GENERATED - DO NOT EDIT # 8 + # see .gitlab-ci/install-ndk.sh.jinja instead # 9 + ####################################################### 10 + ## 11 + 12 + # Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/ 13 + 14 + VERSION=r26d 15 + FN=android-ndk-${VERSION}-linux.zip 8 16 wget https://dl.google.com/android/repository/$FN 9 17 unzip $FN -d /opt 10 18 mv /opt/android-ndk-${VERSION} /opt/android-ndk
+23
.gitlab-ci/templates/install-ndk.sh.jinja
··· 1 + #!/bin/sh 2 + # Copyright 2018-2020, 2022, 2024 Collabora, Ltd. and the Monado contributors 3 + # SPDX-License-Identifier: BSL-1.0 4 + 5 + #{# ignore the warning, this is actually the template to edit. #}# 6 + ####################################################### 7 + # GENERATED - DO NOT EDIT # 8 + # see .gitlab-ci/install-ndk.sh.jinja instead # 9 + ####################################################### 10 + #{# 11 + Please run the following after editing: 12 + make -f .gitlab-ci/ci-scripts.mk 13 + #}# 14 + 15 + # Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/ 16 + {% for distro in distributions -%} {%- for image in distro.images if "android_ndk_version" in image %} 17 + 18 + VERSION={{image.android_ndk_version}} 19 + FN=android-ndk-${VERSION}-linux.zip 20 + wget https://dl.google.com/android/repository/$FN 21 + unzip $FN -d /opt 22 + mv /opt/android-ndk-${VERSION} /opt/android-ndk 23 + {% endfor -%} {%- endfor %}
+16 -15
build.gradle
··· 3 3 4 4 buildscript { 5 5 ext { 6 - kotlinVersion = '1.7.10' 6 + kotlinVersion = '2.0.0' 7 7 8 - latestAboutLibsRelease = '8.9.4' 8 + latestAboutLibsRelease = '11.2.2' 9 9 10 - androidxCoreVersion = '1.8.0' 11 - androidxAnnotationVersion = '1.3.0' 12 - androidxAppCompatVersion = '1.5.1' 13 - androidxLifecycleVersion = '2.5.1' 14 - androidxConstraintLayoutVersion = '2.1.3' 10 + androidxCoreVersion = '1.13.1' 11 + androidxAnnotationVersion = '1.8.0' 12 + androidxAppCompatVersion = '1.7.0' 13 + androidxLifecycleVersion = '2.8.2' 14 + androidxConstraintLayoutVersion = '2.1.4' 15 15 androidxCardViewVersion = '1.0.0' 16 - androidxRecyclerViewVersion = '1.2.1' 16 + androidxRecyclerViewVersion = '1.3.2' 17 17 18 - hiltVersion = '2.45' 18 + hiltVersion = '2.51.1' 19 19 20 - materialVersion = '1.8.0' 20 + materialVersion = '1.12.0' 21 21 22 22 // This is the version to download if we can't find it locally. 23 23 eigenFetchVersion = '3.4.0' 24 24 25 25 // If you update this, must also update .gitlab-ci/config.yml 26 - buildToolsVersion = '32.0.0' 26 + buildToolsVersion = '34.0.0' 27 27 } 28 28 repositories { 29 29 google() ··· 36 36 } 37 37 plugins { 38 38 // Android Gradle Plugin 39 - id 'com.android.application' version '8.1.0' apply false 40 - id 'com.android.library' version '8.1.0' apply false 39 + id 'com.android.application' version '8.5.0' apply false 40 + id 'com.android.library' version '8.5.0' apply false 41 41 42 42 id 'org.jetbrains.kotlin.android' version "$kotlinVersion" apply false 43 43 ··· 70 70 } 71 71 72 72 ext { 73 - ndk_version = '21.4.7075529' 73 + cmake_version = '3.22.1' 74 + ndk_version = '26.3.11579264' 74 75 // If you update this, must also update .gitlab-ci/config.yml 75 - sharedCompileSdk = 32 76 + sharedCompileSdk = 34 76 77 sharedTargetSdk = 31 77 78 sharedMinSdk = 26 78 79
-1
gradle.properties
··· 1 1 # Copyright 2020, Collabora, Ltd. 2 2 # SPDX-License-Identifier: BSL-1.0 3 3 4 - android.defaults.buildfeatures.buildconfig=true 5 4 android.nonFinalResIds=false 6 5 android.nonTransitiveRClass=false 7 6 android.useAndroidX = true
+1 -1
gradle/wrapper/gradle-wrapper.properties
··· 1 1 distributionBase=GRADLE_USER_HOME 2 2 distributionPath=wrapper/dists 3 - distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip 3 + distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip 4 4 networkTimeout=10000 5 5 zipStoreBase=GRADLE_USER_HOME 6 6 zipStorePath=wrapper/dists
+2 -2
src/xrt/auxiliary/android/build.gradle
··· 26 26 } 27 27 28 28 compileOptions { 29 - sourceCompatibility JavaVersion.VERSION_1_8 30 - targetCompatibility JavaVersion.VERSION_1_8 29 + sourceCompatibility JavaVersion.VERSION_17 30 + targetCompatibility JavaVersion.VERSION_17 31 31 } 32 32 packagingOptions { 33 33 resources {
+3 -2
src/xrt/ipc/android/build.gradle
··· 50 50 } 51 51 52 52 compileOptions { 53 - sourceCompatibility JavaVersion.VERSION_1_8 54 - targetCompatibility JavaVersion.VERSION_1_8 53 + sourceCompatibility JavaVersion.VERSION_17 54 + targetCompatibility JavaVersion.VERSION_17 55 55 } 56 56 packagingOptions { 57 57 resources { ··· 64 64 } 65 65 buildFeatures { 66 66 aidl true 67 + buildConfig true 67 68 } 68 69 } 69 70
+2 -2
src/xrt/targets/android_common/build.gradle
··· 50 50 } 51 51 52 52 compileOptions { 53 - sourceCompatibility JavaVersion.VERSION_1_8 54 - targetCompatibility JavaVersion.VERSION_1_8 53 + sourceCompatibility JavaVersion.VERSION_17 54 + targetCompatibility JavaVersion.VERSION_17 55 55 } 56 56 packagingOptions { 57 57 resources {
+1 -1
src/xrt/targets/android_common/src/main/java/org/freedesktop/monado/android_common/DisplayOverOtherAppsStatusFragment.kt
··· 83 83 } 84 84 } 85 85 86 - @Suppress("DEPRECATION") 86 + @Deprecated("DEPRECATION") 87 87 private val isRuntimeServiceRunning: Boolean 88 88 get() { 89 89 var running = false
+11 -8
src/xrt/targets/openxr_android/build.gradle
··· 206 206 externalNativeBuild { 207 207 cmake { 208 208 path "${rootDir}/CMakeLists.txt" 209 + version "${cmake_version}" 209 210 } 210 211 } 211 212 ··· 234 235 enableAggregatingTask = true 235 236 } 236 237 compileOptions { 237 - sourceCompatibility JavaVersion.VERSION_1_8 238 - targetCompatibility JavaVersion.VERSION_1_8 238 + sourceCompatibility JavaVersion.VERSION_17 239 + targetCompatibility JavaVersion.VERSION_17 239 240 } 240 241 packagingOptions { 241 242 resources { ··· 249 250 lint { 250 251 fatal 'StopShip' 251 252 } 252 - 253 + buildFeatures { 254 + buildConfig true 255 + } 253 256 } 254 257 255 258 aboutLibraries { 256 259 // Full license text for license IDs mentioned here 257 260 // will be included, even if no detected dependency uses them. 258 - additionalLicenses { 259 - mit 260 - mpl_2_0 261 - bsl_1_0 262 - } 261 + additionalLicenses = [ 262 + "mit", 263 + "mpl_2_0", 264 + "bsl_1_0" 265 + ] 263 266 } 264 267 265 268 dependencies {
-1
src/xrt/targets/openxr_android/src/main/java/org/freedesktop/monado/openxr_runtime/AboutLibrariesNoticeFragmentProvider.kt
··· 16 16 class AboutLibrariesNoticeFragmentProvider @Inject constructor() : NoticeFragmentProvider { 17 17 override fun makeNoticeFragment(): Fragment = 18 18 LibsBuilder() 19 - .withFields(R.string::class.java.fields) 20 19 .withAboutIconShown(false) // We do this ourselves bigger 21 20 .withAboutVersionShown(true) // Let the fragment show our version 22 21 .withLicenseShown(true) // Not sure why you'd do this without license info