Skip to content

Commit

Permalink
Make SentryUploadNativeSymbolsTask configuration-cache compatible (#747)
Browse files Browse the repository at this point in the history
  • Loading branch information
romtsn authored Aug 5, 2024
1 parent e3f61e3 commit 4c54dc2
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Fix plugin for spring-dependency-management 1.1.6 ([#741](https://github.com/getsentry/sentry-android-gradle-plugin/pull/741))
- Make `SentryUploadNativeSymbolsTask` configuration-cache compatible ([#747](https://github.com/getsentry/sentry-android-gradle-plugin/pull/747))

### Dependencies

Expand Down
2 changes: 1 addition & 1 deletion plugin-build/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ dependencies {
testImplementationAar(Libs.SQLITE)
testImplementationAar(Libs.SQLITE_FRAMEWORK)
testRuntimeOnly(files(androidSdkPath))
testImplementation(Libs.SENTRY_ANDROID)
testImplementationAar(Libs.SENTRY_ANDROID)
testImplementationAar(Libs.SENTRY_ANDROID_OKHTTP)
testImplementationAar(Libs.SENTRY_OKHTTP)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ abstract class SentryUploadNativeSymbolsTask : SentryCliExecTask() {
@get:Internal
abstract val variantName: Property<String>

private val buildDir: Provider<File> = project.layout.buildDirectory.asFile

override fun getArguments(args: MutableList<String>) {
args.add("debug-files")
args.add("upload")
Expand All @@ -46,7 +48,7 @@ abstract class SentryUploadNativeSymbolsTask : SentryCliExecTask() {
// where {variantName} could be debug/release...
args.add(
File(
project.buildDir,
buildDir.get(),
"intermediates${sep}merged_native_libs${sep}${variantName.get()}"
).absolutePath
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,44 @@ class SentryPluginConfigurationCacheTest :
val run = runner.build()
assertTrue(run.output) { "BUILD SUCCESSFUL" in run.output }
}

@Test
fun `native symbols upload task respects configuration cache`() {
assumeThat(
"SentryUploadNativeSymbolsTask only supports " +
"configuration cache from Gradle 7.5 onwards",
GradleVersions.CURRENT >= GradleVersions.VERSION_7_5,
`is`(true)
)
appBuildFile.writeText(
// language=Groovy
"""
plugins {
id "com.android.application"
id "io.sentry.android.gradle"
}
android {
namespace 'com.example'
}
sentry {
includeNativeSources = true
uploadNativeSymbols = true
includeProguardMapping = false
autoUploadProguardMapping = false
autoInstallation.enabled = false
telemetry = false
}
""".trimIndent()
)
runner.appendArguments(":app:assembleRelease")
.appendArguments("--configuration-cache")

val output = runner.build().output
assertTrue { "Configuration cache entry stored." in output }

val outputWithConfigCache = runner.build().output
assertTrue { "Configuration cache entry reused." in outputWithConfigCache }
}
}

0 comments on commit 4c54dc2

Please sign in to comment.