Skip to content

Commit

Permalink
fix: only generate metadata for the targeted arch
Browse files Browse the repository at this point in the history
  • Loading branch information
rigor789 authored and edusperoni committed Jan 31, 2024
1 parent 8c8ae67 commit 4b8ac56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions metadata-generator/build-step-metadata-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 5 additions & 3 deletions project-template/internal/nsld.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"

0 comments on commit 4b8ac56

Please sign in to comment.