Skip to content

Commit 17a5c5f

Browse files
authored
fix: only generate metadata for the targeted arch (#236)
1 parent a675500 commit 17a5c5f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

metadata-generator/build-step-metadata-generator.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,5 +174,11 @@ def generate_metadata(arch):
174174

175175

176176
for arch in env("ARCHS").split():
177+
# skip metadata generation for architectures different than the one specified in the command line
178+
# in case the command line argument is not specified, generate metadata for all architectures
179+
if len(sys.argv) >= 2 and sys.argv[1].lower() != arch.lower():
180+
print("Skipping metadata generation for " + arch)
181+
continue
182+
177183
print("Generating metadata for " + arch)
178184
generate_metadata(arch)

project-template/internal/nsld.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,19 @@ function GEN_MODULEMAP() {
4444
}
4545

4646
function GEN_METADATA() {
47+
TARGET_ARCH=$1
4748
set -e
4849
cpu_arch=$(uname -m)
4950
pushd "$SRCROOT/internal/metadata-generator-${cpu_arch}/bin"
50-
./build-step-metadata-generator.py
51+
./build-step-metadata-generator.py $TARGET_ARCH
5152
popd
5253
}
5354

5455
# Workaround for ARCH being set to `undefined_arch` here. Extract it from command line arguments.
55-
GEN_MODULEMAP $(getArch "$@")
56+
TARGET_ARCH=$(getArch "$@")
57+
GEN_MODULEMAP $TARGET_ARCH
5658
printf "Generating metadata..."
57-
GEN_METADATA
59+
GEN_METADATA $TARGET_ARCH
5860
DELETE_SWIFT_MODULES_DIR
5961
NS_LD="${NS_LD:-"$TOOLCHAIN_DIR/usr/bin/clang"}"
6062
$NS_LD "$@"

0 commit comments

Comments
 (0)