Skip to content

Commit

Permalink
Merge 2a91970 into faa4779
Browse files Browse the repository at this point in the history
  • Loading branch information
markushi authored Nov 25, 2024
2 parents faa4779 + 2a91970 commit 58d722d
Show file tree
Hide file tree
Showing 70 changed files with 292 additions and 410 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#078)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.2...0.7.8)

### Breaking Changes

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

## 7.17.0

### Features
Expand Down
25 changes: 8 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import com.diffplug.spotless.LineEnding
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 +15,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 +25,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 @@ -139,7 +137,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 @@ -156,6 +154,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 @@ -178,23 +177,15 @@ 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>()

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

@Suppress("UnstableApiUsage")
configure<MavenPublishBaseExtension> {
assignAarTypes()
Expand All @@ -205,7 +196,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 @@ -242,7 +233,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
33 changes: 18 additions & 15 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.3.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.28.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 @@ -43,7 +46,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 Down Expand Up @@ -144,13 +147,13 @@ 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.6.0"

val apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"
Expand Down Expand Up @@ -190,7 +193,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 @@ -214,7 +217,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
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=7.18.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
4 changes: 3 additions & 1 deletion sentry-android-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<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 @@ -174,6 +175,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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.sentry.android.core
import android.content.Context
import android.content.Intent
import android.os.BatteryManager
import android.os.Build
import androidx.test.ext.junit.runners.AndroidJUnit4
import io.sentry.Breadcrumb
import io.sentry.IHub
Expand All @@ -19,13 +20,15 @@ import org.mockito.kotlin.never
import org.mockito.kotlin.verify
import org.mockito.kotlin.verifyNoMoreInteractions
import org.mockito.kotlin.whenever
import org.robolectric.annotation.Config
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertNull

@RunWith(AndroidJUnit4::class)
@Config(sdk = [Build.VERSION_CODES.TIRAMISU])
class SystemEventsBreadcrumbsIntegrationTest {

private class Fixture {
Expand All @@ -50,7 +53,7 @@ class SystemEventsBreadcrumbsIntegrationTest {

sut.register(fixture.hub, fixture.options)

verify(fixture.context).registerReceiver(any(), any())
verify(fixture.context).registerReceiver(any(), any(), any())
assertNotNull(sut.receiver)
}

Expand All @@ -69,7 +72,7 @@ class SystemEventsBreadcrumbsIntegrationTest {

sut.register(fixture.hub, fixture.options)

verify(fixture.context, never()).registerReceiver(any(), any())
verify(fixture.context, never()).registerReceiver(any(), any(), any())
assertNull(sut.receiver)
}

Expand Down Expand Up @@ -174,7 +177,7 @@ class SystemEventsBreadcrumbsIntegrationTest {
@Test
fun `Do not crash if registerReceiver throws exception`() {
val sut = fixture.getSut()
whenever(fixture.context.registerReceiver(any(), any())).thenThrow(SecurityException())
whenever(fixture.context.registerReceiver(any(), any(), any())).thenThrow(SecurityException())

sut.register(fixture.hub, fixture.options)

Expand Down
Loading

0 comments on commit 58d722d

Please sign in to comment.