From 03b27e568930bc97c1ba540793f6362e0f1bc67e Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Sat, 16 May 2026 22:01:34 -0300 Subject: [PATCH] fix: use -fmodule-map-file for Swift metadata discovery in nsld.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace HEADER_SEARCH_PATHS-based module discovery with explicit -fmodule-map-file= for the nsswiftsupport modulemap. The directory-based discovery via -I was unreliable — the metadata generator's clang would sometimes fail to find the modulemap, or during parallel multi-arch builds, discover modulemaps from both architectures through the parent internal/ directory (which is also in HEADER_SEARCH_PATHS), causing "redefinition of module 'nsswiftsupport'" errors and potentially using a stale bridging header from the wrong architecture. This resulted in intermittent "ReferenceError: is not defined" errors for Swift plugin classes after npm install, requiring a full platforms/ delete to recover. --- project-template-ios/internal/nsld.sh | 2 +- project-template-vision/internal/nsld.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/project-template-ios/internal/nsld.sh b/project-template-ios/internal/nsld.sh index e73c7bda..c61a8c09 100755 --- a/project-template-ios/internal/nsld.sh +++ b/project-template-ios/internal/nsld.sh @@ -62,7 +62,7 @@ function GEN_METADATA() { } GEN_MODULEMAP $TARGET_ARCH -export HEADER_SEARCH_PATHS="$HEADER_SEARCH_PATHS \"$MODULES_DIR\"" +export OTHER_CFLAGS="$OTHER_CFLAGS -fmodule-map-file=\"$MODULES_DIR/module.modulemap\"" printf "Generating metadata..." GEN_METADATA $TARGET_ARCH DELETE_SWIFT_MODULES_DIR diff --git a/project-template-vision/internal/nsld.sh b/project-template-vision/internal/nsld.sh index e07521a8..c4773a2d 100755 --- a/project-template-vision/internal/nsld.sh +++ b/project-template-vision/internal/nsld.sh @@ -62,7 +62,7 @@ function GEN_METADATA() { } GEN_MODULEMAP $TARGET_ARCH -export HEADER_SEARCH_PATHS="${HEADER_SEARCH_PATHS:+$HEADER_SEARCH_PATHS }\"$MODULES_DIR\"" +export OTHER_CFLAGS="${OTHER_CFLAGS:+$OTHER_CFLAGS }-fmodule-map-file=\"$MODULES_DIR/module.modulemap\"" printf "Generating metadata..." GEN_METADATA $TARGET_ARCH DELETE_SWIFT_MODULES_DIR