Skip to content

Commit a5d265d

Browse files
committed
fix: link if clang path is found otherwise skip and log that it was skipped with directory
1 parent e7e49a6 commit a5d265d

File tree

1 file changed

+17
-5
lines changed
  • project-template-ios/internal

1 file changed

+17
-5
lines changed

project-template-ios/internal/nsld.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,22 @@ GEN_MODULEMAP $TARGET_ARCH
5858
printf "Generating metadata..."
5959
GEN_METADATA $TARGET_ARCH
6060
DELETE_SWIFT_MODULES_DIR
61-
NS_LD="${NS_LD:-"$TOOLCHAIN_DIR/usr/bin/clang"}"
62-
# Skip linking if the resolved linker path points to a transient Metal.xctoolchain
63-
if [[ "$NS_LD" == *"Metal.xctoolchain"* ]]; then
64-
echo "NSLD: Skipping link because NS_LD resolves to a Metal.xctoolchain: $NS_LD"
61+
62+
# Resolve linker: prefer provided NS_LD, otherwise use toolchain clang if present.
63+
DEFAULT_LD="$TOOLCHAIN_DIR/usr/bin/clang"
64+
if [[ -z "$NS_LD" ]]; then
65+
if [[ -x "$DEFAULT_LD" ]]; then
66+
NS_LD="$DEFAULT_LD"
67+
else
68+
echo "NSLD: Skipping link because toolchain clang not found: $DEFAULT_LD (TOOLCHAIN_DIR may be missing)."
69+
exit 0
70+
fi
71+
fi
72+
73+
# If NS_LD was explicitly set to the default path but it's missing, skip as well.
74+
if [[ "$NS_LD" == "$DEFAULT_LD" && ! -x "$NS_LD" ]]; then
75+
echo "NSLD: Skipping link because toolchain clang not found: $NS_LD (TOOLCHAIN_DIR may be missing)."
6576
exit 0
6677
fi
67-
$NS_LD "$@"
78+
79+
"$NS_LD" "$@"

0 commit comments

Comments
 (0)