Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Gradle, AGP and Kotlin versions #3936

Merged
merged 19 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/agp-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
env:
VERSION_AGP: ${{ matrix.agp }}
APPLY_SENTRY_INTEGRATIONS: ${{ matrix.integrations }}
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Checkout Repo
Expand All @@ -41,6 +42,7 @@ jobs:
uses: gradle/actions/setup-gradle@8790d96bb8fdd8ae7edfb2eada090c650b257f27 # pin@v3
with:
gradle-home-cache-cleanup: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

- name: Setup KVM
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
name: Build Job ubuntu-latest - Java 17
runs-on: ubuntu-latest

env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand All @@ -30,6 +33,7 @@ jobs:
uses: gradle/actions/setup-gradle@8790d96bb8fdd8ae7edfb2eada090c650b257f27 # pin@v3
with:
gradle-home-cache-cleanup: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

- name: Run Tests with coverage and Lint
run: make preMerge
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Checkout Repo
Expand All @@ -37,6 +37,7 @@ jobs:
uses: gradle/actions/setup-gradle@8790d96bb8fdd8ae7edfb2eada090c650b257f27 # pin@v3
with:
gradle-home-cache-cleanup: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

- name: Initialize CodeQL
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # pin@v2
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/gradle-wrapper-validation.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/integration-tests-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
# we copy the secret to the env variable in order to access it in the workflow
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Git checkout
Expand All @@ -40,6 +41,7 @@ jobs:
uses: gradle/actions/setup-gradle@8790d96bb8fdd8ae7edfb2eada090c650b257f27 # pin@v3
with:
gradle-home-cache-cleanup: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

# Clean, build and release a test apk, but only if we will run the benchmark
- name: Make assembleBenchmarks
Expand Down Expand Up @@ -72,6 +74,7 @@ jobs:
# we copy the secret to the env variable in order to access it in the workflow
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Git checkout
Expand All @@ -89,6 +92,7 @@ jobs:
uses: gradle/actions/setup-gradle@8790d96bb8fdd8ae7edfb2eada090c650b257f27 # pin@v3
with:
gradle-home-cache-cleanup: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

- uses: actions/cache@v4
id: app-plain-cache
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/integration-tests-ui-critical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest

env:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -35,6 +39,7 @@ jobs:
uses: gradle/actions/setup-gradle@8790d96bb8fdd8ae7edfb2eada090c650b257f27 # pin@v3
with:
gradle-home-cache-cleanup: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

- name: Build debug APK
run: make assembleUiTestCriticalRelease
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/integration-tests-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

steps:
- name: Git checkout
Expand All @@ -35,6 +36,7 @@ jobs:
uses: gradle/actions/setup-gradle@8790d96bb8fdd8ae7edfb2eada090c650b257f27 # pin@v3
with:
gradle-home-cache-cleanup: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}

# Clean, build and release a test apk, but only if we will run the benchmark
- name: Make assembleUiTests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/system-tests-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ jobs:

- name: Build server jar
run: |
./gradlew :sentry-samples:${{ matrix.sample }}:bootJar
./gradlew :sentry-samples:${{ matrix.sample }}:bootJar --no-configuration-cache

- name: Build agent jar
run: |
./gradlew :sentry-opentelemetry:sentry-opentelemetry-agent:assemble
./gradlew :sentry-opentelemetry:sentry-opentelemetry-agent:assemble --no-configuration-cache

- name: Start server and run integration test for sentry-cli commands
run: |
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

## Unreleased

### Breaking Changes

