Skip to content

Commit 08ffa5a

Browse files
authored
fix: remove the dependency on protobuf-lite for tombstones (#5157)
* fix: remove the dependency on protobuf-lite for tombstones * update changelog * gate the close() on the underlying input stream * add scheduled GHA workflow to check for changes in the tombstone protobuf schema
1 parent dde4bad commit 08ffa5a

File tree

9 files changed

+294
-478
lines changed

9 files changed

+294
-478
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Check Tombstone Proto Schema
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v6
14+
15+
- name: Check for newer Tombstone proto schema
16+
run: ./scripts/check-tombstone-proto-schema.sh

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Common: Finalize previous session even when auto session tracking is disabled ([#5154](https://github.com/getsentry/sentry-java/pull/5154))
88
- Android: Add `filterTouchesWhenObscured` to prevent Tapjacking on user feedback dialog ([#5155](https://github.com/getsentry/sentry-java/pull/5155))
99
- Android: Add proguard rules to prevent error about missing Replay classes ([#5153](https://github.com/getsentry/sentry-java/pull/5153))
10+
- Android: Remove the dependency on protobuf-lite for tombstones ([#5157](https://github.com/getsentry/sentry-java/pull/5157))
1011

1112
## 8.34.0
1213

gradle/libs.versions.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ spotless = "7.0.4"
4141
gummyBears = "0.12.0"
4242
camerax = "1.3.0"
4343
openfeature = "1.18.2"
44-
protobuf = "3.25.8"
4544

4645
[plugins]
4746
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
@@ -61,7 +60,6 @@ spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
6160
detekt = { id = "io.gitlab.arturbosch.detekt", version = "1.23.8" }
6261
jacoco-android = { id = "com.mxalbert.gradle.jacoco-android", version = "0.2.0" }
6362
kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" }
64-
protobuf = { id = "com.google.protobuf", version = "0.9.5" }
6563
vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" }
6664
springboot2 = { id = "org.springframework.boot", version.ref = "springboot2" }
6765
springboot3 = { id = "org.springframework.boot", version.ref = "springboot3" }
@@ -145,8 +143,7 @@ otel-javaagent-extension-api = { module = "io.opentelemetry.javaagent:openteleme
145143
otel-semconv = { module = "io.opentelemetry.semconv:opentelemetry-semconv", version.ref = "otelSemanticConventions" }
146144
otel-semconv-incubating = { module = "io.opentelemetry.semconv:opentelemetry-semconv-incubating", version.ref = "otelSemanticConventionsAlpha" }
147145
p6spy = { module = "p6spy:p6spy", version = "3.9.1" }
148-
protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobuf"}
149-
protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" }
146+
epitaph = { module = "com.abovevacant:epitaph", version = "0.1.0" }
150147
quartz = { module = "org.quartz-scheduler:quartz", version = "2.3.0" }
151148
reactor-core = { module = "io.projectreactor:reactor-core", version = "3.5.3" }
152149
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
TRACKED_COMMIT="981d145117e8992842cdddee555c57e60c7a220a"
5+
6+
# tail -n +2 to remove the magic anti-XSSI prefix from the Gitiles JSON response
7+
LATEST_COMMIT=$(curl -sf \
8+
'https://android.googlesource.com/platform/system/core/+log/refs/heads/main/debuggerd/proto/tombstone.proto?format=JSON' \
9+
| tail -n +2 \
10+
| jq -r '.log[0].commit')
11+
12+
if [ -z "$LATEST_COMMIT" ] || [ "$LATEST_COMMIT" = "null" ]; then
13+
echo "ERROR: Failed to fetch latest commit from Gitiles" >&2
14+
exit 1
15+
fi
16+
17+
echo "Tracked commit: $TRACKED_COMMIT"
18+
echo "Latest commit: $LATEST_COMMIT"
19+
20+
if [ "$LATEST_COMMIT" != "$TRACKED_COMMIT" ]; then
21+
echo "Schema has been updated! Latest: https://android.googlesource.com/platform/system/core/+/${LATEST_COMMIT}/debuggerd/proto/tombstone.proto"
22+
exit 1
23+
fi
24+
25+
echo "Schema is up to date."

sentry-android-core/build.gradle.kts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ plugins {
88
alias(libs.plugins.jacoco.android)
99
alias(libs.plugins.errorprone)
1010
alias(libs.plugins.gradle.versions)
11-
alias(libs.plugins.protobuf)
1211
}
1312

1413
android {
@@ -84,7 +83,7 @@ dependencies {
8483
implementation(libs.androidx.lifecycle.common.java8)
8584
implementation(libs.androidx.lifecycle.process)
8685
implementation(libs.androidx.core)
87-
implementation(libs.protobuf.javalite)
86+
implementation(libs.epitaph)
8887

8988
errorprone(libs.errorprone.core)
9089
errorprone(libs.nopen.checker)
@@ -113,10 +112,3 @@ dependencies {
113112
testRuntimeOnly(libs.androidx.fragment.ktx)
114113
testRuntimeOnly(libs.timber)
115114
}
116-
117-
protobuf {
118-
protoc { artifact = libs.protoc.get().toString() }
119-
generateProtoTasks {
120-
all().forEach { task -> task.builtins { create("java") { option("lite") } } }
121-
}
122-
}

sentry-android-core/proguard-rules.pro

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@
5454

5555
-keepnames class io.sentry.android.core.ApplicationNotResponding
5656

57-
# protobuf-java lite
58-
# https://github.com/protocolbuffers/protobuf/blob/5d876c9fec1a6f2feb0750694f803f89312bffff/java/lite.md#r8-rule-to-make-production-app-builds-work
59-
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
6057

6158
##---------------End: proguard configuration for android-core ----------
6259

0 commit comments

Comments
 (0)