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'
apply plugin: 'maven-publish'
apply plugin:'application'
plugins {
id 'java'
id 'maven-publish'
id 'application'
}
archivesBaseName = 'gadgetbridge-daogenerator'
base.archivesName = 'gadgetbridge-daogenerator'
dependencies {
// 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) {
mainClass = mainClassName
mainClass = application.mainClass
classpath = sourceSets.main.runtimeClasspath
workingDir = '../'
}
@@ -32,12 +34,13 @@ artifacts {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
tasks.named("distTar") {
duplicatesStrategy = 'include'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
tasks.named("distZip") {
duplicatesStrategy = 'include'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

View File

@@ -1,9 +1,11 @@
import java.nio.file.Files
apply plugin: "com.android.application"
apply plugin: 'com.google.protobuf'
plugins {
id 'com.android.application'
id 'com.google.protobuf'
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
systemProperty "MiFirmwareDir", System.getProperty("MiFirmwareDir", null)
systemProperty "logback.configurationFile", System.getProperty("user.dir", null) + "/app/src/main/assets/logback.xml"
systemProperty "GB_LOGFILES_DIR", Files.createTempDirectory("gblog").toString()
@@ -31,12 +33,12 @@ def buildGitChangelog = {
allCommits.trim().eachLine { line ->
if (includedCommits > 100) {
return true;
return true
}
def (commitHash, commitMessage) = line.split(" ", 2)
if (commitMessage.contains("Translated using Weblate")) {
return true;
return true
}
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 {
compileOptions {
coreLibraryDesugaringEnabled true
// for Android 5+
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled = true
}
namespace 'nodomain.freeyourgadget.gadgetbridge'
namespace = 'nodomain.freeyourgadget.gadgetbridge'
defaultConfig {
applicationId "nodomain.freeyourgadget.gadgetbridge"
// Note: update toolchain.languageVersion when changing targetSdk
//noinspection OldTargetApi
targetSdkVersion 34
compileSdk 34
minSdkVersion 21
targetSdk = 34
compileSdk = 35
// 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!
versionName "0.85.0"
@@ -97,7 +107,7 @@ android {
}
}
flavorDimensions "device_type"
flavorDimensions += "device_type"
productFlavors {
mainline {
// Ensure that when starting from scratch, 'mainline' is selected, not 'banglejs'
@@ -114,7 +124,6 @@ android {
applicationIdSuffix ".banglejs"
versionNameSuffix "-banglejs"
buildConfigField "boolean", "INTERNET_ACCESS", "true"
targetSdkVersion 34
// Note: app/src/banglejs/AndroidManifest.xml contains some extra permissions
}
}
@@ -122,6 +131,8 @@ android {
sourceSets {
main {
res.srcDirs += "build/generated/res/changelog"
java.srcDirs += "${protobuf.generatedFilesBaseDir}"
java.srcDirs += "build/generated/source/buildConfig"
}
}
@@ -139,9 +150,9 @@ android {
debuggable false
if (System.getProperty("nightly_store_file") != null) {
signingConfig signingConfigs.nightly
signingConfig = signingConfigs.nightly
} else {
signingConfig signingConfigs.debug
signingConfig = signingConfigs.debug
}
}
@@ -153,9 +164,9 @@ android {
debuggable false
if (System.getProperty("nightly_store_file") != null) {
signingConfig signingConfigs.nightly
signingConfig = signingConfigs.nightly
} else {
signingConfig signingConfigs.debug
signingConfig = signingConfigs.debug
}
}
@@ -175,14 +186,14 @@ android {
}
lint {
abortOnError true
lintConfig file("$rootDir/app/src/main/lint.xml")
abortOnError = true
lintConfig = file("${rootDir}/app/src/main/lint.xml")
// 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)
htmlOutput file("$project.buildDir/reports/lint/lint.html")
htmlOutput = file("${project.layout.buildDirectory}/reports/lint/lint.html")
// Ignore checks present in the snapshot
baseline file("lint-baseline.xml")
baseline = file("lint-baseline.xml")
}
testOptions {
@@ -192,8 +203,8 @@ android {
}
}
buildFeatures {
aidl true
buildConfig true
aidl = true
buildConfig = true
}
}
@@ -277,13 +288,6 @@ gradle.beforeProject {
preBuild.dependsOn(":GBDaoGenerator:genSources")
}
sourceSets {
main {
java.srcDirs += "${protobuf.generatedFilesBaseDir}"
java.srcDirs += "build/generated/source/buildConfig"
}
}
tasks.register('cleanGenerated', Delete) {
delete fileTree('src/main/java/nodomain/freeyourgadget/gadgetbridge/entities') {
include '**/*.java'

View File

@@ -128,6 +128,7 @@ public class AlarmUtils {
* @deprecated use {@link DBHelper#getAlarms(GBDevice)} instead
*/
@NonNull
@Deprecated
public static List<Alarm> readAlarmsFromPrefs(GBDevice gbDevice) {
Prefs prefs = GBApplication.getPrefs();
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.
* @deprecated use AESEngine.newInstance()
*/
@Deprecated
public AESEngine()
{
// 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.
* @deprecated use the CBCBlockCipher.newInstance() static method.
*/
@Deprecated
public CBCBlockCipher(
BlockCipher cipher)
{

View File

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

View File

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

View File

@@ -5,11 +5,11 @@ buildscript {
mavenCentral()
google()
maven {
url 'https://plugins.gradle.org/m2/'
url = 'https://plugins.gradle.org/m2/'
}
}
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'
// NOTE: Do not place your application dependencies here; they belong
@@ -21,7 +21,7 @@ allprojects {
repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
url = 'https://jitpack.io'
}
google()
}

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
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
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME