irondash / cargokit

Integrate cargo build with flutter plugins and applications.
Other
51 stars 16 forks source link

Building/archiving fails when done via Xcode #28

Closed julian-CStack closed 9 months ago

julian-CStack commented 9 months ago

When attempting to archive a build in preparation to submit to App Store in Xcode there is a PhaseScriptExecution error: Command PhaseScriptExecution failed with a nonzero exit code

Specifically: run_build_tool.sh: line 75: dart: command not found

It appears that FLUTTER_ROOT is not set when run_build_tool.sh is called and when printing PATH (from within run_build_tool.sh) I get only /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin so it appears Xcode is stripping my user defined path.

Note: flutter build ios works as expected.

This may be unrelated to cargo kit specifically but I thought I would open an issue here just in case.

My current workaround is to add a symlink to dart in /usr/local/bin like so: ln -s /pathToMyFlutterInstall/dart /usr/local/bin/dart

knopp commented 9 months ago

I see where the problem is. FLUTTER_ROOT is set in Flutter-Generated.xcconfig file, but that is only included in the main project, not in the pods project. FLUTTER_ROOT is also set by Flutter tool, but that's not used during Xcode build.

This does seem like a problem.

knopp commented 9 months ago

Hey, could you retry this with latest Cargokit and reopen if it still fails? Thanks.

julian-CStack commented 9 months ago

Appears fixed for macOS builds.

Seems iOS doesn't have the ephemeral dir so [...]Flutter/flutter_export_environment.sh" could possibly be added as a fallback if [...]Flutter/ephemeral/flutter_export_environment.sh" is not found.

knopp commented 9 months ago

Makes sense, I didn't realize what iOS has different structure when I merged the PR.