From 1e45674573fbddcfe44ec0ea49c98ebe5c6e210e Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Fri, 10 Apr 2026 02:41:29 +0300 Subject: [PATCH] Android: add Gradle composite build to manage JAR projects With a Gradle-enabled Qt build, it's easy now to manage all Qt modules' JAR builds in one place from an IDE, and that's what's being done here with Gradle composite builds. This adds each module's JAR in the qt super repo and each module also defines its potential dependencies (e.g. Qt6Android.jar). This also update .gitignore with Gradle, JDTLS and IntelliJ ignores, and moves the existing .gitignore from the provision android_gradle project to the root. Task-number: QTBUG-132915 Change-Id: I4573768c394a4c25347eeb8ce6e2ddf7e57796ef Reviewed-by: Alexandru Croitor --- .gitignore | 13 +++++ REUSE.toml | 3 +- .../linux/android/gradle_project/.gitignore | 10 ---- gradle.properties | 15 ++++++ gradle/libs.versions.toml | 5 ++ gradle/wrapper/gradle-wrapper.properties | 7 +++ settings.gradle | 49 +++++++++++++++++++ 7 files changed, 91 insertions(+), 11 deletions(-) delete mode 100644 coin/provisioning/common/linux/android/gradle_project/.gitignore create mode 100644 gradle.properties create mode 100644 gradle/libs.versions.toml create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore index 6be14cd2..1fafd74d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,16 @@ build-*/ init-repository.opt init-repository.opt.in config.tl.opt + +# CLion generated files +.idea + +# Gradle generated files +.gradle/ +local.properties + +# JDTLS generated files +.project +.classpath +.settings/ +bin/ diff --git a/REUSE.toml b/REUSE.toml index aa22c746..39b7e509 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -10,7 +10,8 @@ SPDX-License-Identifier = "LicenseRef-Qt-Commercial OR GPL-3.0-only" [[annotations]] path = ["coin/**", "cmake/**", "**.pro", "**.qrc", "**CMakeLists.txt", ".cmake.conf", "**.yaml", "coin/axivion/ci_config_linux.json", - "**.cfg", "**.plist", "**.pri", "**.prf", "configure.json"] + "**.cfg", "**.plist", "**.pri", "**.prf", "configure.json", + "settings.gradle", "gradle/libs.versions.toml"] precedence = "closest" comment = "build system" SPDX-FileCopyrightText = "Copyright (C) 2024 The Qt Company Ltd." diff --git a/coin/provisioning/common/linux/android/gradle_project/.gitignore b/coin/provisioning/common/linux/android/gradle_project/.gitignore deleted file mode 100644 index 8cacfbdf..00000000 --- a/coin/provisioning/common/linux/android/gradle_project/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -*.iml -.gradle -.idea -/local.properties -.DS_Store -/build -/captures -.externalNativeBuild -.cxx -local.properties diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..47c784a3 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,15 @@ +# Project-wide Gradle settings. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx3200m -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# Enable building projects in parallel +org.gradle.parallel=true + +# Allow AndroidX usage +android.useAndroidX=true + +# Enable caching +org.gradle.configuration-cache=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..9a434281 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,5 @@ +[versions] +agp = "9.0.0" + +[plugins] +android-library = { id = "com.android.library", version.ref = "agp" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..37f78a6a --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..d6ec311e --- /dev/null +++ b/settings.gradle @@ -0,0 +1,49 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = 'Qt-for-Android' + +def tryIncludeBuild = { String path, Closure config -> + if (new File(settingsDir, path).exists()) { + includeBuild(path, config) + } +} + +// qtbase +tryIncludeBuild('qtbase/src/android/jar') { name = 'Qt6Android' } +tryIncludeBuild('qtbase/src/network/android/jar') { name = 'Qt6AndroidNetwork' } +tryIncludeBuild('qtbase/src/plugins/networkinformation/android/jar') { + name = 'Qt6AndroidNetworkInformationBackend' +} + +// qtconnectivity +tryIncludeBuild('qtconnectivity/src/android/bluetooth') { name = 'Qt6AndroidBluetooth' } +tryIncludeBuild('qtconnectivity/src/android/nfc') { name = 'Qt6AndroidNfc' } + +// qtdeclarative +tryIncludeBuild('qtdeclarative/src/quick/platform/android/jar') { name = 'Qt6AndroidQuick' } + +// qtmultimedia +tryIncludeBuild('qtmultimedia/src/android/jar') { name = 'Qt6AndroidMultimedia' } + +// qtpositioning +tryIncludeBuild('qtpositioning/src/plugins/position/android/jar') { name = 'Qt6AndroidPositioning' } + +// qtspeech +tryIncludeBuild('qtspeech/src/plugins/tts/android/jar') { name = 'Qt6AndroidTextToSpeech' } + +// qtwebview +tryIncludeBuild('qtwebview/src/jar') { name = 'Qt6AndroidWebView' }