fix: cleanup xcode_backend.sh to fix iOS build w/ NixOS/nixpkgs
flutter
#155139
+4
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This patch cleans up the
packages/flutter_tools/bin/xcode_backend.sh
wrapper. All it does now is (morally):Xcode calls this wrapper during an iOS build. The previous
xcode_backend.sh
tries to discover$FLUTTER_ROOT
from argv[0], even though its presence is already guaranteed (the wrappedxcode_backend.dart
in fact relies on this env existing).This
$FLUTTER_ROOT
logic then breaks when run using flutter packaged bynixpkgs
.Extra context
See also: NixOS/nixpkgs#341470
When using nixpkgs flutter, the flutter SDK directory is composed of several immutable layers, joined together using symlinks (called a
symlinkJoin
). Without this patch, the auto-discover traverses the symlinks into the wrong layer, and so it uses an "unwrapped"dart
command instead of a "wrapped" dart that sets some important envs/flags (like$FLUTTER_ROOT
).See: https://github.com/NixOS/nixpkgs/blob/6ec57b76a9a280f4f99bd0dca1e4ab4880fc02c4/pkgs/development/compilers/flutter/flutter.nix#L126-L134
Using the "unwrapped" dart then manifests in this error when compiling, since it doesn't see the ios build-support artifacts:
Pre-launch Checklist
///
).