Upgrade Gradle from 8.10.2 to 8.13

includes prerequisites:
- pcom.android.tools.build update from 8.6.1 to 8.9.1
- compileSdk update from 34 to 35 (targetSdk and minSdk are unchanged)
- .gradle and .java housekeeping fixes to reduce build warnings
This commit is contained in:
Thomas Kuehne
2025-04-13 17:33:36 +01:00
committed by José Rebelo
parent aa573ad6b7
commit c7f236790a
9 changed files with 58 additions and 46 deletions

View File

@@ -1,8 +1,10 @@
apply plugin: 'java' plugins {
apply plugin: 'maven-publish' id 'java'
apply plugin:'application' id 'maven-publish'
id 'application'
}
archivesBaseName = 'gadgetbridge-daogenerator' base.archivesName = 'gadgetbridge-daogenerator'
dependencies { dependencies {
// https://github.com/Freeyourgadget/greenDAO/tree/fyg // https://github.com/Freeyourgadget/greenDAO/tree/fyg
@@ -17,10 +19,10 @@ sourceSets {
} }
} }
mainClassName = "nodomain.freeyourgadget.gadgetbridge.daogen.GBDaoGenerator" application.mainClass = "nodomain.freeyourgadget.gadgetbridge.daogen.GBDaoGenerator"
tasks.register('genSources', JavaExec) { tasks.register('genSources', JavaExec) {
mainClass = mainClassName mainClass = application.mainClass
classpath = sourceSets.main.runtimeClasspath classpath = sourceSets.main.runtimeClasspath
workingDir = '../' workingDir = '../'
} }
@@ -32,12 +34,13 @@ artifacts {
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
toolchain.languageVersion = JavaLanguageVersion.of(17)
} }
tasks.named("distTar") { tasks.named("distTar") {
duplicatesStrategy = 'include' duplicatesStrategy = DuplicatesStrategy.INCLUDE
} }
tasks.named("distZip") { tasks.named("distZip") {
duplicatesStrategy = 'include' duplicatesStrategy = DuplicatesStrategy.INCLUDE
} }

View File

