Skip to content

Commit b3c8709

Browse files
committed
Fix Metal toolchain in Xcode 26+
Signed-off-by: Adin Cebic <cebic.ad@gmail.com>
1 parent 75e98bd commit b3c8709

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

xcodeproj/internal/templates/bazel_build.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,20 @@ readonly base_pre_config_flags=(
9797
# Custom Swift toolchains
9898

9999
if [[ -n "${TOOLCHAINS-}" ]]; then
100-
toolchain="${TOOLCHAINS%% *}"
101-
if [[ "$toolchain" == "com.apple.dt.toolchain.XcodeDefault" ]]; then
102-
unset toolchain
100+
# We remove all Metal toolchains from the list first
101+
toolchains_array=($TOOLCHAINS)
102+
filtered_toolchains=()
103+
for tc in "${toolchains_array[@]}"; do
104+
if [[ "$tc" != "com.apple.dt.toolchain.Metal"* ]]; then
105+
filtered_toolchains+=("$tc")
106+
fi
107+
done
108+
109+
if [[ ${#filtered_toolchains[@]} -gt 0 ]]; then
110+
toolchain="${filtered_toolchains[0]}"
111+
if [[ "$toolchain" == "com.apple.dt.toolchain.XcodeDefault" ]]; then
112+
unset toolchain
113+
fi
103114
fi
104115
fi
105116

0 commit comments

Comments
 (0)