From 17a5c5ff118c2803c0385891224fb30168268ac8 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Wed, 31 Jan 2024 17:06:54 +0100 Subject: [PATCH] fix: only generate metadata for the targeted arch (#236) --- metadata-generator/build-step-metadata-generator.py | 6 ++++++ project-template/internal/nsld.sh | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/metadata-generator/build-step-metadata-generator.py b/metadata-generator/build-step-metadata-generator.py index 6152ced9..ef80977e 100755 --- a/metadata-generator/build-step-metadata-generator.py +++ b/metadata-generator/build-step-metadata-generator.py @@ -174,5 +174,11 @@ def generate_metadata(arch): for arch in env("ARCHS").split(): + # skip metadata generation for architectures different than the one specified in the command line + # in case the command line argument is not specified, generate metadata for all architectures + if len(sys.argv) >= 2 and sys.argv[1].lower() != arch.lower(): + print("Skipping metadata generation for " + arch) + continue + print("Generating metadata for " + arch) generate_metadata(arch) diff --git a/project-template/internal/nsld.sh b/project-template/internal/nsld.sh index 5a6179c5..9b5dda3a 100755 --- a/project-template/internal/nsld.sh +++ b/project-template/internal/nsld.sh @@ -44,17 +44,19 @@ function GEN_MODULEMAP() { } function GEN_METADATA() { + TARGET_ARCH=$1 set -e cpu_arch=$(uname -m) pushd "$SRCROOT/internal/metadata-generator-${cpu_arch}/bin" - ./build-step-metadata-generator.py + ./build-step-metadata-generator.py $TARGET_ARCH popd } # Workaround for ARCH being set to `undefined_arch` here. Extract it from command line arguments. -GEN_MODULEMAP $(getArch "$@") +TARGET_ARCH=$(getArch "$@") +GEN_MODULEMAP $TARGET_ARCH printf "Generating metadata..." -GEN_METADATA +GEN_METADATA $TARGET_ARCH DELETE_SWIFT_MODULES_DIR NS_LD="${NS_LD:-"$TOOLCHAIN_DIR/usr/bin/clang"}" $NS_LD "$@"