Skip to content

Commit d23b4ea

Browse files
authored
Update to Gradle 8.0 (#2563)
1 parent cfc50d3 commit d23b4ea

File tree

29 files changed

+87
-125
lines changed

29 files changed

+87
-125
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
- Fix timestamps of PerformanceCollectionData in profiles ([#2632](https://github.com/getsentry/sentry-java/pull/2632))
1414
- Fix missing propagateMinConstraints flag for SentryTraced ([#2637](https://github.com/getsentry/sentry-java/pull/2637))
1515

16+
### Dependencies
17+
- Bump compile Kotlin version to 1.8.0
18+
- Bump compile Compose version to 1.3.0
19+
- Bump Gradle from v7.6.0 to v8.0.2 ([#2563](https://github.com/getsentry/sentry-java/pull/2563))
20+
- [changelog](https://github.com/gradle/gradle/blob/master/CHANGELOG.md#v802)
21+
- [diff](https://github.com/gradle/gradle/compare/v7.6.0...v8.0.2)
22+
1623
## 6.17.0
1724

1825
### Features

build.gradle.kts

+24-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import com.diffplug.spotless.LineEnding
23
import com.vanniktech.maven.publish.MavenPublishPlugin
34
import com.vanniktech.maven.publish.MavenPublishPluginExtension
@@ -117,16 +118,27 @@ subprojects {
117118
from("build${sep}libs")
118119
from("build${sep}publications${sep}maven")
119120
// android modules
120-
from("build${sep}outputs${sep}aar")
121+
from("build${sep}outputs${sep}aar") {
122+
include("*-release*")
123+
}
121124
from("build${sep}publications${sep}release")
122125
}
123126
}
127+
// craft only uses zip archives
128+
this.forEach { dist ->
129+
if (dist.name == DistributionPlugin.MAIN_DISTRIBUTION_NAME) {
130+
tasks.getByName("distTar").enabled = false
131+
} else {
132+
tasks.getByName(dist.name + "DistTar").enabled = false
133+
}
134+
}
124135
}
125136

126137
tasks.named("distZip").configure {
127138
this.dependsOn("publishToMavenLocal")
128139
this.doLast {
129-
val distributionFilePath = "${this.project.buildDir}${sep}distributions${sep}${this.project.name}-${this.project.version}.zip"
140+
val distributionFilePath =
141+
"${this.project.buildDir}${sep}distributions${sep}${this.project.name}-${this.project.version}.zip"
130142
val file = File(distributionFilePath)
131143
if (!file.exists()) throw IllegalStateException("Distribution file: $distributionFilePath does not exist")
132144
if (file.length() == 0L) throw IllegalStateException("Distribution file: $distributionFilePath is empty")
@@ -160,14 +172,15 @@ spotless {
160172
googleJavaFormat()
161173
targetExclude("**/generated/**", "**/vendor/**")
162174
}
163-
164175
kotlin {
165176
target("**/*.kt")
166177
ktlint()
178+
targetExclude("**/sentry-native/**")
167179
}
168180
kotlinGradle {
169181
target("**/*.kts")
170182
ktlint()
183+
targetExclude("**/sentry-native/**")
171184
}
172185
}
173186

@@ -197,3 +210,11 @@ gradle.projectsEvaluated {
197210
}
198211
}
199212
}
213+
214+
// Workaround for https://youtrack.jetbrains.com/issue/IDEA-316081/Gradle-8-toolchain-error-Toolchain-from-executable-property-does-not-match-toolchain-from-javaLauncher-property-when-different
215+
gradle.taskGraph.whenReady {
216+
val task = this.allTasks.find { it.name.endsWith(".main()") } as? JavaExec
217+
task?.let {
218+
it.setExecutable(it.javaLauncher.get().executablePath.asFile.absolutePath)
219+
}
220+
}

buildSrc/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ repositories {
99
}
1010

1111
tasks.withType<KotlinCompile>().configureEach {
12-
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString()
12+
kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
1313
}

buildSrc/src/main/java/Config.kt

+6-7
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import java.math.BigDecimal
22

33
object Config {
44
val AGP = System.getenv("VERSION_AGP") ?: "7.3.0"
5-
val kotlinVersion = "1.6.10"
5+
val kotlinVersion = "1.8.0"
66
val kotlinStdLib = "stdlib-jdk8"
77

88
val springBootVersion = "2.7.5"
99
val springBoot3Version = "3.0.3"
1010
val kotlinCompatibleLanguageVersion = "1.4"
1111

12-
val composeVersion = "1.1.1"
12+
val composeVersion = "1.3.0"
13+
val androidComposeCompilerVersion = "1.4.0"
1314

1415
object BuildPlugins {
1516
val androidGradle = "com.android.tools.build:gradle:$AGP"
@@ -22,7 +23,7 @@ object Config {
2223
val gretty = "org.gretty"
2324
val grettyVersion = "4.0.0"
2425
val gradleMavenPublishPlugin = "com.vanniktech:gradle-maven-publish-plugin:0.18.0"
25-
val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:$kotlinVersion"
26+
val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.7.10"
2627
val dokkaPluginAlias = "org.jetbrains.dokka"
2728
val composeGradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$composeVersion"
2829
}
@@ -48,8 +49,7 @@ object Config {
4849
val okHttpVersion = "4.9.2"
4950
val appCompat = "androidx.appcompat:appcompat:1.3.0"
5051
val timber = "com.jakewharton.timber:timber:4.7.1"
51-
val okhttpBom = "com.squareup.okhttp3:okhttp-bom:$okHttpVersion"
52-
val okhttp = "com.squareup.okhttp3:okhttp"
52+
val okhttp = "com.squareup.okhttp3:okhttp:$okHttpVersion"
5353
val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.8.1"
5454
val constraintLayout = "androidx.constraintlayout:constraintlayout:2.1.3"
5555

@@ -178,7 +178,6 @@ object Config {
178178
val mockitoInline = "org.mockito:mockito-inline:4.8.0"
179179
val awaitility = "org.awaitility:awaitility-kotlin:4.1.1"
180180
val mockWebserver = "com.squareup.okhttp3:mockwebserver:${Libs.okHttpVersion}"
181-
val mockWebserver4 = "com.squareup.okhttp3:mockwebserver:4.9.3"
182181
val jsonUnit = "net.javacrumbs.json-unit:json-unit:2.32.0"
183182
val hsqldb = "org.hsqldb:hsqldb:2.6.1"
184183
val javaFaker = "com.github.javafaker:javafaker:1.0.2"
@@ -198,7 +197,7 @@ object Config {
198197
val detekt = "io.gitlab.arturbosch.detekt"
199198
val detektVersion = "1.19.0"
200199
val detektPlugin = "io.gitlab.arturbosch.detekt"
201-
val binaryCompatibilityValidatorVersion = "0.8.0"
200+
val binaryCompatibilityValidatorVersion = "0.13.0"
202201
val binaryCompatibilityValidatorPlugin = "org.jetbrains.kotlinx:binary-compatibility-validator:$binaryCompatibilityValidatorVersion"
203202
val binaryCompatibilityValidator = "org.jetbrains.kotlinx.binary-compatibility-validator"
204203
}

buildSrc/src/main/java/Publication.kt

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ fun DistributionContainer.configureForMultiplatform(project: Project) {
1414
this.maybeCreate("android").contents {
1515
from("build${sep}publications${sep}androidRelease")
1616
from("build${sep}outputs${sep}aar") {
17+
include("*-release*")
1718
rename {
1819
it.replace("-release", "-android-release")
1920
}

gradle/wrapper/gradle-wrapper.jar

818 Bytes
Binary file not shown.
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

gradlew

+8-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

8888
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
8989
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143143
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144144
case $MAX_FD in #(
145145
max*)
146+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+
# shellcheck disable=SC3045
146148
MAX_FD=$( ulimit -H -n ) ||
147149
warn "Could not query maximum file descriptor limit"
148150
esac
149151
case $MAX_FD in #(
150152
'' | soft) :;; #(
151153
*)
154+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+
# shellcheck disable=SC3045
152156
ulimit -n "$MAX_FD" ||
153157
warn "Could not set maximum file descriptor limit to $MAX_FD"
154158
esac

gradlew.bat

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
2828
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

sentry-android-core/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
INSTALLATION
2+
last_crash
3+
/sentry

sentry-android-fragment/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/build
2+
last_crash
3+
/sentry

sentry-android-integration-tests/sentry-uitest-android/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ android {
4040
}
4141

4242
composeOptions {
43-
kotlinCompilerExtensionVersion = Config.composeVersion
43+
kotlinCompilerExtensionVersion = Config.androidComposeCompilerVersion
4444
}
4545

4646
signingConfigs {

sentry-android-okhttp/build.gradle.kts

-2
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,11 @@ kotlin {
6969
dependencies {
7070
api(projects.sentry)
7171

72-
compileOnly(Config.Libs.okhttpBom)
7372
compileOnly(Config.Libs.okhttp)
7473

7574
implementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION))
7675

7776
// tests
78-
testImplementation(Config.Libs.okhttpBom)
7977
testImplementation(Config.Libs.okhttp)
8078
testImplementation(Config.TestLibs.kotlinTestJunit)
8179
testImplementation(Config.TestLibs.androidxJunit)

sentry-apollo-3/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies {
3939
testImplementation(Config.TestLibs.kotlinTestJunit)
4040
testImplementation(Config.TestLibs.mockitoKotlin)
4141
testImplementation(Config.TestLibs.mockitoInline)
42-
testImplementation(Config.TestLibs.mockWebserver4)
42+
testImplementation(Config.TestLibs.mockWebserver)
4343
}
4444

4545
configure<SourceSetContainer> {

sentry-apollo/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies {
3939
testImplementation(Config.TestLibs.kotlinTestJunit)
4040
testImplementation(Config.TestLibs.mockitoKotlin)
4141
testImplementation(Config.TestLibs.mockitoInline)
42-
testImplementation(Config.TestLibs.mockWebserver4)
42+
testImplementation(Config.TestLibs.mockWebserver)
4343
testImplementation(Config.Libs.apolloCoroutines)
4444
}
4545

sentry-compose/build.gradle.kts

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ kotlin {
2020

2121
android {
2222
publishLibraryVariants("release")
23+
compilations.all {
24+
kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8.toString()
25+
}
2326
}
2427
jvm("desktop") {
2528
compilations.all {
@@ -53,7 +56,7 @@ kotlin {
5356
implementation(Config.Libs.lifecycleCommonJava8)
5457
}
5558
}
56-
val androidTest by getting {
59+
val androidUnitTest by getting {
5760
dependencies {
5861
implementation(Config.TestLibs.kotlinTestJunit)
5962
implementation(Config.TestLibs.mockitoKotlin)

sentry-compose/gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
kotlin.mpp.stability.nowarn=true
2+
kotlin.mpp.androidSourceSetLayoutVersion=2

sentry-jdbc/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jacoco {
5050

5151
tasks.jacocoTestReport {
5252
reports {
53-
xml.isEnabled = true
54-
html.isEnabled = false
53+
xml.required.set(true)
54+
html.required.set(false)
5555
}
5656
}
5757

sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ jacoco {
5656

5757
tasks.jacocoTestReport {
5858
reports {
59-
xml.isEnabled = true
60-
html.isEnabled = false
59+
xml.required.set(true)
60+
html.required.set(false)
6161
}
6262
}
6363

sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ jacoco {
5353

5454
tasks.jacocoTestReport {
5555
reports {
56-
xml.isEnabled = true
57-
html.isEnabled = false
56+
xml.required.set(true)
57+
html.required.set(false)
5858
}
5959
}
6060

sentry-samples/sentry-samples-android/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ android {
4141
}
4242

4343
composeOptions {
44-
kotlinCompilerExtensionVersion = Config.composeVersion
44+
kotlinCompilerExtensionVersion = Config.androidComposeCompilerVersion
4545
}
4646

4747
dependenciesInfo {

sentry-servlet-jakarta/build.gradle.kts

-23
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
1-
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
21
import net.ltgt.gradle.errorprone.errorprone
32
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4-
import org.springframework.boot.gradle.plugin.SpringBootPlugin
53

64
plugins {
75
`java-library`
86
kotlin("jvm")
97
jacoco
108
id(Config.QualityPlugins.errorProne)
119
id(Config.QualityPlugins.gradleVersions)
12-
id(Config.BuildPlugins.springBoot) version Config.springBootVersion apply false
13-
id(Config.BuildPlugins.springDependencyManagement) version Config.BuildPlugins.springDependencyManagementVersion
1410
id(Config.BuildPlugins.buildConfig) version Config.BuildPlugins.buildConfigVersion
1511
}
1612

17-
the<DependencyManagementExtension>().apply {
18-
imports {
19-
mavenBom(SpringBootPlugin.BOM_COORDINATES)
20-
}
21-
}
22-
2313
configure<JavaPluginExtension> {
2414
sourceCompatibility = JavaVersion.VERSION_1_8
2515
targetCompatibility = JavaVersion.VERSION_1_8
@@ -77,19 +67,6 @@ tasks {
7767
dependsOn(jacocoTestReport)
7868
}
7969
}
80-
repositories {
81-
mavenCentral()
82-
}
83-
val compileKotlin: KotlinCompile by tasks
84-
compileKotlin.kotlinOptions {
85-
jvmTarget = JavaVersion.VERSION_1_8.toString()
86-
languageVersion = Config.kotlinCompatibleLanguageVersion
87-
}
88-
val compileTestKotlin: KotlinCompile by tasks
89-
compileTestKotlin.kotlinOptions {
90-
jvmTarget = JavaVersion.VERSION_1_8.toString()
91-
languageVersion = Config.kotlinCompatibleLanguageVersion
92-
}
9370

9471
tasks.withType<JavaCompile>().configureEach {
9572
options.errorprone {

0 commit comments

Comments
 (0)