···
1
+
Fix for macOS build issue in Flutter >= 3.35
3
+
Since version 3.35, the behavior of macos_assemble.sh and xcode_backend.sh
4
+
is almost identical. This caused the same error for macOS that previously
7
+
Derived from the iOS patch: ./fix-ios-build-xcode-backend-sh.patch
11
+
$ flutter run -d macos
12
+
Launching lib/main.dart on macOS in debug mode...
13
+
Target debug_unpack_macos failed: Error: Flutter failed to create a directory at "/<nix-store>/XXXX-flutter-3.35.1-unwrapped/bin/cache/artifacts".
14
+
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.
15
+
Failed to copy Flutter framework.
21
+
diff --git a/packages/flutter_tools/bin/macos_assemble.sh b/packages/flutter_tools/bin/macos_assemble.sh
22
+
index 28acf8842..d0f2923df 100644
23
+
--- a/packages/flutter_tools/bin/macos_assemble.sh
24
+
+++ b/packages/flutter_tools/bin/macos_assemble.sh
26
+
# exit on error, or usage of unset var
29
+
-# Needed because if it is set, cd may print the path it changed to.
32
+
-function follow_links() (
33
+
- cd -P "$(dirname -- "$1")"
34
+
- file="$PWD/$(basename -- "$1")"
35
+
- while [[ -h "$file" ]]; do
36
+
- cd -P "$(dirname -- "$file")"
37
+
- file="$(readlink -- "$file")"
38
+
- cd -P "$(dirname -- "$file")"
39
+
- file="$PWD/$(basename -- "$file")"
44
+
-PROG_NAME="$(follow_links "${BASH_SOURCE[0]}")"
45
+
-BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
46
+
-FLUTTER_ROOT="$BIN_DIR/../../.."
47
+
-DART="$FLUTTER_ROOT/bin/dart"
48
+
+# Run `dart ./xcode_backend.dart` with the dart from $FLUTTER_ROOT.
49
+
+dart="${FLUTTER_ROOT}/bin/dart"
50
+
+xcode_backend_dart="$(dirname "${BASH_SOURCE[0]}")/xcode_backend.dart"
53
+
if [[ $# == 0 ]]; then
54
+
- "$DART" "$BIN_DIR/xcode_backend.dart" "build" "macos"
55
+
+ exec "${dart}" "${xcode_backend_dart}" "build" "macos"
57
+
- "$DART" "$BIN_DIR/xcode_backend.dart" "$@" "macos"
58
+
+ exec "${dart}" "${xcode_backend_dart}" "$@" "macos"