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>
This commit is contained in:
Korcan Hussein 2024-07-01 13:57:18 +01:00 committed by Marge Bot
parent 9e46337a6a
commit ae37c1bf29
15 changed files with 82 additions and 45 deletions

View file

@ -138,7 +138,7 @@ win:container_prep:
.monado.variables.debian:bookworm-ndk:
variables:
FDO_DISTRIBUTION_VERSION: "bookworm"
FDO_DISTRIBUTION_TAG: "2024-01-16"
FDO_DISTRIBUTION_TAG: "2024-07-02"
FDO_REPO_SUFFIX: ndk
# Variables for build and usage of Ubuntu focal image

View file

@ -9,6 +9,7 @@ FILES_IN_SUBDIR := \
.gitlab-ci/distributions \
.gitlab-ci/reprepro.sh \
.gitlab-ci/install-android-sdk.sh \
.gitlab-ci/install-ndk.sh \
CONFIG_FILE := .gitlab-ci/config.yml
OUTPUTS := .gitlab-ci.yml \

View file

@ -131,13 +131,15 @@ distributions:
distro_version: bookworm
repo_suffix: ndk
script: android_container_prep.sh
tag: "2024-01-16"
tag: "2024-07-02"
# This must match ext.sharedCompileSdk in build.gradle
android_compile_sdk: 32
android_compile_sdk: 34
# This must match buildscript.ext.buildToolsVersion in build.gradle
android_build_tools: 32.0.0
android_build_tools: 34.0.0
# This must match ext.ndk_version in build.gradle
android_ndk_version: r26d
# look up on https://developer.android.com/studio/index.html#downloads when updating other versions
android_cli_tools: 9477386
android_cli_tools: 11076708
packages:
git:

View file

@ -12,10 +12,10 @@
# Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
set -eo pipefail
VERSION=9477386
VERSION=11076708
ROOT=${ROOT:-/opt/android-sdk}
ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-32}
ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-32.0.0}
ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-34}
ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-34.0.0}
mkdir -p "$ROOT"
FN=commandlinetools-linux-${VERSION}_latest.zip

View file

@ -1,10 +1,18 @@
#!/bin/sh
# Copyright 2018-2020, 2022, Collabora, Ltd. and the Monado contributors
# Copyright 2018-2020, 2022, 2024 Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
# aka 21.4.7075529
VERSION=r21e
FN=android-ndk-${VERSION}-linux-x86_64.zip
##
#######################################################
# GENERATED - DO NOT EDIT #
# see .gitlab-ci/install-ndk.sh.jinja instead #
#######################################################
##
# Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
VERSION=r26d
FN=android-ndk-${VERSION}-linux.zip
wget https://dl.google.com/android/repository/$FN
unzip $FN -d /opt
mv /opt/android-ndk-${VERSION} /opt/android-ndk

View file

@ -0,0 +1,23 @@
#!/bin/sh
# Copyright 2018-2020, 2022, 2024 Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
#{# ignore the warning, this is actually the template to edit. #}#
#######################################################
# GENERATED - DO NOT EDIT #
# see .gitlab-ci/install-ndk.sh.jinja instead #
#######################################################
#{#
Please run the following after editing:
make -f .gitlab-ci/ci-scripts.mk
#}#
# Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
{% for distro in distributions -%} {%- for image in distro.images if "android_ndk_version" in image %}
VERSION={{image.android_ndk_version}}
FN=android-ndk-${VERSION}-linux.zip
wget https://dl.google.com/android/repository/$FN
unzip $FN -d /opt
mv /opt/android-ndk-${VERSION} /opt/android-ndk
{% endfor -%} {%- endfor %}

View file

@ -3,27 +3,27 @@
buildscript {
ext {
kotlinVersion = '1.7.10'
kotlinVersion = '2.0.0'
latestAboutLibsRelease = '8.9.4'
latestAboutLibsRelease = '11.2.2'
androidxCoreVersion = '1.8.0'
androidxAnnotationVersion = '1.3.0'
androidxAppCompatVersion = '1.5.1'
androidxLifecycleVersion = '2.5.1'
androidxConstraintLayoutVersion = '2.1.3'
androidxCoreVersion = '1.13.1'
androidxAnnotationVersion = '1.8.0'
androidxAppCompatVersion = '1.7.0'
androidxLifecycleVersion = '2.8.2'
androidxConstraintLayoutVersion = '2.1.4'
androidxCardViewVersion = '1.0.0'
androidxRecyclerViewVersion = '1.2.1'
androidxRecyclerViewVersion = '1.3.2'
hiltVersion = '2.45'
hiltVersion = '2.51.1'
materialVersion = '1.8.0'
materialVersion = '1.12.0'
// This is the version to download if we can't find it locally.
eigenFetchVersion = '3.4.0'
// If you update this, must also update .gitlab-ci/config.yml
buildToolsVersion = '32.0.0'
buildToolsVersion = '34.0.0'
}
repositories {
google()
@ -36,8 +36,8 @@ buildscript {
}
plugins {
// Android Gradle Plugin
id 'com.android.application' version '8.1.0' apply false
id 'com.android.library' version '8.1.0' apply false
id 'com.android.application' version '8.5.0' apply false
id 'com.android.library' version '8.5.0' apply false
id 'org.jetbrains.kotlin.android' version "$kotlinVersion" apply false
@ -70,9 +70,10 @@ spotless {
}
ext {
ndk_version = '21.4.7075529'
cmake_version = '3.22.1'
ndk_version = '26.3.11579264'
// If you update this, must also update .gitlab-ci/config.yml
sharedCompileSdk = 32
sharedCompileSdk = 34
sharedTargetSdk = 31
sharedMinSdk = 26

View file

@ -1,7 +1,6 @@
# Copyright 2020, Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX = true

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -26,8 +26,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
packagingOptions {
resources {

View file

@ -50,8 +50,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
packagingOptions {
resources {
@ -64,6 +64,7 @@ android {
}
buildFeatures {
aidl true
buildConfig true
}
}

View file

@ -50,8 +50,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
packagingOptions {
resources {

View file

@ -83,7 +83,7 @@ class DisplayOverOtherAppsStatusFragment : Fragment() {
}
}
@Suppress("DEPRECATION")
@Deprecated("DEPRECATION")
private val isRuntimeServiceRunning: Boolean
get() {
var running = false

View file

@ -206,6 +206,7 @@ android {
externalNativeBuild {
cmake {
path "${rootDir}/CMakeLists.txt"
version "${cmake_version}"
}
}
@ -234,8 +235,8 @@ android {
enableAggregatingTask = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
packagingOptions {
resources {
@ -249,17 +250,19 @@ android {
lint {
fatal 'StopShip'
}
buildFeatures {
buildConfig true
}
}
aboutLibraries {
// Full license text for license IDs mentioned here
// will be included, even if no detected dependency uses them.
additionalLicenses {
mit
mpl_2_0
bsl_1_0
}
additionalLicenses = [
"mit",
"mpl_2_0",
"bsl_1_0"
]
}
dependencies {

View file

@ -16,7 +16,6 @@ import org.freedesktop.monado.android_common.NoticeFragmentProvider
class AboutLibrariesNoticeFragmentProvider @Inject constructor() : NoticeFragmentProvider {
override fun makeNoticeFragment(): Fragment =
LibsBuilder()
.withFields(R.string::class.java.fields)
.withAboutIconShown(false) // We do this ourselves bigger
.withAboutVersionShown(true) // Let the fragment show our version
.withLicenseShown(true) // Not sure why you'd do this without license info