Skip to content

Commit

Permalink
collect symbol files from all dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Nov 4, 2024
1 parent 41ed7e8 commit ca6f314
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions lib/sentry_dart_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'src/utils/log.dart';
/// debug symbols and source maps
class SentryDartPlugin {
late Configuration _configuration;
final symbolFileRegexp = RegExp(r'[/\\]app[^/\\]+.*\.(dSYM|symbols)$');

/// SentryDartPlugin ctor. that inits the injectors
SentryDartPlugin() {
Expand Down Expand Up @@ -87,15 +88,8 @@ class SentryDartPlugin {
}
}

if (_configuration.symbolsFolder.isNotEmpty) {
final symbolsRootDir = fs.directory(_configuration.symbolsFolder);
if (await symbolsRootDir.exists()) {
final symbolFileRegexp = RegExp(r'[/\\]app[^/\\]+.*\.(dSYM|symbols)$');
await for (final entry in symbolsRootDir.find(symbolFileRegexp)) {
await _executeAndLog(
'Failed to upload symbols', [...params, entry.path]);
}
}
for (final path in await _enumerateSymbolFiles()) {
await _executeAndLog('Failed to upload symbols', [...params, path]);
}

Log.taskCompleted(taskName);
Expand Down Expand Up @@ -128,6 +122,32 @@ class SentryDartPlugin {
// TODO
}

Future<Set<String>> _enumerateSymbolFiles() async {
final result = <String>{};
final fs = injector.get<FileSystem>();

if (_configuration.symbolsFolder.isNotEmpty) {
final symbolsRootDir = fs.directory(_configuration.symbolsFolder);
if (await symbolsRootDir.exists()) {
await for (final entry in symbolsRootDir.find(symbolFileRegexp)) {
result.add(entry.path);
}
}
}

// for backward compatibility, also check the build dir if it has been
// configured with a different path.
if (_configuration.buildFilesFolder != _configuration.symbolsFolder) {
final symbolsRootDir = fs.directory(_configuration.buildFilesFolder);
if (await symbolsRootDir.exists()) {
await for (final entry in symbolsRootDir.find(symbolFileRegexp)) {
result.add(entry.path);
}
}
}
return result;
}

List<String> _releasesCliParams() {
final params = <String>[];
_setUrlAndTokenAndLog(params);
Expand Down

0 comments on commit ca6f314

Please sign in to comment.