Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
bfd77cd
Initial impl
buenaflor Aug 8, 2025
99dee07
Initial impl
buenaflor Aug 8, 2025
21ba340
Initial impl
buenaflor Aug 8, 2025
4449ef8
Update
buenaflor Aug 11, 2025
7fed2aa
Update
buenaflor Aug 11, 2025
46729fd
Fix
buenaflor Aug 11, 2025
e20751a
Merge branch 'feat/find-relevant-debug-files' into feat/find-mapping-…
buenaflor Aug 11, 2025
3272add
Update
buenaflor Aug 11, 2025
a25d75a
Update
buenaflor Aug 12, 2025
e69117e
Update
buenaflor Aug 12, 2025
45f7bc2
Update
buenaflor Aug 12, 2025
e97c0df
Update
buenaflor Aug 12, 2025
8615400
Update
buenaflor Aug 12, 2025
c777be7
Update
buenaflor Aug 12, 2025
8c97581
Update
buenaflor Aug 12, 2025
0502f23
Update
buenaflor Aug 12, 2025
4524772
Optimize
buenaflor Aug 12, 2025
396507c
Update
buenaflor Aug 12, 2025
1eea0d8
Update
buenaflor Aug 12, 2025
c420e72
Remove unnecessary file check
buenaflor Aug 12, 2025
0cd79e7
Review
buenaflor Aug 12, 2025
a49d2de
Add missing test
buenaflor Aug 12, 2025
82f1afc
Update tests
buenaflor Aug 12, 2025
035af1b
Update tests
buenaflor Aug 12, 2025
b4d9a97
Update tests
buenaflor Aug 12, 2025
832e5b8
Update
buenaflor Aug 12, 2025
4da7432
Update
buenaflor Aug 12, 2025
5eff2db
Update
buenaflor Aug 12, 2025
90a99cb
Update
buenaflor Aug 12, 2025
48305ef
Updaet
buenaflor Aug 12, 2025
ad59fb8
Update
buenaflor Aug 12, 2025
c9092b5
Update
buenaflor Aug 12, 2025
6e7b946
Update
buenaflor Aug 12, 2025
4645b04
Update
buenaflor Aug 12, 2025
a0fb007
Update
buenaflor Aug 12, 2025
c1bdd43
Update
buenaflor Aug 12, 2025
5edd4f7
Update
buenaflor Aug 12, 2025
d5d6490
Update
buenaflor Aug 13, 2025
6cea83c
Update cli_params.dart
buenaflor Aug 13, 2025
610cffe
Update dart_symbol_map.dart
buenaflor Aug 13, 2025
8f224b8
Update tests
buenaflor Aug 13, 2025
cc7514b
Fix
buenaflor Aug 13, 2025
5210a26
Update
buenaflor Aug 13, 2025
f096be1
Update
buenaflor Aug 13, 2025
187f68b
Update
buenaflor Aug 13, 2025
0f930a4
Merge branch 'main' into feat/find-mapping-file
buenaflor Aug 13, 2025
07106f7
Run tests
buenaflor Aug 13, 2025
3f3a278
Add marker
buenaflor Aug 13, 2025
b605d70
Update
buenaflor Aug 13, 2025
ced1eee
Update
buenaflor Aug 13, 2025
897756c
Update
buenaflor Aug 13, 2025
1cb2765
Update
buenaflor Aug 14, 2025
725ea42
Update
buenaflor Aug 14, 2025
78faf96
Update
buenaflor Aug 14, 2025
8a8ee27
Update
buenaflor Aug 14, 2025
440caf0
Update
buenaflor Aug 14, 2025
6d69035
Update
buenaflor Aug 14, 2025
6b6eff0
Update
buenaflor Aug 14, 2025
67a0f17
Update
buenaflor Aug 14, 2025
a2bf91c
Update
buenaflor Aug 14, 2025
90bbaf0
Update
buenaflor Aug 14, 2025
f4e1ccb
Update
buenaflor Aug 14, 2025
aea323e
Update
buenaflor Aug 14, 2025
1dd8c9c
Update
buenaflor Aug 14, 2025
40ddd00
Update
buenaflor Aug 14, 2025
82c6294
Update CHANGELOG
buenaflor Aug 14, 2025
2b63ca8
Update CHANGELOG
buenaflor Aug 14, 2025
089f82e
Update
buenaflor Aug 14, 2025
54dd327
Update
buenaflor Aug 14, 2025
1af9d5b
Update
buenaflor Aug 14, 2025
f0b27b5
Update
buenaflor Aug 14, 2025
9a35bd6
Update
buenaflor Aug 14, 2025
49d12eb
Update
buenaflor Aug 14, 2025
1f31f27
Update
buenaflor Aug 14, 2025
a1eeebe
Update
buenaflor Aug 14, 2025
811a8d4
Update
buenaflor Aug 14, 2025
fba5932
Update docs
buenaflor Aug 14, 2025
777e17d
Fix tests
buenaflor Aug 14, 2025
9db5261
Update CHANGELOG
buenaflor Aug 14, 2025
0f899d5
Update
buenaflor Aug 14, 2025
1ee6f3d
Update test
buenaflor Aug 14, 2025
a79df66
Remove duplicate
buenaflor Aug 14, 2025
3224d42
Cursor review
buenaflor Aug 14, 2025
0ef4ecf
Update marker
buenaflor Aug 14, 2025
3b3af39
Update comment
buenaflor Aug 14, 2025
4a61274
Review
buenaflor Aug 14, 2025
7919595
Update CI
buenaflor Aug 14, 2025
7c56763
Update
buenaflor Aug 14, 2025
f81d281
Update
buenaflor Aug 14, 2025
e67917a
Update
buenaflor Aug 14, 2025
08b9690
Update
buenaflor Aug 14, 2025
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
3 changes: 3 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
path: temp/testapp-${{ matrix.target }}
key: integration-test-${{ matrix.host }}-${{ matrix.target }}-${{ hashFiles('flutter.version') }}