@@ -1,9 +1,11 @@
import java.nio.file.Files import java.nio.file.Files
apply plugin: "com.android.application" plugins {
apply plugin: 'com.google.protobuf' id 'com.android.application'
id 'com.google.protobuf'
}
tasks.withType(Test) { tasks.withType(Test).configureEach {
systemProperty "MiFirmwareDir", System.getProperty("MiFirmwareDir", null) systemProperty "MiFirmwareDir", System.getProperty("MiFirmwareDir", null)
systemProperty "logback.configurationFile", System.getProperty("user.dir", null) + "/app/src/main/assets/logback.xml" systemProperty "logback.configurationFile", System.getProperty("user.dir", null) + "/app/src/main/assets/logback.xml"
systemProperty "GB_LOGFILES_DIR", Files.createTempDirectory("gblog").toString() systemProperty "GB_LOGFILES_DIR", Files.createTempDirectory("gblog").toString()
@@ -31,12 +33,12 @@ def buildGitChangelog = {
allCommits.trim().eachLine { line -> allCommits.trim().eachLine { line ->
if (includedCommits > 100) { if (includedCommits > 100) {
return true; return true
} }
def (commitHash, commitMessage) = line.split(" ", 2) def (commitHash, commitMessage) = line.split(" ", 2)
if (commitMessage.contains("Translated using Weblate")) { if (commitMessage.contains("Translated using Weblate")) {
return true; return true
} }
def releaseNode = new Node(changelogNode, 'release', [version: commitHash, versioncode: commitVersionCode--]) def releaseNode = new Node(changelogNode, 'release', [version: commitHash, versioncode: commitVersionCode--])
@@ -59,24 +61,32 @@ def getGitHashShort = { ->
} }
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
android { android {
compileOptions { compileOptions {
coreLibraryDesugaringEnabled true coreLibraryDesugaringEnabled = true
// for Android 5+
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
} }
namespace 'nodomain.freeyourgadget.gadgetbridge' namespace = 'nodomain.freeyourgadget.gadgetbridge'
defaultConfig { defaultConfig {
applicationId "nodomain.freeyourgadget.gadgetbridge" applicationId "nodomain.freeyourgadget.gadgetbridge"
// Note: update toolchain.languageVersion when changing targetSdk
//noinspection OldTargetApi //noinspection OldTargetApi
targetSdkVersion 34 targetSdk = 34
compileSdk 34 compileSdk = 35
minSdkVersion 21 // Note: update sourceCompatibility and targetCompatibility when changing minSdk
minSdk = 21
// WORKAROUND: 35.0.0 is broken if a directory in the AIDL build starts with "u" (https://issuetracker.google.com/issues/389488321)
// however 35 is required by com.android.tools.build:gradle:8.9.1, the latest version supported by Android Studio
buildToolsVersion = '35.0.1'
// Note: always bump BOTH versionCode and versionName! // Note: always bump BOTH versionCode and versionName!
versionName "0.85.0" versionName "0.85.0"
@@ -97,7 +107,7 @@ android {
} }
} }
flavorDimensions "device_type" flavorDimensions += "device_type"
productFlavors { productFlavors {
mainline { mainline {
// Ensure that when starting from scratch, 'mainline' is selected, not 'banglejs' // Ensure that when starting from scratch, 'mainline' is selected, not 'banglejs'
@@ -114,7 +124,6 @@ android {
applicationIdSuffix ".banglejs" applicationIdSuffix ".banglejs"
versionNameSuffix "-banglejs" versionNameSuffix "-banglejs"
buildConfigField "boolean", "INTERNET_ACCESS", "true" buildConfigField "boolean", "INTERNET_ACCESS", "true"
targetSdkVersion 34
// Note: app/src/banglejs/AndroidManifest.xml contains some extra permissions // Note: app/src/banglejs/AndroidManifest.xml contains some extra permissions
} }
} }
@@ -122,6 +131,8 @@ android {
sourceSets { sourceSets {
main { main {
res.srcDirs += "build/generated/res/changelog" res.srcDirs += "build/generated/res/changelog"
java.srcDirs += "${protobuf.generatedFilesBaseDir}"
java.srcDirs += "build/generated/source/buildConfig"
} }
} }
@@ -139,9 +150,9 @@ android {
debuggable false debuggable false
if (System.getProperty("nightly_store_file") != null) { if (System.getProperty("nightly_store_file") != null) {
signingConfig signingConfigs.nightly signingConfig = signingConfigs.nightly
} else { } else {
signingConfig signingConfigs.debug signingConfig = signingConfigs.debug
} }
} }
@@ -153,9 +164,9 @@ android {
debuggable false debuggable false
if (System.getProperty("nightly_store_file") != null) { if (System.getProperty("nightly_store_file") != null) {
signingConfig signingConfigs.nightly signingConfig = signingConfigs.nightly
} else { } else {
signingConfig signingConfigs.debug signingConfig = signingConfigs.debug
} }
} }
@@ -175,14 +186,14 @@ android {
} }
lint { lint {
abortOnError true abortOnError = true
lintConfig file("$rootDir/app/src/main/lint.xml") lintConfig = file("${rootDir}/app/src/main/lint.xml")
// If true, generate an HTML report (with issue explanations, sourcecode, etc) // If true, generate an HTML report (with issue explanations, sourcecode, etc)
htmlReport true htmlReport = true
// Optional path to report (default will be lint-results.html in the builddir) // Optional path to report (default will be lint-results.html in the builddir)
htmlOutput file("$project.buildDir/reports/lint/lint.html") htmlOutput = file("${project.layout.buildDirectory}/reports/lint/lint.html")
// Ignore checks present in the snapshot // Ignore checks present in the snapshot
baseline file("lint-baseline.xml") baseline = file("lint-baseline.xml")
} }
testOptions { testOptions {
@@ -192,8 +203,8 @@ android {
} }
} }
buildFeatures { buildFeatures {
aidl true aidl = true
buildConfig true buildConfig = true
} }
} }
@@ -277,13 +288,6 @@ gradle.beforeProject {
preBuild.dependsOn(":GBDaoGenerator:genSources") preBuild.dependsOn(":GBDaoGenerator:genSources")
} }
sourceSets {
main {
java.srcDirs += "${protobuf.generatedFilesBaseDir}"
java.srcDirs += "build/generated/source/buildConfig"
}
}
tasks.register('cleanGenerated', Delete) { tasks.register('cleanGenerated', Delete) {
delete fileTree('src/main/java/nodomain/freeyourgadget/gadgetbridge/entities') { delete fileTree('src/main/java/nodomain/freeyourgadget/gadgetbridge/entities') {
include '**/*.java' include '**/*.java'

View File

@@ -128,6 +128,7 @@ public class AlarmUtils {
* @deprecated use {@link DBHelper#getAlarms(GBDevice)} instead * @deprecated use {@link DBHelper#getAlarms(GBDevice)} instead
*/ */
@NonNull @NonNull
@Deprecated
public static List<Alarm> readAlarmsFromPrefs(GBDevice gbDevice) { public static List<Alarm> readAlarmsFromPrefs(GBDevice gbDevice) {
Prefs prefs = GBApplication.getPrefs(); Prefs prefs = GBApplication.getPrefs();
Set<String> stringAlarms = prefs.getStringSet(MiBandConst.PREF_MIBAND_ALARMS, new HashSet<String>()); Set<String> stringAlarms = prefs.getStringSet(MiBandConst.PREF_MIBAND_ALARMS, new HashSet<String>());

View File

@@ -433,6 +433,7 @@ private static final int[] Tinv0 =
* default constructor - 128 bit block size. * default constructor - 128 bit block size.
* @deprecated use AESEngine.newInstance() * @deprecated use AESEngine.newInstance()
*/ */
@Deprecated
public AESEngine() public AESEngine()
{ {
// CryptoServicesRegistrar.checkConstraints(new DefaultServiceProperties(getAlgorithmName(), 256)); // CryptoServicesRegistrar.checkConstraints(new DefaultServiceProperties(getAlgorithmName(), 256));

View File

@@ -38,6 +38,7 @@ public class CBCBlockCipher
* @param cipher the block cipher to be used as the basis of chaining. * @param cipher the block cipher to be used as the basis of chaining.
* @deprecated use the CBCBlockCipher.newInstance() static method. * @deprecated use the CBCBlockCipher.newInstance() static method.
*/ */
@Deprecated
public CBCBlockCipher( public CBCBlockCipher(
BlockCipher cipher) BlockCipher cipher)
{ {

View File

@@ -49,6 +49,7 @@ public class CCMBlockCipher
* @param c the block cipher to be used. * @param c the block cipher to be used.
* @deprecated use the CCMBlockCipher.newInstance() static method. * @deprecated use the CCMBlockCipher.newInstance() static method.
*/ */
@Deprecated
public CCMBlockCipher(BlockCipher c) public CCMBlockCipher(BlockCipher c)
{ {
this.cipher = c; this.cipher = c;

View File

@@ -41,6 +41,7 @@ public class SICBlockCipher
* @param c the block cipher to be used. * @param c the block cipher to be used.
* @deprecated use newInstance() method. * @deprecated use newInstance() method.
*/ */
@Deprecated
public SICBlockCipher(BlockCipher c) public SICBlockCipher(BlockCipher c)
{ {
super(c); super(c);

View File

@@ -5,11 +5,11 @@ buildscript {
mavenCentral() mavenCentral()
google() google()
maven { maven {
url 'https://plugins.gradle.org/m2/' url = 'https://plugins.gradle.org/m2/'
} }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.6.1' classpath 'com.android.tools.build:gradle:8.9.1'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.5' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.5'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
@@ -21,7 +21,7 @@ allprojects {
repositories { repositories {
mavenCentral() mavenCentral()
maven { maven {
url 'https://jitpack.io' url = 'https://jitpack.io'
} }
google() google()
} }

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME