Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 50 additions & 17 deletions packages/react-native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,14 @@ marked lines, replaces only those, and rewrites exactly one of yours,
`react.hermesCommand`, with any trailing comment kept. Its own lines are
recognised only by their markers: the NDK dependency ends in `// bugsee:ndk`
(as does the opener of the `dependencies` block it adds when the file has
none), and the symbol-table block starts with `// bugsee-symbol-table:`. A
`bugsee-android-ndk` dependency of your own, anywhere and however written, is
never touched: the plugin then adds none of its own and says so in the
prebuild log. Your own `ndk { }` block is never touched either, and a line of
yours added inside the plugin's symbol-table block makes it refuse rather
than delete. It inserts only at anchors that hold nothing but their brace
(`dependencies {`, `buildscript … }`, `pluginManagement {`, `repositories {`,
a build type's `{` and `}`; a trailing comment is fine), always as whole
lines at your indentation, and never splits a line. Where it cannot do that
none). A `bugsee-android-ndk` dependency of your own, anywhere and however
written, is never touched: the plugin then adds none of its own and says so in
the prebuild log. The plugin writes no `debugSymbolLevel` (see
[Native symbols](#native-symbols-android)), and your own `ndk { }` block or
level is never touched. It inserts only at anchors that hold nothing but their
brace (`dependencies {`, `buildscript … }`, `pluginManagement {`,
`repositories {`; a trailing comment is fine), always as whole lines at your
indentation, and never splits a line. Where it cannot do that
with certainty it refuses the prebuild with one error that names the file,
the reason and the fix, and writes nothing. It refuses:

Expand All @@ -116,11 +115,9 @@ the reason and the fix, and writes nothing. It refuses:
- a `react.hermesCommand` that spans several lines or shares its line with
another statement after `;`;
- an anchor brace that shares its line with code: a one-line
`dependencies { … }` or `release { … }`, a `minifyEnabled true }`, a
`buildscript { … }; …`, a one-line `pluginManagement` or `repositories`
block (with the option that needs that edit on);
- its own symbol-table block with a line of yours inside it (with
`nativeCrashReporting` off);
`dependencies { … }`, a `buildscript { … }; …`, a one-line
`pluginManagement` or `repositories` block (with the option that needs that
edit on);
- a `gradlePluginVersion` option or a baked NDK version that is not a plain
version string.

Expand Down Expand Up @@ -214,9 +211,8 @@ plugins {

`android/app/build.gradle` — apply it, and for native crash symbols add the
NDK module at the SDK version the package pins. No `ndk.debugSymbolLevel` is
needed for Bugsee: Gradle plugin 4.0.8 uploads native symbols from the
unstripped libraries in `build/intermediates/merged_native_libs`, whatever
the level. Set one only for what Google Play should get.
needed for Bugsee ([Native symbols](#native-symbols-android)); set one only
for what Google Play should get.

```groovy
apply plugin: "com.android.application"
Expand All @@ -240,6 +236,43 @@ app_token=<your Android app token>
plugin.ndk.enabled=true
```

### Native symbols (Android)

With `plugin.ndk.enabled=true` (the config plugin writes it for a real token
unless `nativeCrashReporting` is `false`), each Release build's
`uploadBugsee<Variant>Native` task uploads native symbols. Bugsee Gradle
plugin 4.0.8 and later read them from the **unstripped** libraries AGP leaves
in `build/intermediates/merged_native_libs/<variant>`, keyed by GNU build-id,
with `bugsee-cli` 0.8.1 or later (the plugin's own floor). That makes them
independent of `ndk.debugSymbolLevel`:

- every library that still has its debug info is uploaded with it, so crash
frames get function names and `file:line`. That covers your own native
code, and React Native's `libreactnative.so`, which the Maven
`react-android` artefact ships with full DWARF. Libraries shipped stripped
(Maven Hermes's `libhermesvm.so`, the Bugsee SDK's own) get their symbol
table, function names only;
- an unchanged prebuilt library (`libreactnative.so`, `libc++_shared.so`) has
the same build-id in every release, and the server keeps one copy; a copy
stored earlier with function names only is upgraded to the full one;
- the symbols are a build artefact: nothing is added to the APK or AAB.

`debugSymbolLevel` is therefore **your app's own choice, for Google Play**
(what AGP packs into `native-debug-symbols.zip` and the AAB). The config
plugin writes none. Earlier versions of it wrote
`ndk { debugSymbolLevel 'SYMBOL_TABLE' }`, under a
`// bugsee-symbol-table:` comment, into the `debug` and `release` build
types; the next prebuild removes that block, recognised by its exact lines
only. A block you changed inside is yours: it is left as it is, and the
prebuild log says so. A level of your own is never touched.

The wrapper's own `@bugsee/cli` (source maps, dSYMs) is 0.7.12 or later.
If you pin the Gradle plugin's CLI yourself (`plugin.cliPath` or
`plugin.cliVersion`), use 0.8.1 or later: older CLIs do not read
`merged_native_libs`, and the plugin then falls back to AGP's
`native-debug-symbols.zip`, which depends on `debugSymbolLevel` (and
0.7.0–0.7.11 send nothing for a `SYMBOL_TABLE` zip, bugsee/bugsee-cli#61).

## iOS: bundle phase

The JS half of iOS symbolication. In Xcode, the app target's **Bundle React
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"native-versions.json"
],
"dependencies": {
"@bugsee/cli": "0.7.11",
"@bugsee/cli": "0.7.12",
"@expo/config-plugins": "~57.0.9"
},
"peerDependencies": {
Expand Down
15 changes: 9 additions & 6 deletions packages/react-native/plugin/build/gradle.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ export declare function ensureGradlePluginDeclared(projectBuildGradle: string, v
* with the option omitted or on removes that exclude and adds the
* implementation line. The wrapper `api` itself is left in place.
*
* On (omitted or a version) also writes `debugSymbolLevel 'SYMBOL_TABLE'`
* on existing debug and release build types when that block is absent.
* Off removes only the block this plugin inserted. Maven Hermes and
* `libreactnative.so` are pre-stripped; the comment does not claim those
* two are symbolicated. The Hermes preserve command and the finish hook
* are the JS source-map path, so they are written either way. The hook
* `ndk.debugSymbolLevel` is never written: Bugsee Gradle plugin 4.0.8 and
* later upload native symbols from the unstripped libraries in
* `merged_native_libs`, whatever the level, which only decides what AGP packs
* for Google Play (the app's own choice). The `debugSymbolLevel
* 'SYMBOL_TABLE'` block earlier versions wrote is removed, recognised by its
* marker and exact lines only; a level of the user's is left alone. The
* Hermes preserve command and the finish hook are the JS source-map path,
* so they are written either way. The hook
* applies the package's scripts/bugsee-sourcemaps.gradle, which injects the
* debug id and uploads the composed map unless `bugseeUploadSourcemaps=false`
* or no real token is configured.
*/
export declare function ensureAppAppliesPlugin(appBuildGradle: string, ndkVersion: string | null, log?: (message: string) => void): string;
export declare const CHANGED_SYMBOL_BLOCK_NOTE = "@bugsee/react-native: android/app/build.gradle has the symbol-table block an earlier version of the plugin wrote, changed inside; it is left as you have it. Bugsee no longer needs ndk.debugSymbolLevel, so you can remove the block, or keep it for Google Play";
export declare const HERMES_COMMAND_UNREWRITABLE = "@bugsee/react-native cannot edit android/app/build.gradle: react.hermesCommand spans several lines or shares its line with another statement, so it cannot be pointed at scripts/hermesc-preserve-js.sh. Put it alone on one line, or delete it, and prebuild again";
/**
* `uploadSymbols: false` on Android: disables every `uploadBugsee*` task
Expand Down
93 changes: 27 additions & 66 deletions packages/react-native/plugin/build/gradle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/react-native/plugin/build/gradle.js.map

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions packages/react-native/plugin/build/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ export interface BugseePluginProps {
*/
uploadSymbols?: boolean;
/**
* Defaults on. Writes `plugin.ndk.enabled=true` for a real token, adds
* `com.bugsee:bugsee-android-ndk`, and sets `debugSymbolLevel 'SYMBOL_TABLE'`
* on existing debug and release build types. `false` skips the flag, strips
* that direct dependency, excludes the wrapper's NDK AAR, and removes the
* symbol block this plugin inserted. JS source-map hooks stay either way.
* Defaults on. Writes `plugin.ndk.enabled=true` for a real token and adds
* `com.bugsee:bugsee-android-ndk`; the Bugsee Gradle plugin then uploads
* native symbols from the unstripped libraries, whatever
* `ndk.debugSymbolLevel` says. `false` skips the flag, strips that direct
* dependency and excludes the wrapper's NDK AAR. Either way the plugin
* writes no `debugSymbolLevel`, and removes the symbol-table block earlier
* versions wrote. JS source-map hooks stay either way.
*/
nativeCrashReporting?: boolean;
/** Defaults to native-versions.json `android.gradlePlugin`. */
Expand Down
Loading
Loading