- run: sudo xcode-select --switch /Applications/Xcode_16.4.app
if: ${{ matrix.target == 'ios' || matrix.target == 'ios-framework' || matrix.target == 'ipa' }}

- run: dart test --tags integration

- uses: actions/upload-artifact@v4
Expand Down
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

## Unreleased

### Dependencies
### Features

- Bump CLI from v2.41.1 to v2.52.0 ([#327](https://github.com/getsentry/sentry-dart-plugin/pull/327))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2520)
- [diff](https://github.com/getsentry/sentry-cli/compare/2.41.1...2.52.0)
- Upload Dart symbol mapping file ([#347](https://github.com/getsentry/sentry-dart-plugin/pull/347))
- Enables symbolication of Flutter issue titles for obfuscated builds.
- Supported: Android and iOS
- Not supported (yet): macOS, Linux and Windows.
- Generate the mapping file: Add `--extra-gen-snapshot-options=--save-obfuscation-map=<path>` when building. Example: `flutter build apk --obfuscate --split-debug-info=build/symbols --extra-gen-snapshot-options=--save-obfuscation-map=build/mapping.json`
- Configure the plugin: Set `dart_symbol_map_path: build/mapping.json`
- Important: `dart_symbol_map_path` must point directly to the mapping file (absolute or relative path), not a directory.

## 3.1.1

Expand Down
57 changes: 33 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ sentry:
build_path: ...
web_build_path: ...
symbols_path: ...
# Path to the Dart obfuscation map (opt-in)
# Example generation flags:
# flutter build apk --obfuscate --split-debug-info=symbols \\
# --extra-gen-snapshot-options=--save-obfuscation-map=build/app/obfuscation.map.json
# Then set the path below to the generated obfuscation map file
dart_symbol_map_path: build/app/obfuscation.map.json
commits: auto
ignore_missing: true
```
Expand Down Expand Up @@ -95,30 +101,31 @@ ignore_missing=true

### Available Configuration Fields

| Configuration Name | Description | Default Value And Type | Required | Alternative Environment variable |
| - | - | - | - | - |
| upload_debug_symbols | Enables or disables the automatic upload of debug symbols | true (boolean) | no | - |
| upload_source_maps | Enables or disables the automatic upload of source maps | false (boolean) | no | - |
| upload_sources | Does or doesn't include the source code of native code | false (boolean) | no | - |
| legacy_web_symbolication | Uses legacy symbolication method for Flutter Web instead of Debug IDs | false (boolean) | no | - |
| project | Project's name | e.g. sentry-flutter (string) | yes | SENTRY_PROJECT |
| org | Organization's slug | e.g. sentry-sdks (string) | yes | SENTRY_ORG |
| auth_token | Auth Token | e.g. 64 random characteres (string) | yes | SENTRY_AUTH_TOKEN |
| url | URL | e.g. https<area>://mysentry.invalid/ (string) | no | SENTRY_URL |
| url_prefix | URL prefix for JS source maps | e.g. ~/app/ (string) | no | - |
| wait_for_processing | Wait for server-side processing of uploaded files | false (boolean) | no | - |
| log_level | Configures the log level for sentry-cli | warn (string) | no | SENTRY_LOG_LEVEL |
| release | The release version for source maps, it should match the release set by the SDK | name@version from pubspec (string) | no | SENTRY_RELEASE |
| dist | The dist/build number for source maps, it should match the dist set by the SDK | the number after the '+' char from 'version' pubspec (string) | no | SENTRY_DIST |
| build_path | The build folder of debug files for upload | `build` (string) | no | - |
| web_build_path | The web build folder of debug files for upload relative to build_path | `web` (string) | no | - |
| symbols_path | The directory containing debug symbols (i.e. the `--split-debug-info=` parameter value you pass to `flutter build`) | `.` (string) | no | - |
| commits | Release commits integration | auto (string) | no | - |
| ignore_missing | Ignore missing commits previously used in the release | false (boolean) | no | - |
| bin_dir | The folder where the plugin downloads the sentry-cli binary | .dart_tool/pub/bin/sentry_dart_plugin (string) | no | - |
| bin_path | Path to the sentry-cli binary to use instead of downloading. Make sure to use the correct version. | null (string) | no | - |
| sentry_cli_cdn_url | Alternative place to download sentry-cli | https://downloads.sentry-cdn.com/sentry-cli (string) | no | SENTRYCLI_CDNURL |
| sentry_cli_version | Override the sentry-cli version that should be downloaded. | (string) | no | - |
| Configuration Name | Description | Default Value And Type | Required | Alternative Environment variable |
| ------------------------ |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------------------------------------------------------- | -------- | -------------------------------- |
| upload_debug_symbols | Enables or disables the automatic upload of debug symbols | true (boolean) | no | - |
| upload_source_maps | Enables or disables the automatic upload of source maps | false (boolean) | no | - |
| upload_sources | Does or doesn't include the source code of native code | false (boolean) | no | - |
| legacy_web_symbolication | Uses legacy symbolication method for Flutter Web instead of Debug IDs | false (boolean) | no | - |
| project | Project's name | e.g. sentry-flutter (string) | yes | SENTRY_PROJECT |
| org | Organization's slug | e.g. sentry-sdks (string) | yes | SENTRY_ORG |
| auth_token | Auth Token | e.g. 64 random characteres (string) | yes | SENTRY_AUTH_TOKEN |
| url | URL | e.g. https<area>://mysentry.invalid/ (string) | no | SENTRY_URL |
| url_prefix | URL prefix for JS source maps | e.g. ~/app/ (string) | no | - |
| wait_for_processing | Wait for server-side processing of uploaded files | false (boolean) | no | - |
| log_level | Configures the log level for sentry-cli | warn (string) | no | SENTRY_LOG_LEVEL |
| release | The release version for source maps, it should match the release set by the SDK | name@version from pubspec (string) | no | SENTRY_RELEASE |
| dist | The dist/build number for source maps, it should match the dist set by the SDK | the number after the '+' char from 'version' pubspec (string) | no | SENTRY_DIST |
| build_path | The build folder of debug files for upload | `build` (string) | no | - |
| web_build_path | The web build folder of debug files for upload relative to build_path | `web` (string) | no | - |
| symbols_path | The directory containing debug symbols (i.e. the `--split-debug-info=` parameter value you pass to `flutter build`) | `.` (string) | no | - |
| dart_symbol_map_path | Absolute or relative path to a Dart obfuscation map file to upload. This allows symbolication of Flutter issue titles for Android and iOS. The map file is generated by adding the following arguments to your Flutter build command: `--extra-gen-snapshot-options=--save-obfuscation-map=<path>`. | null (string) | no | - |
| commits | Release commits integration | auto (string) | no | - |
| ignore_missing | Ignore missing commits previously used in the release | false (boolean) | no | - |
| bin_dir | The folder where the plugin downloads the sentry-cli binary | .dart_tool/pub/bin/sentry_dart_plugin (string) | no | - |
| bin_path | Path to the sentry-cli binary to use instead of downloading. Make sure to use the correct version. | null (string) | no | - |
| sentry_cli_cdn_url | Alternative place to download sentry-cli | https://downloads.sentry-cdn.com/sentry-cli (string) | no | SENTRYCLI_CDNURL |
| sentry_cli_version | Override the sentry-cli version that should be downloaded. | (string) | no | - |

## Breaking Changes in v3.0.0

Expand Down Expand Up @@ -200,4 +207,6 @@ The `--split-debug-info` option requires setting a output directory, the directo

Flutter's `build web` command requires setting the `--source-maps` parameter to generate source maps, See [Issue](https://github.com/flutter/flutter/issues/72150#issuecomment-755541599)

If you opt into uploading a Dart obfuscation map (`dart_symbol_map_path`), ensure you build with both `--obfuscate` and `--extra-gen-snapshot-options=--save-obfuscation-map=<path>`. The map path you configure must point to the generated file.

If a previous release could not be found in the git history, please make sure you set `ignore_missing: true` in the configuration if you want to ignore such errors, See [Issue](https://github.com/getsentry/sentry-dart-plugin/issues/153)
77 changes: 23 additions & 54 deletions lib/sentry_dart_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import 'dart:convert';

import 'package:file/file.dart';
import 'package:process/process.dart';
import 'package:sentry_dart_plugin/src/utils/extensions.dart';

import 'src/configuration.dart';
import 'src/utils/flutter_debug_files.dart';
import 'src/symbol_maps/dart_symbol_map.dart';
import 'src/utils/injector.dart';
import 'src/utils/log.dart';
import 'src/utils/extensions.dart';

/// Class responsible to load the configurations and upload the
/// debug symbols and source maps
Expand Down Expand Up @@ -86,7 +88,8 @@ class SentryDartPlugin {
_addWait(params);

final fs = injector.get<FileSystem>();
final debugSymbolPaths = _enumerateDebugSymbolPaths(fs);
final debugSymbolPaths =
enumerateDebugSearchRoots(fs: fs, config: _configuration);
await for (final path in debugSymbolPaths) {
if (await fs.directory(path).exists() || await fs.file(path).exists()) {
await _executeAndLog('Failed to upload symbols', [...params, path]);
Expand All @@ -97,59 +100,9 @@ class SentryDartPlugin {
await _executeAndLog('Failed to upload symbols', [...params, path]);
}

Log.taskCompleted(taskName);
}

Stream<String> _enumerateDebugSymbolPaths(FileSystem fs) async* {
final buildDir = _configuration.buildFilesFolder;
final projectRoot = fs.currentDirectory.path;

// Android (apk, appbundle)
yield '$buildDir/app/outputs';
yield '$buildDir/app/intermediates';

// Windows
for (final subdir in ['', '/x64', '/arm64']) {
yield '$buildDir/windows$subdir/runner/Release';
}
// TODO we should delete this once we have windows symbols collected automatically.
// Related to https://github.com/getsentry/sentry-dart-plugin/issues/173
yield 'windows/flutter/ephemeral/flutter_windows.dll.pdb';

// Linux
for (final subdir in ['/x64', '/arm64']) {
yield '$buildDir/linux$subdir/release/bundle';
}

// macOS
yield '$buildDir/macos/Build/Products/Release';

// macOS (macOS-framework)
yield '$buildDir/macos/framework/Release';

// iOS
yield '$buildDir/ios/iphoneos/Runner.app';
if (await fs.directory('$buildDir/ios').exists()) {
final regexp = RegExp(r'^Release(-.*)?-iphoneos$');
yield* fs
.directory('$buildDir/ios')
.list()
.where((v) => regexp.hasMatch(v.basename))
.map((e) => e.path);
}
await _tryUploadDartSymbolMap();

// iOS (ipa)
yield '$buildDir/ios/archive';

// iOS (ios-framework)
yield '$buildDir/ios/framework/Release';

// iOS in Fastlane
if (projectRoot == '/') {
yield 'ios/build';
} else {
yield '$projectRoot/ios/build';
}
Log.taskCompleted(taskName);
}

Future<Set<String>> _enumerateSymbolFiles() async {
Expand Down Expand Up @@ -194,6 +147,22 @@ class SentryDartPlugin {
return params;
}

/// Upload Dart symbol map(s) if configured.
/// This is needed to symbolicate Flutter issue titles for obfuscated builds.
Future<void> _tryUploadDartSymbolMap() async {
const taskName = 'uploading Dart symbol map(s)';
Log.startingTask(taskName);

try {
final fs = injector.get<FileSystem>();
await uploadDartSymbolMap(fs: fs, config: _configuration);
} catch (e) {
Log.error('Dart symbol map upload failed: $e');
} finally {
Log.taskCompleted(taskName);
}
}

Future<void> _executeNewRelease(String release) async {
await _executeAndLog('Failed to create a new release',
[..._releasesCliParams(), 'new', release]);
Expand Down
Loading
Loading