Skip to content

Commit 40571f9

Browse files
chore: Upgrade Gradle wrapper from 8.14.2 to 9.3.1 (#247)
* chore: prepare for Gradle 9 migration - Remove jcenter() and use mavenCentral() only - Fix Groovy DSL syntax to use = assignment - Modernize task registration with tasks.register() - Replace deprecated variant.javaCompiler with javaCompileProvider - Replace deprecated indentWithSpaces with leadingTabsToSpaces in spotless - Add toolchain resolver plugin in settings.gradle - Move buildConfig feature flag from gradle.properties to build files - Add pluginManagement repositories in settings.gradle * chore: upgrade Gradle wrapper from 8.14.2 to 9.3.1 * docs: update build requirements for Gradle 9
1 parent db64486 commit 40571f9

File tree

11 files changed

+75
-65
lines changed

11 files changed

+75
-65
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Project and library organisation
44

5-
Building the project requires Android Studio 2022.3.1 and Gradle 8.
5+
Building the project requires Android Studio 2024.2.1 or later, Gradle 9.3.1, and JDK 17 or later.
66

77
The project consists of two modules:
88

app/build.gradle

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def RAYGUN_APP_PATH = "<YOUR RG APP UPLOAD PATH>"
2020
*/
2121
def createRaygunNotifyDeploymentTask(token,key,groupName,version,userName,userEmail) {
2222

23-
task "notifyDeployment" {
24-
group "${groupName}"
23+
tasks.register("notifyDeployment") {
24+
group = "${groupName}"
2525

2626
doLast {
2727
def result = configure {
@@ -47,8 +47,8 @@ def createRaygunNotifyDeploymentTask(token,key,groupName,version,userName,userEm
4747
*/
4848
def createRaygunProguardTask(token,raygunAppPath,groupName,version) {
4949

50-
task "uploadProguardMapping" {
51-
group "${groupName}"
50+
tasks.register("uploadProguardMapping") {
51+
group = "${groupName}"
5252

5353
doLast {
5454
def proguardMappingFileParam = "file=@${project.rootDir}/app/build/outputs/mapping/release/mapping.txt"
@@ -79,13 +79,13 @@ android {
7979
compileSdk = 36
8080

8181
defaultConfig {
82-
applicationId "com.raygun.raygun4android"
83-
minSdkVersion 23
84-
targetSdkVersion 36
82+
applicationId = "com.raygun.raygun4android"
83+
minSdkVersion = 23
84+
targetSdkVersion = 36
8585
buildConfigField("long", "VERSION_CODE", VERSION_CODE)
8686
buildConfigField("String","VERSION_NAME","\"${VERSION_NAME}-sample\"")
87-
multiDexEnabled true
88-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
87+
multiDexEnabled = true
88+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
8989
}
9090

9191
lintOptions {
@@ -94,21 +94,22 @@ android {
9494

9595
buildTypes {
9696
release {
97-
debuggable false
98-
minifyEnabled true
97+
debuggable = false
98+
minifyEnabled = true
9999
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
100-
signingConfig signingConfigs.releaseConfig
100+
signingConfig = signingConfigs.releaseConfig
101101
}
102102
debug {
103-
debuggable true
104-
minifyEnabled false
105-
applicationIdSuffix '.debug'
106-
versionNameSuffix '-DEBUG'
103+
debuggable = true
104+
minifyEnabled = false
105+
applicationIdSuffix = '.debug'
106+
versionNameSuffix = '-DEBUG'
107107
}
108108
}
109109

110110
buildFeatures {
111-
viewBinding true
111+
viewBinding = true
112+
buildConfig = true
112113
}
113114

114115
compileOptions {
@@ -125,7 +126,7 @@ android {
125126
// Setup RG tasks
126127
createRaygunNotifyDeploymentTask(RAYGUN_API_TOKEN, RAYGUN_API_KEY, RAYGUN_GROUP, defaultConfig.versionName, localUserName, localUserEmail)
127128
createRaygunProguardTask(RAYGUN_API_TOKEN, RAYGUN_APP_PATH, RAYGUN_GROUP, defaultConfig.versionName)
128-
namespace 'com.raygun.raygun4android.sample'
129+
namespace = 'com.raygun.raygun4android.sample'
129130
}
130131

131132
dependencies {

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
buildscript {
22
repositories {
33
google()
4-
jcenter()
4+
mavenCentral()
55
}
66
dependencies {
77
classpath(libs.github.http.builder.core)
@@ -20,7 +20,6 @@ allprojects {
2020
repositories {
2121
google()
2222
mavenCentral()
23-
jcenter()
2423
}
2524
}
2625

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ POM_DEVELOPER_2_ID=miquelbeltran
6060
POM_DEVELOPER_2_NAME=Miguel Beltran
6161

6262
android.useAndroidX=true
63-
android.defaults.buildfeatures.buildconfig=true
6463
android.nonTransitiveRClass=true
6564
android.nonFinalResIds=false
6665

gradle/wrapper/gradle-wrapper.jar

2.61 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/build.gradle

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,28 @@ android {
55
compileSdk = 36
66

77
defaultConfig {
8-
minSdkVersion 23
9-
targetSdkVersion 34
8+
minSdkVersion = 23
9+
targetSdkVersion = 34
1010
buildConfigField("long", "VERSION_CODE", VERSION_CODE)
1111
buildConfigField("String","VERSION_NAME","\"${VERSION_NAME}\"")
1212
}
1313

1414
buildTypes {
1515
debug {
16-
debuggable true
17-
minifyEnabled false
16+
debuggable = true
17+
minifyEnabled = false
1818
}
1919
release {
20-
debuggable false
21-
minifyEnabled false
22-
consumerProguardFiles 'proguard-rules.pro'
20+
debuggable = false
21+
minifyEnabled = false
22+
consumerProguardFiles = ['proguard-rules.pro']
2323
}
2424
}
2525

26+
buildFeatures {
27+
buildConfig = true
28+
}
29+
2630
compileOptions {
2731
sourceCompatibility JavaVersion.VERSION_17
2832
targetCompatibility JavaVersion.VERSION_17
@@ -34,31 +38,31 @@ android {
3438
jvmToolchain(17)
3539
}
3640

37-
namespace 'com.raygun.raygun4android'
41+
namespace = 'com.raygun.raygun4android'
42+
43+
}
44+
45+
afterEvaluate {
46+
android.libraryVariants.all { variant ->
47+
def variantName = variant.name
48+
def capitalizedName = variantName.capitalize()
3849

39-
libraryVariants.all { variant ->
40-
variant.outputs.all { output ->
41-
if (outputFile != null && outputFileName.endsWith('.aar')) {
42-
if (variant.name == 'debug') {
43-
outputFileName = "raygun4android-debug.aar"
44-
} else {
45-
outputFileName = "raygun4android.aar"
46-
}
47-
}
50+
tasks.named("bundle${capitalizedName}Aar").configure {
51+
archiveFileName.set(variantName == 'debug' ? "raygun4android-debug.aar" : "raygun4android.aar")
4852
}
4953
}
54+
}
5055

51-
libraryVariants.all { variant ->
52-
if (variant.name == 'release') {
53-
task androidJavadocs(type: Javadoc) {
54-
source = android.sourceSets.main.java.srcDirs
55-
source += android.sourceSets.release.java.srcDirs
56-
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
57-
classpath += variant.javaCompiler.classpath
58-
classpath += files("build/generated/source/buildConfig/release")
56+
android.libraryVariants.all { variant ->
57+
if (variant.name == 'release') {
58+
tasks.register("androidJavadocs", Javadoc) {
59+
source = android.sourceSets.main.java.srcDirs
60+
source += android.sourceSets.release.java.srcDirs
61+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
62+
classpath += variant.javaCompileProvider.get().classpath
63+
classpath += files("build/generated/source/buildConfig/release")
5964

60-
options.windowTitle = "Raygun4Android"
61-
}
65+
options.windowTitle = "Raygun4Android"
6266
}
6367
}
6468
}

settings.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1+
pluginManagement {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
gradlePluginPortal()
6+
}
7+
}
8+
9+
plugins {
10+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.10.0'
11+
}
12+
113
include ':app', ':provider'

0 commit comments

Comments
 (0)