Skip to content

Commit

Permalink
feat: ios symbol upload flavors (#292)
Browse files Browse the repository at this point in the history
* feat: ios symbol upload flavors

* chore: changelog
  • Loading branch information
vaind authored Jan 17, 2025
1 parent 560dadb commit 15eabfa
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Features

- Support flavors in iOS symbol upload ([#292](https://github.com/getsentry/sentry-dart-plugin/pull/292))

### Dependencies

- Bump CLI from v2.38.1 to v2.39.1 ([#282](https://github.com/getsentry/sentry-dart-plugin/pull/282))
Expand Down
15 changes: 11 additions & 4 deletions lib/sentry_dart_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class SentryDartPlugin {

_addWait(params);

final debugSymbolPaths = _enumerateDebugSymbolPaths();
final fs = injector.get<FileSystem>();
final debugSymbolPaths = _enumerateDebugSymbolPaths(fs);
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 @@ -95,7 +95,7 @@ class SentryDartPlugin {
Log.taskCompleted(taskName);
}

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

// Android (apk, appbundle)
Expand All @@ -122,8 +122,15 @@ class SentryDartPlugin {
yield '$buildDir/macos/framework/Release';

// iOS
yield '$buildDir/ios/iphoneos/Runner.App';
yield '$buildDir/ios/Release-iphoneos';
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);
}

// iOS (ipa)
yield '$buildDir/ios/archive';
Expand Down
37 changes: 37 additions & 0 deletions test/plugin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,43 @@ void main() {
'$cli $args releases $orgAndProject finalize $configRelease'
]);
});

test('uploads debug symbols from all known paths', () async {
const version = '1.0.0';
final config = 'upload_debug_symbols: true';

final outputDirectories = [
'app/outputs',
'app/intermediates',
'windows/runner/Release',
'windows/x64/runner/Release',
'windows/arm64/runner/Release',
'linux/x64/release/bundle',
'linux/arm64/release/bundle',
'macos/Build/Products/Release',
'macos/framework/Release',
'ios/iphoneos/Runner.app',
'ios/Release-iphoneos',
'ios/Release-anyrandomflavor-iphoneos',
'ios/archive',
'ios/framework/Release'
];
for (final dir in outputDirectories) {
fs
.directory(buildDir)
.childDirectory(dir)
.createSync(recursive: true);
}

final commandLog = await runWith(version, config);

for (final dir in outputDirectories) {
expect(
commandLog,
contains(
'$cli $commonArgs debug-files upload $orgAndProject $buildDir/$dir'));
}
});
});
});
}
Expand Down

0 comments on commit 15eabfa

Please sign in to comment.