Skip to content

Commit 15eabfa

Browse files
authored
feat: ios symbol upload flavors (#292)
* feat: ios symbol upload flavors * chore: changelog
1 parent 560dadb commit 15eabfa

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Support flavors in iOS symbol upload ([#292](https://github.com/getsentry/sentry-dart-plugin/pull/292))
8+
59
### Dependencies
610

711
- Bump CLI from v2.38.1 to v2.39.1 ([#282](https://github.com/getsentry/sentry-dart-plugin/pull/282))

lib/sentry_dart_plugin.dart

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class SentryDartPlugin {
8080

8181
_addWait(params);
8282

83-
final debugSymbolPaths = _enumerateDebugSymbolPaths();
8483
final fs = injector.get<FileSystem>();
84+
final debugSymbolPaths = _enumerateDebugSymbolPaths(fs);
8585
await for (final path in debugSymbolPaths) {
8686
if (await fs.directory(path).exists() || await fs.file(path).exists()) {
8787
await _executeAndLog('Failed to upload symbols', [...params, path]);
@@ -95,7 +95,7 @@ class SentryDartPlugin {
9595
Log.taskCompleted(taskName);
9696
}
9797

98-
Stream<String> _enumerateDebugSymbolPaths() async* {
98+
Stream<String> _enumerateDebugSymbolPaths(FileSystem fs) async* {
9999
final buildDir = _configuration.buildFilesFolder;
100100

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

124124
// iOS
125-
yield '$buildDir/ios/iphoneos/Runner.App';
126-
yield '$buildDir/ios/Release-iphoneos';
125+
yield '$buildDir/ios/iphoneos/Runner.app';
126+
if (await fs.directory('$buildDir/ios').exists()) {
127+
final regexp = RegExp(r'^Release(-.*)?-iphoneos$');
128+
yield* fs
129+
.directory('$buildDir/ios')
130+
.list()
131+
.where((v) => regexp.hasMatch(v.basename))
132+
.map((e) => e.path);
133+
}
127134

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

test/plugin_test.dart

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,43 @@ void main() {
353353
'$cli $args releases $orgAndProject finalize $configRelease'
354354
]);
355355
});
356+
357+
test('uploads debug symbols from all known paths', () async {
358+
const version = '1.0.0';
359+
final config = 'upload_debug_symbols: true';
360+
361+
final outputDirectories = [
362+
'app/outputs',
363+
'app/intermediates',
364+
'windows/runner/Release',
365+
'windows/x64/runner/Release',
366+
'windows/arm64/runner/Release',
367+
'linux/x64/release/bundle',
368+
'linux/arm64/release/bundle',
369+
'macos/Build/Products/Release',
370+
'macos/framework/Release',
371+
'ios/iphoneos/Runner.app',
372+
'ios/Release-iphoneos',
373+
'ios/Release-anyrandomflavor-iphoneos',
374+
'ios/archive',
375+
'ios/framework/Release'
376+
];
377+
for (final dir in outputDirectories) {
378+
fs
379+
.directory(buildDir)
380+
.childDirectory(dir)
381+
.createSync(recursive: true);
382+
}
383+
384+
final commandLog = await runWith(version, config);
385+
386+
for (final dir in outputDirectories) {
387+
expect(
388+
commandLog,
389+
contains(
390+
'$cli $commonArgs debug-files upload $orgAndProject $buildDir/$dir'));
391+
}
392+
});
356393
});
357394
});
358395
}

0 commit comments

Comments
 (0)