-
Notifications
You must be signed in to change notification settings - Fork 13
feat: adding better logging on iOS build command when generate shorebird file is not found. #57
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
Changes from all commits
6bb6eac
1bf4ea2
f77607d
46d0634
3352ed9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -541,21 +541,50 @@ Future<XcodeBuildResult> buildXcodeProject({ | |
} | ||
|
||
void updateShorebirdYaml(BuildInfo buildInfo, BuildableIOSApp app) { | ||
final String resolvedAppName = app.name ?? 'Runner.app'; | ||
final File shorebirdYaml = globals.fs.file( | ||
globals.fs.path.join( | ||
app.archiveBundleOutputPath, | ||
'Products', | ||
'Applications', | ||
app.name ?? 'Runner.app', | ||
resolvedAppName, | ||
'Frameworks', | ||
'App.framework', | ||
'flutter_assets', | ||
'shorebird.yaml', | ||
), | ||
); | ||
if (!shorebirdYaml.existsSync()) { | ||
// Find the closest existing parent of the file. | ||
Directory parent = shorebirdYaml.parent; | ||
|
||
int i = 0; | ||
// The max depth is just a hard limit to prevent the cli from going too far back in the | ||
// folder tree and unintentionally "invading" a user folder that isn't the project. | ||
// | ||
// This limit should never be reached though, since at least the `Applications` or | ||
// `Products` folder should exist, no matter what changed in the app. | ||
// This is really just an overcautious from our side to make sure we never | ||
// access files that we don't need. | ||
const int maxDepth = 7; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why have the max depth at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might be too overcautious here, but I was worried that we end up recurring back too much and end in a user "personal" folder and kind trigger the user that we are invading their files. This depth makes sure that we don't go past the build folder. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment should probably say that then. :) |
||
while (!parent.existsSync() && i < maxDepth) { | ||
parent = parent.parent; | ||
i++; | ||
} | ||
|
||
String parentChildren = ''; | ||
if (parent.existsSync()) { | ||
parentChildren = parent.listSync().map((FileSystemEntity entity) => entity.basename).join(', '); | ||
} | ||
|
||
throw Exception(''' | ||
Cannot find shorebird.yaml in ${shorebirdYaml.absolute.path}. | ||
Resolved app name: $resolvedAppName | ||
|
||
Closest existing parent: | ||
PATH: ${parent.absolute.path} | ||
CHILDREN: $parentChildren | ||
|
||
Please file an issue at: https://github.com/shorebirdtech/shorebird/issues/new | ||
'''); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.