Skip to content

fix(flutter_tools): improve shorebird.yaml detection on iOS #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Changes from all commits
Commits
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
13 changes: 8 additions & 5 deletions packages/flutter_tools/lib/src/ios/mac.dart
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ Future<XcodeBuildResult> buildXcodeProject({
}

try {
updateShorebirdYaml(buildInfo, app.archiveBundleOutputPath);
updateShorebirdYaml(buildInfo, app);
} on Exception catch (error) {
globals.printError('[shorebird] failed to generate shorebird configuration.\n$error');
return XcodeBuildResult(success: false);
Expand All @@ -500,21 +500,24 @@ Future<XcodeBuildResult> buildXcodeProject({
}
}

void updateShorebirdYaml(BuildInfo buildInfo, String xcarchivePath) {
void updateShorebirdYaml(BuildInfo buildInfo, BuildableIOSApp app) {
final File shorebirdYaml = globals.fs.file(
globals.fs.path.join(
xcarchivePath,
app.archiveBundleOutputPath,
'Products',
'Applications',
'Runner.app',
app.name ?? 'Runner.app',
'Frameworks',
'App.framework',
'flutter_assets',
'shorebird.yaml',
),
);
if (!shorebirdYaml.existsSync()) {
throw Exception('shorebird.yaml not found.');
throw Exception('''
Cannot find shorebird.yaml in ${shorebirdYaml.absolute.path}.
Please file an issue at: https://github.com/shorebirdtech/shorebird/issues/new
''');
}
final YamlDocument yaml = loadYamlDocument(shorebirdYaml.readAsStringSync());
final YamlMap yamlMap = yaml.contents as YamlMap;
Expand Down