diff --git a/CHANGELOG.md b/CHANGELOG.md index 8200e6bb..c598b24d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Features + +- Support flavors in macOS symbol upload ([#308](https://github.com/getsentry/sentry-dart-plugin/pull/308)) + ## 2.4.1 ### Fixes diff --git a/lib/sentry_dart_plugin.dart b/lib/sentry_dart_plugin.dart index 7ba0e030..e52bb5e7 100644 --- a/lib/sentry_dart_plugin.dart +++ b/lib/sentry_dart_plugin.dart @@ -116,10 +116,10 @@ class SentryDartPlugin { } // macOS - yield '$buildDir/macos/Build/Products/Release'; + yield* _enumerateDirectoryWithFlavors(fs, basePath: '$buildDir/macos/Build/Products'); // macOS (macOS-framework) - yield '$buildDir/macos/framework/Release'; + yield* _enumerateDirectoryWithFlavors(fs, basePath: '$buildDir/macos/framework'); // iOS yield '$buildDir/ios/iphoneos/Runner.app'; @@ -136,7 +136,20 @@ class SentryDartPlugin { yield '$buildDir/ios/archive'; // iOS (ios-framework) - yield '$buildDir/ios/framework/Release'; + yield* _enumerateDirectoryWithFlavors(fs, basePath: '$buildDir/ios/framework'); + } + + Stream _enumerateDirectoryWithFlavors(FileSystem fs, { + required String basePath, + String targetDirectoryName = "Release" + }) async* { + if (await fs.directory(basePath).exists()) { + yield* fs + .directory(basePath) + .list() + .where((v) => v.basename.startsWith(targetDirectoryName)) + .map((e) => e.path); + } } Future> _enumerateSymbolFiles() async { @@ -282,9 +295,8 @@ class SentryDartPlugin { int? exitCode; try { - final process = await injector - .get() - .start([_configuration.cliPath!, ...params]); + final process = + await injector.get().start([_configuration.cliPath!, ...params]); process.stdout.transform(utf8.decoder).listen((data) { Log.info(data.trim()); @@ -303,8 +315,8 @@ class SentryDartPlugin { } } - void _addExtensionToParams(List exts, List params, - String release, String folder, String? urlPrefix) { + void _addExtensionToParams( + List exts, List params, String release, String folder, String? urlPrefix) { params.add('files'); params.add(release); params.add('upload-sourcemaps'); diff --git a/test/plugin_test.dart b/test/plugin_test.dart index 3198873c..6e3fd443 100644 --- a/test/plugin_test.dart +++ b/test/plugin_test.dart @@ -367,7 +367,9 @@ void main() { 'linux/x64/release/bundle', 'linux/arm64/release/bundle', 'macos/Build/Products/Release', + 'macos/Build/Products/Release-demo', 'macos/framework/Release', + 'macos/framework/Release-demo', 'ios/iphoneos/Runner.app', 'ios/Release-iphoneos', 'ios/Release-anyrandomflavor-iphoneos',