Skip to content

Commit 7f922ae

Browse files
runningcodeclaude
andcommitted
build(samples): Link the Android sample's Gradle files to the SDK build's
gradle.properties, gradlew, gradle/wrapper and gradle/gradle-daemon-jvm.properties are now symlinks to the SDK build's files. Both builds pick the same daemon JDK and JVM arguments, so they can share a daemon, and the sample reads the SDK version from the versionName property instead of parsing the root file. The copied gradle.properties had drifted from the root one (-Xmx6g and CrashOnOutOfMemoryError instead of -Xmx8g and HeapDumpOnOutOfMemoryError). Dependabot also scans the sample build, so the Develocity plugins in its settings stay current. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 21551f0 commit 7f922ae

8 files changed

Lines changed: 13 additions & 42 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ registries:
77
password: dummy # Required by dependabot
88
updates:
99
- package-ecosystem: "gradle"
10-
directory: "/"
10+
# The Android sample is a separate build that the root build doesn't include.
11+
directories:
12+
- "/"
13+
- "/sentry-samples/sentry-samples-android"
1114
registries:
1215
- gradle-plugin-portal
1316
schedule:

‎sentry-samples/sentry-samples-android/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ or open the `sentry-samples/sentry-samples-android` directory in Android Studio
1515

1616
The sample is a separate Gradle build that includes the SDK build, so changes to the SDK show up in the next build of the sample, with nothing to publish first.
1717
The SDK build doesn't include the sample, so `./gradlew` from the repository root doesn't build, lint or format it.
18+
`gradle.properties`, `gradlew`, `gradle/wrapper` and `gradle/gradle-daemon-jvm.properties` are symlinks to the SDK build's, so both builds use the same Gradle, JDK and settings.
1819

1920
You can also apply the [Sentry Android Gradle Plugin](https://github.com/getsentry/sentry-android-gradle-plugin) (SAGP) when building (not applied by default):
2021

2122
```
2223
./gradlew -p sentry-samples/sentry-samples-android installDebug -PuseSagp
2324
```
2425

25-
In Android Studio, add `useSagp=` (empty value) to the sample's `gradle.properties`, or pass `-PuseSagp` as a Gradle project property.
26+
In Android Studio, add `useSagp=` (empty value) to `gradle.properties`, or pass `-PuseSagp` as a Gradle project property.
2627

2728
For LLM-driven verification, use `adb` to inspect and interact with the running emulator. Compose-based screens often expose stable
2829
`Modifier.testTag()` values, which can be used with the UI hierarchy dump to locate controls reliably.

‎sentry-samples/sentry-samples-android/build.gradle.kts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ plugins {
1818
alias(libs.plugins.sqldelight)
1919
}
2020

21-
val sentryVersion = libs.versions.sentry.get()
21+
// gradle.properties links to the SDK build's, so this is the SDK version.
22+
val sentryVersion = providers.gradleProperty("versionName").get()
2223

2324
if (providers.gradleProperty("useSagp").isPresent) {
2425
apply(plugin = "io.sentry.android.gradle")

‎sentry-samples/sentry-samples-android/gradle.properties‎

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../gradle.properties
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../gradle/gradle-daemon-jvm.properties
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../gradle/wrapper

‎sentry-samples/sentry-samples-android/gradlew‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎sentry-samples/sentry-samples-android/settings.gradle.kts‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,13 @@ develocity {
4444
}
4545
}
4646

47-
// Gradle reads gradle.properties only for the build it belongs to, so read the SDK version from the
48-
// SDK build's file.
49-
val sentryVersion: String =
50-
providers
51-
.fileContents(layout.settingsDirectory.file("../../gradle.properties"))
52-
.asText
53-
.map { java.util.Properties().apply { load(it.reader()) }.getProperty("versionName") }
54-
.get()
55-
5647
dependencyResolutionManagement {
5748
repositories {
5849
google()
5950
mavenCentral()
6051
mavenLocal()
6152
}
62-
versionCatalogs {
63-
create("libs") {
64-
from(files("../../gradle/libs.versions.toml"))
65-
version("sentry", sentryVersion)
66-
}
67-
}
53+
versionCatalogs { create("libs") { from(files("../../gradle/libs.versions.toml")) } }
6854
}
6955

7056
rootProject.name = "sentry-samples-android"

0 commit comments

Comments
 (0)