Skip to content

Commit ecd3598

Browse files
authored
fix: use -fmodule-map-file for Swift metadata discovery in nsld.sh (#374)
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: <class> is not defined" errors for Swift plugin classes after npm install, requiring a full platforms/ delete to recover.
1 parent 90ac16c commit ecd3598

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

  • project-template-ios/internal
  • project-template-vision/internal

project-template-ios/internal/nsld.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function GEN_METADATA() {
6262
}
6363

6464
GEN_MODULEMAP $TARGET_ARCH
65-
export HEADER_SEARCH_PATHS="$HEADER_SEARCH_PATHS \"$MODULES_DIR\""
65+
export OTHER_CFLAGS="$OTHER_CFLAGS -fmodule-map-file=\"$MODULES_DIR/module.modulemap\""
6666
printf "Generating metadata..."
6767
GEN_METADATA $TARGET_ARCH
6868
DELETE_SWIFT_MODULES_DIR

project-template-vision/internal/nsld.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function GEN_METADATA() {
6262
}
6363

6464
GEN_MODULEMAP $TARGET_ARCH
65-
export HEADER_SEARCH_PATHS="${HEADER_SEARCH_PATHS:+$HEADER_SEARCH_PATHS }\"$MODULES_DIR\""
65+
export OTHER_CFLAGS="${OTHER_CFLAGS:+$OTHER_CFLAGS }-fmodule-map-file=\"$MODULES_DIR/module.modulemap\""
6666
printf "Generating metadata..."
6767
GEN_METADATA $TARGET_ARCH
6868
DELETE_SWIFT_MODULES_DIR

0 commit comments

Comments
 (0)