Skip to content

Commit

Permalink
Merge 9278cd9 into ba51699
Browse files Browse the repository at this point in the history
  • Loading branch information
markushi authored Feb 4, 2025
2 parents ba51699 + 9278cd9 commit 6c7af4b
Show file tree
Hide file tree
Showing 92 changed files with 303 additions and 550 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 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))
Expand Down
43 changes: 26 additions & 17 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 @@ -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 @@ -243,7 +252,7 @@ spotless {

gradle.projectsEvaluated {
tasks.create("aggregateJavadocs", Javadoc::class.java) {
setDestinationDir(file("$buildDir/docs/javadoc"))
setDestinationDir(project.layout.buildDirectory.file("docs/javadoc").get().asFile)
title = "${project.name} $version API"
val opts = options as StandardJavadocDocletOptions
opts.quiet()
Expand Down
36 changes: 20 additions & 16 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
import java.math.BigDecimal

object Config {
val AGP = System.getenv("VERSION_AGP") ?: "7.4.2"
val kotlinVersion = "1.8.0"
val AGP = System.getenv("VERSION_AGP") ?: "8.6.0"
val kotlinVersion = "1.9.24"
val kotlinStdLib = "stdlib-jdk8"

val springBootVersion = "2.7.5"
val springBoot3Version = "3.4.2"
val kotlinCompatibleLanguageVersion = "1.4"
val kotlinCompatibleLanguageVersion = "1.6"

val composeVersion = "1.5.3"
val androidComposeCompilerVersion = "1.4.0"
// see https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-compatibility-and-versioning.html#kotlin-compatibility
// see https://developer.android.com/jetpack/androidx/releases/compose-kotlin
val composeVersion = "1.6.11"
val androidComposeCompilerVersion = "1.5.14"

object BuildPlugins {
val androidGradle = "com.android.tools.build:gradle:$AGP"
Expand All @@ -23,8 +25,9 @@ object Config {
val springDependencyManagementVersion = "1.0.11.RELEASE"
val gretty = "org.gretty"
val grettyVersion = "4.0.0"
val gradleMavenPublishPlugin = "com.vanniktech:gradle-maven-publish-plugin:0.18.0"
val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.7.10"
val gradleMavenPublishPlugin = "com.vanniktech.maven.publish"
val gradleMavenPublishPluginVersion = "0.30.0"
val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.9.20"
val dokkaPluginAlias = "org.jetbrains.dokka"
val composeGradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$composeVersion"
val commonsCompressOverride = "org.apache.commons:commons-compress:1.25.0"
Expand All @@ -39,7 +42,7 @@ object Config {

val abiFilters = listOf("x86", "armeabi-v7a", "x86_64", "arm64-v8a")

fun shouldSkipDebugVariant(name: String): Boolean {
fun shouldSkipDebugVariant(name: String?): Boolean {
return System.getenv("CI")?.toBoolean() ?: false && name == "debug"
}
}
Expand All @@ -58,6 +61,7 @@ object Config {
val androidxCore = "androidx.core:core:1.3.2"
val androidxSqlite = "androidx.sqlite:sqlite:2.3.1"
val androidxRecylerView = "androidx.recyclerview:recyclerview:1.2.1"
val androidxAnnotation = "androidx.annotation:annotation:1.9.1"

val slf4jApi = "org.slf4j:slf4j-api:1.7.30"
val slf4jApi2 = "org.slf4j:slf4j-api:2.0.5"
Expand Down Expand Up @@ -142,14 +146,14 @@ object Config {

// compose deps
val composeNavigation = "androidx.navigation:navigation-compose:$navigationVersion"
val composeActivity = "androidx.activity:activity-compose:1.4.0"
val composeFoundation = "androidx.compose.foundation:foundation:$composeVersion"
val composeUi = "androidx.compose.ui:ui:$composeVersion"
val composeActivity = "androidx.activity:activity-compose:1.8.2"
val composeFoundation = "androidx.compose.foundation:foundation:1.6.3"
val composeUi = "androidx.compose.ui:ui:1.6.3"
val composeFoundationLayout = "androidx.compose.foundation:foundation-layout:1.6.3"
val composeMaterial = "androidx.compose.material3:material3:1.2.1"

val composeUiReplay = "androidx.compose.ui:ui:1.5.0" // Note: don't change without testing forwards compatibility
val composeFoundationLayout = "androidx.compose.foundation:foundation-layout:$composeVersion"
val composeMaterial = "androidx.compose.material3:material3:1.0.0-alpha13"
val composeCoil = "io.coil-kt:coil-compose:2.0.0"
val composeCoil = "io.coil-kt:coil-compose:2.6.0"

val apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"

Expand Down Expand Up @@ -193,7 +197,7 @@ object Config {
val androidxTestOrchestrator = "androidx.test:orchestrator:1.5.0"
val androidxJunit = "androidx.test.ext:junit:1.1.5"
val androidxCoreKtx = "androidx.core:core-ktx:1.7.0"
val robolectric = "org.robolectric:robolectric:4.10.3"
val robolectric = "org.robolectric:robolectric:4.14"
val mockitoKotlin = "org.mockito.kotlin:mockito-kotlin:4.1.0"
val mockitoInline = "org.mockito:mockito-inline:4.8.0"
val awaitility = "org.awaitility:awaitility-kotlin:4.1.1"
Expand All @@ -220,7 +224,7 @@ object Config {
val gradleVersionsPlugin = "com.github.ben-manes:gradle-versions-plugin:0.42.0"
val gradleVersions = "com.github.ben-manes.versions"
val detekt = "io.gitlab.arturbosch.detekt"
val detektVersion = "1.19.0"
val detektVersion = "1.23.5"
val detektPlugin = "io.gitlab.arturbosch.detekt"
val binaryCompatibilityValidatorVersion = "0.13.0"
val binaryCompatibilityValidatorPlugin = "org.jetbrains.kotlinx:binary-compatibility-validator:$binaryCompatibilityValidatorVersion"
Expand Down
29 changes: 16 additions & 13 deletions buildSrc/src/main/java/Publication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ fun DistributionContainer.configureForMultiplatform(project: Project) {
}
from("build${sep}libs") {
include("*android*")
withJavadoc(renameTo = "compose-android")
include("*androidRelease-javadoc*")
rename {
it.replace("androidRelease-javadoc", "android")
}
}
}
this.getByName("main").contents {
Expand All @@ -38,8 +41,8 @@ fun DistributionContainer.configureForMultiplatform(project: Project) {
rename {
it.replace("-kotlin", "")
.replace("-metadata", "")
.replace("Multiplatform-javadoc", "")
}
withJavadoc()
}
}
this.maybeCreate("desktop").contents {
Expand All @@ -49,7 +52,10 @@ fun DistributionContainer.configureForMultiplatform(project: Project) {
}
from("build${sep}libs") {
include("*desktop*")
withJavadoc(renameTo = "compose-desktop")
include("*desktop-javadoc*")
rename {
it.replace("desktop-javadoc", "desktop")
}
}
}

Expand Down Expand Up @@ -77,16 +83,13 @@ fun DistributionContainer.configureForJvm(project: Project) {
from("build${sep}publications${sep}release") {
renameModule(project.name, version = version)
}
}
}

private fun CopySpec.withJavadoc(renameTo: String = "compose") {
include("*javadoc*")
rename {
if (it.contains("javadoc")) {
it.replace("compose", renameTo)
} else {
it
from("build${sep}intermediates${sep}java_doc_jar${sep}release") {
include("*javadoc*")
rename { it.replace("release", "${project.name}-$version") }
}
from("build${sep}intermediates${sep}source_jar${sep}release") {
include("*sources*")
rename { it.replace("release", "${project.name}-$version") }
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ org.gradle.workers.max=2
# AndroidX required by AGP >= 3.6.x
android.useAndroidX=true

# Required by AGP >= 8.0.x
android.defaults.buildfeatures.buildconfig=true

# Release information
versionName=8.1.0

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
11 changes: 6 additions & 5 deletions sentry-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ android {
namespace = "io.sentry.android.core"

defaultConfig {
targetSdk = Config.Android.targetSdkVersion
minSdk = Config.Android.minSdkVersion

testInstrumentationRunner = Config.TestLibs.androidJUnitRunner
Expand Down Expand Up @@ -53,15 +52,17 @@ android {
checkReleaseBuilds = false
}

buildFeatures {
buildConfig = true
}

// needed because of Kotlin 1.4.x
configurations.all {
resolutionStrategy.force(Config.CompileOnly.jetbrainsAnnotations)
}

variantFilter {
if (Config.Android.shouldSkipDebugVariant(buildType.name)) {
ignore = true
}
androidComponents.beforeVariants {
it.enable = !Config.Android.shouldSkipDebugVariant(it.buildType)
}
}

Expand Down
1 change: 1 addition & 0 deletions sentry-android-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>

<application>
<!-- 'android:authorities' must be unique in the device, across all apps -->
<provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public SentryFrameMetricsCollector(
this(context, logger, buildInfoProvider, new WindowFrameMetricsManager() {});
}

@SuppressWarnings("deprecation")
@SuppressLint({"NewApi", "DiscouragedPrivateApi"})
public SentryFrameMetricsCollector(
final @NotNull Context context,
Expand All @@ -79,7 +78,7 @@ public SentryFrameMetricsCollector(
}

@SuppressWarnings("deprecation")
@SuppressLint({"NewApi", "DiscouragedPrivateApi"})
@SuppressLint({"NewApi", "PrivateApi"})
public SentryFrameMetricsCollector(
final @NotNull Context context,
final @NotNull ILogger logger,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.sentry.android.core

import android.annotation.SuppressLint
import android.app.ActivityManager
import android.app.ActivityManager.MemoryInfo
import android.app.ActivityManager.RunningAppProcessInfo
Expand Down Expand Up @@ -175,6 +176,7 @@ class ContextUtilsTest {
assertNull(memInfo)
}

@SuppressLint("UnspecifiedRegisterReceiverFlag")
@Test
fun `registerReceiver calls context_registerReceiver without exported flag on API 32-`() {
val buildInfo = mock<BuildInfoProvider>()
Expand Down
Loading

0 comments on commit 6c7af4b

Please sign in to comment.