fix(macos): guard Flutter Assemble phase against direct xcodeproj launch

Prevents build failure when opening Runner.xcodeproj directly instead of
Runner.xcworkspace by checking WORKSPACE_DIR at build time and reporting
actionable error message.
This commit is contained in:
Haitao Pan 2026-03-27 14:56:27 +08:00
parent 33cb86dc4f
commit eadea0ca99

View File

@ -390,7 +390,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
shellScript = "if [[ \"${WORKSPACE_DIR:-}\" == *.xcodeproj ]]; then\n echo \"error: XWorkmate macOS builds with CocoaPods plugins must be launched from macos/Runner.xcworkspace, not Runner.xcodeproj.\" >&2\n echo \"error: Open macos/Runner.xcworkspace in Xcode or run 'flutter build macos' from the repository root.\" >&2\n exit 1\nfi\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
8E8C2A3EBAA3461603096C04 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;