-
-
Notifications
You must be signed in to change notification settings - Fork 39
5.x.x #982
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
Draft
adinauer
wants to merge
16
commits into
rz/backport/5.10.0
Choose a base branch
from
5.x.x
base: rz/backport/5.10.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
5.x.x #982
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a9dd3c6
Auto install Spring Boot 4 and Spring 7 modules
adinauer 9731ae3
bump Java SDK to 8.21.1
adinauer 718a947
fix changelog
adinauer 9b4fcc5
revert tests
adinauer 006a157
release: 5.11.0
getsentry-bot 72b201f
Merge branch 'release/5.11.0' into 5.x.x
45d1e34
chore(deps): update Android SDK to v8.22.0 (#989)
lcian 07eb798
release: 5.12.0
getsentry-bot 4e47c46
Merge branch 'release/5.12.0' into 5.x.x
328436e
fix(kotlin-compiler): Fix Modifier.sentryTag() not found warning (#997)
romtsn 3bf836b
release: 5.12.1
getsentry-bot 7b8fb2a
Fix build
romtsn 1631a66
Merge branch 'release/5.12.1' into 5.x.x
35cd5c8
fix(proguard): Fix compatibility with AGP 9.x when uploading proguard…
romtsn 43f4f6b
release: 5.12.2
getsentry-bot 63325e3
Merge branch 'release/5.12.2' into 5.x.x
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ild/src/main/kotlin/io/sentry/android/gradle/autoinstall/spring/Spring7InstallStrategy.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package io.sentry.android.gradle.autoinstall.spring | ||
|
|
||
| import io.sentry.android.gradle.SentryPlugin | ||
| import io.sentry.android.gradle.autoinstall.AbstractInstallStrategy | ||
| import io.sentry.android.gradle.autoinstall.InstallStrategyRegistrar | ||
| import io.sentry.android.gradle.util.SemVer | ||
| import javax.inject.Inject | ||
| import org.gradle.api.artifacts.dsl.ComponentMetadataHandler | ||
| import org.slf4j.Logger | ||
|
|
||
| // @CacheableRule | ||
| abstract class Spring7InstallStrategy : AbstractInstallStrategy { | ||
|
|
||
| constructor(logger: Logger) : super() { | ||
| this.logger = logger | ||
| } | ||
|
|
||
| @Suppress("unused") // used by Gradle | ||
| @Inject // inject is needed to avoid Gradle error | ||
| constructor() : this(SentryPlugin.logger) | ||
|
|
||
| override val sentryModuleId: String | ||
| get() = SENTRY_SPRING_7_ID | ||
|
|
||
| override val minSupportedThirdPartyVersion: SemVer | ||
| get() = MIN_SUPPORTED_VERSION | ||
|
|
||
| override val maxSupportedThirdPartyVersion: SemVer | ||
| get() = MAX_SUPPORTED_VERSION | ||
|
|
||
| override val minSupportedSentryVersion: SemVer | ||
| get() = SemVer(8, 21, 0) | ||
|
|
||
| companion object Registrar : InstallStrategyRegistrar { | ||
| private const val SPRING_GROUP = "org.springframework" | ||
| private const val SPRING_7_ID = "spring-core" | ||
| internal const val SENTRY_SPRING_7_ID = "sentry-spring-7" | ||
|
|
||
| private val MIN_SUPPORTED_VERSION = SemVer(7, 0, 0, "M1") | ||
| private val MAX_SUPPORTED_VERSION = SemVer(7, 9999, 9999) | ||
|
|
||
| override fun register(component: ComponentMetadataHandler) { | ||
| component.withModule("$SPRING_GROUP:$SPRING_7_ID", Spring7InstallStrategy::class.java) {} | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...src/main/kotlin/io/sentry/android/gradle/autoinstall/spring/SpringBoot4InstallStrategy.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package io.sentry.android.gradle.autoinstall.spring | ||
|
|
||
| import io.sentry.android.gradle.SentryPlugin | ||
| import io.sentry.android.gradle.autoinstall.AbstractInstallStrategy | ||
| import io.sentry.android.gradle.autoinstall.InstallStrategyRegistrar | ||
| import io.sentry.android.gradle.util.SemVer | ||
| import javax.inject.Inject | ||
| import org.gradle.api.artifacts.dsl.ComponentMetadataHandler | ||
| import org.slf4j.Logger | ||
|
|
||
| // @CacheableRule | ||
| abstract class SpringBoot4InstallStrategy : AbstractInstallStrategy { | ||
|
|
||
| constructor(logger: Logger) : super() { | ||
| this.logger = logger | ||
| } | ||
|
|
||
| @Suppress("unused") // used by Gradle | ||
| @Inject // inject is needed to avoid Gradle error | ||
| constructor() : this(SentryPlugin.logger) | ||
|
|
||
| override val sentryModuleId: String | ||
| get() = SENTRY_SPRING_BOOT_4_ID | ||
|
|
||
| override val minSupportedThirdPartyVersion: SemVer | ||
| get() = MIN_SUPPORTED_VERSION | ||
|
|
||
| override val maxSupportedThirdPartyVersion: SemVer | ||
| get() = MAX_SUPPORTED_VERSION | ||
|
|
||
| override val minSupportedSentryVersion: SemVer | ||
| get() = SemVer(8, 21, 0) | ||
|
|
||
| companion object Registrar : InstallStrategyRegistrar { | ||
| private const val SPRING_GROUP = "org.springframework.boot" | ||
| private const val SPRING_BOOT_4_ID = "spring-boot" | ||
| internal const val SENTRY_SPRING_BOOT_4_ID = "sentry-spring-boot-4" | ||
|
|
||
| private val MIN_SUPPORTED_VERSION = SemVer(4, 0, 0, "M1") | ||
| private val MAX_SUPPORTED_VERSION = SemVer(4, 9999, 9999) | ||
|
|
||
| override fun register(component: ComponentMetadataHandler) { | ||
| component.withModule( | ||
| "$SPRING_GROUP:$SPRING_BOOT_4_ID", | ||
| SpringBoot4InstallStrategy::class.java, | ||
| ) {} | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
...src/test/kotlin/io/sentry/android/gradle/autoinstall/spring/Spring7InstallStrategyTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| package io.sentry.android.gradle.autoinstall.spring | ||
|
|
||
| import com.nhaarman.mockitokotlin2.any | ||
| import com.nhaarman.mockitokotlin2.doAnswer | ||
| import com.nhaarman.mockitokotlin2.doReturn | ||
| import com.nhaarman.mockitokotlin2.mock | ||
| import com.nhaarman.mockitokotlin2.never | ||
| import com.nhaarman.mockitokotlin2.verify | ||
| import com.nhaarman.mockitokotlin2.whenever | ||
| import io.sentry.android.gradle.autoinstall.AutoInstallState | ||
| import io.sentry.android.gradle.instrumentation.fakes.CapturingTestLogger | ||
| import kotlin.test.assertEquals | ||
| import kotlin.test.assertTrue | ||
| import org.gradle.api.Action | ||
| import org.gradle.api.artifacts.ComponentMetadataContext | ||
| import org.gradle.api.artifacts.ComponentMetadataDetails | ||
| import org.gradle.api.artifacts.DirectDependenciesMetadata | ||
| import org.gradle.api.artifacts.ModuleVersionIdentifier | ||
| import org.gradle.api.artifacts.VariantMetadata | ||
| import org.junit.Test | ||
| import org.slf4j.Logger | ||
|
|
||
| class Spring7InstallStrategyTest { | ||
| class Fixture { | ||
| val logger = CapturingTestLogger() | ||
| val dependencies = mock<DirectDependenciesMetadata>() | ||
| val metadataDetails = mock<ComponentMetadataDetails>() | ||
| val metadataContext = | ||
| mock<ComponentMetadataContext> { | ||
| whenever(it.details).thenReturn(metadataDetails) | ||
| val metadata = mock<VariantMetadata>() | ||
| doAnswer { (it.arguments[0] as Action<DirectDependenciesMetadata>).execute(dependencies) } | ||
| .whenever(metadata) | ||
| .withDependencies(any<Action<DirectDependenciesMetadata>>()) | ||
|
|
||
| doAnswer { | ||
| // trigger the callback registered in tests | ||
| (it.arguments[0] as Action<VariantMetadata>).execute(metadata) | ||
| } | ||
| .whenever(metadataDetails) | ||
| .allVariants(any<Action<VariantMetadata>>()) | ||
| } | ||
|
|
||
| fun getSut(springVersion: String = "7.0.0"): Spring7InstallStrategy { | ||
| val id = mock<ModuleVersionIdentifier> { whenever(it.version).doReturn(springVersion) } | ||
| whenever(metadataDetails.id).thenReturn(id) | ||
|
|
||
| with(AutoInstallState.getInstance()) { | ||
| this.enabled = true | ||
| this.sentryVersion = "8.21.0" | ||
| } | ||
| return Spring7InstallStrategyImpl(logger) | ||
| } | ||
| } | ||
|
|
||
| private val fixture = Fixture() | ||
|
|
||
| @Test | ||
| fun `when spring version is too low logs a message and does nothing`() { | ||
| val sut = fixture.getSut(springVersion = "6.7.4") | ||
| sut.execute(fixture.metadataContext) | ||
|
|
||
| assertTrue { | ||
| fixture.logger.capturedMessage == | ||
| "[sentry] sentry-spring-7 won't be installed because the current " + | ||
| "version (6.7.4) is lower than the minimum supported version (7.0.0-M1)" | ||
| } | ||
| verify(fixture.metadataDetails, never()).allVariants(any()) | ||
| } | ||
|
|
||
| @Test | ||
| fun `when spring version is too high logs a message and does nothing`() { | ||
| val sut = fixture.getSut(springVersion = "8.0.0") | ||
| sut.execute(fixture.metadataContext) | ||
|
|
||
| assertTrue { | ||
| fixture.logger.capturedMessage == | ||
| "[sentry] sentry-spring-7 won't be installed because the current " + | ||
| "version (8.0.0) is higher than the maximum supported version (7.9999.9999)" | ||
| } | ||
| verify(fixture.metadataDetails, never()).allVariants(any()) | ||
| } | ||
|
|
||
| @Test | ||
| fun `installs sentry-spring-jakarta with info message`() { | ||
| val sut = fixture.getSut() | ||
| sut.execute(fixture.metadataContext) | ||
|
|
||
| assertTrue { | ||
| fixture.logger.capturedMessage == | ||
| "[sentry] sentry-spring-7 was successfully installed with version: 8.21.0" | ||
| } | ||
| verify(fixture.dependencies) | ||
| .add( | ||
| com.nhaarman.mockitokotlin2.check<String> { | ||
| assertEquals("io.sentry:sentry-spring-7:8.21.0", it) | ||
| } | ||
| ) | ||
| } | ||
|
|
||
| private class Spring7InstallStrategyImpl(logger: Logger) : Spring7InstallStrategy(logger) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be from 8.20.0 to 8.21.1, see 5.10.0: https://github.com/getsentry/sentry-android-gradle-plugin/blob/5.10.0/CHANGELOG.md#dependencies