- The Kotlin Language version is now set to 1.6 ([#3936](https://github.com/getsentry/sentry-java/pull/3936))

### Fixes

- Do not log if `OtelContextScopesStorage` cannot be found ([#4127](https://github.com/getsentry/sentry-java/pull/4127))
- Previously `java.lang.ClassNotFoundException: io.sentry.opentelemetry.OtelContextScopesStorage` was shown in the log if the class could not be found.
- This is just a lookup the SDK performs to configure itself. The SDK also works without OpenTelemetry.
- Mention javadoc and sources for published artifacts in Gradle `.module` metadata ([#3936](https://github.com/getsentry/sentry-java/pull/3936))

### Dependencies

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish: clean dryRelease

# deep clean
clean:
./gradlew clean
./gradlew clean --no-configuration-cache
rm -rf distributions

# build and run tests
Expand All @@ -20,7 +20,7 @@ javadocs:

# do a dry release (like a local deploy)
dryRelease:
./gradlew aggregateJavadocs distZip --no-build-cache
./gradlew aggregateJavadocs distZip --no-build-cache --no-configuration-cache

# check for dependencies update
update:
Expand Down
119 changes: 63 additions & 56 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import com.diffplug.spotless.LineEnding
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.MavenPublishPlugin
import com.vanniktech.maven.publish.MavenPublishPluginExtension
import groovy.util.Node
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import kotlinx.kover.gradle.plugin.dsl.KoverReportExtension
Expand All @@ -17,6 +17,7 @@ plugins {
id(Config.QualityPlugins.binaryCompatibilityValidator) version Config.QualityPlugins.binaryCompatibilityValidatorVersion
id(Config.QualityPlugins.jacocoAndroid) version Config.QualityPlugins.jacocoAndroidVersion apply false
id(Config.QualityPlugins.kover) version Config.QualityPlugins.koverVersion apply false
id(Config.BuildPlugins.gradleMavenPublishPlugin) version Config.BuildPlugins.gradleMavenPublishPluginVersion apply false
}

buildscript {
Expand All @@ -26,7 +27,6 @@ buildscript {
dependencies {
classpath(Config.BuildPlugins.androidGradle)
classpath(kotlin(Config.BuildPlugins.kotlinGradlePlugin, version = Config.kotlinVersion))
classpath(Config.BuildPlugins.gradleMavenPublishPlugin)
// dokka is required by gradle-maven-publish-plugin.
classpath(Config.BuildPlugins.dokkaPlugin)
classpath(Config.QualityPlugins.errorpronePlugin)
Expand Down Expand Up @@ -95,7 +95,7 @@ allprojects {
TestLogEvent.PASSED,
TestLogEvent.FAILED
)
maxParallelForks = Runtime.getRuntime().availableProcessors() / 4
maxParallelForks = 1

// Cap JVM args per test
minHeapSize = "256m"
Expand Down Expand Up @@ -140,7 +140,7 @@ subprojects {
androidReports("release") {
xml {
// Change the report file name so the Codecov Github action can find it
setReportFile(file("$buildDir/reports/kover/report.xml"))
setReportFile(project.layout.buildDirectory.file("reports/kover/report.xml").get().asFile)
}
}
}
Expand All @@ -157,6 +157,7 @@ subprojects {

if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-test-support" && this.name != "sentry-compose-helper") {
apply<DistributionPlugin>()
apply<com.vanniktech.maven.publish.MavenPublishPlugin>()

val sep = File.separator

Expand All @@ -179,22 +180,30 @@ subprojects {
tasks.named("distZip").configure {
this.dependsOn("publishToMavenLocal")
this.doLast {
val distributionFilePath =
"${this.project.buildDir}${sep}distributions${sep}${this.project.name}-${this.project.version}.zip"
val file = File(distributionFilePath)
if (!file.exists()) throw IllegalStateException("Distribution file: $distributionFilePath does not exist")
if (file.length() == 0L) throw IllegalStateException("Distribution file: $distributionFilePath is empty")
val file = this.project.layout.buildDirectory.file("distributions${sep}${this.project.name}-${this.project.version}.zip").get().asFile
if (!file.exists()) throw IllegalStateException("Distribution file: ${file.absolutePath} does not exist")
if (file.length() == 0L) throw IllegalStateException("Distribution file: ${file.absolutePath} is empty")
}
}

afterEvaluate {
apply<MavenPublishPlugin>()
plugins.withId("java-library") {
configure<MavenPublishBaseExtension> {
// we have to disable javadoc publication in maven-publish plugin as it's not
// including it in the .module file https://github.com/vanniktech/gradle-maven-publish-plugin/issues/861
// and do it ourselves
configure(JavaLibrary(JavadocJar.None(), sourcesJar = true))
}

configure<JavaPluginExtension> {
withJavadocJar()

configure<MavenPublishPluginExtension> {
// signing is done when uploading files to MC
// via gpg:sign-and-deploy-file (release.kts)
releaseSigningEnabled = false
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

afterEvaluate {
apply<MavenPublishPlugin>()

@Suppress("UnstableApiUsage")
configure<MavenPublishBaseExtension> {
Expand All @@ -206,7 +215,7 @@ subprojects {
repositories {
maven {
name = "unityMaven"
url = file("${rootProject.buildDir}/unityMaven").toURI()
url = rootProject.layout.buildDirectory.file("unityMaven").get().asFile.toURI()
}
}
}
Expand Down Expand Up @@ -241,48 +250,46 @@ spotless {
}
}

gradle.projectsEvaluated {
tasks.create("aggregateJavadocs", Javadoc::class.java) {
setDestinationDir(file("$buildDir/docs/javadoc"))
title = "${project.name} $version API"
val opts = options as StandardJavadocDocletOptions
opts.quiet()
opts.encoding = "UTF-8"
opts.memberLevel = JavadocMemberLevel.PROTECTED
opts.stylesheetFile(file("$projectDir/docs/stylesheet.css"))
opts.links = listOf(
"https://docs.oracle.com/javase/8/docs/api/",
"https://docs.spring.io/spring-framework/docs/current/javadoc-api/",
"https://docs.spring.io/spring-boot/docs/current/api/"
)
subprojects
.filter { !it.name.contains("sample") && !it.name.contains("integration-tests") }
.forEach { proj ->
proj.tasks.withType<Javadoc>().forEach { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
excludes += javadocTask.excludes
includes += javadocTask.includes
}
tasks.register("aggregateJavadocs", Javadoc::class.java) {
setDestinationDir(project.layout.buildDirectory.file("docs/javadoc").get().asFile)
title = "${project.name} $version API"
val opts = options as StandardJavadocDocletOptions
opts.quiet()
opts.encoding = "UTF-8"
opts.memberLevel = JavadocMemberLevel.PROTECTED
opts.stylesheetFile(file("$projectDir/docs/stylesheet.css"))
opts.links = listOf(
"https://docs.oracle.com/javase/8/docs/api/",
"https://docs.spring.io/spring-framework/docs/current/javadoc-api/",
"https://docs.spring.io/spring-boot/docs/current/api/"
)
subprojects
.filter { !it.name.contains("sample") && !it.name.contains("integration-tests") }
.forEach { proj ->
proj.tasks.withType<Javadoc>().forEach { javadocTask ->
source += javadocTask.source
classpath += javadocTask.classpath
excludes += javadocTask.excludes
includes += javadocTask.includes
}
}
}
}

tasks.create("buildForCodeQL") {
subprojects
.filter {
!it.displayName.contains("sample") &&
!it.displayName.contains("integration-tests") &&
!it.displayName.contains("bom") &&
it.name != "sentry-opentelemetry"
}
.forEach { proj ->
if (proj.plugins.hasPlugin("com.android.library")) {
this.dependsOn(proj.tasks.findByName("compileReleaseUnitTestSources"))
} else {
this.dependsOn(proj.tasks.findByName("testClasses"))
}
tasks.register("buildForCodeQL") {
subprojects
.filter {
!it.displayName.contains("sample") &&
!it.displayName.contains("integration-tests") &&
!it.displayName.contains("bom") &&
it.name != "sentry-opentelemetry"
}
.forEach { proj ->
if (proj.plugins.hasPlugin("com.android.library")) {
this.dependsOn(proj.tasks.findByName("compileReleaseUnitTestSources"))
} else {
this.dependsOn(proj.tasks.findByName("testClasses"))
}
}
}
}

// 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
Expand Down
Loading
Loading