Skip to content

Commit ece22f3

Browse files
authored
[gardening] remove unnecessary condition in symbol extraction logic (#37428)
This was introduced to avoid indentation changes when making this logic amenable to testing in #37120 .
1 parent 283abc0 commit ece22f3

File tree

1 file changed

+41
-46
lines changed

1 file changed

+41
-46
lines changed

utils/build-script-impl

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,54 +3160,49 @@ for host in "${ALL_HOSTS[@]}"; do
31603160
# descibes
31613161
host_symroot="${INSTALL_SYMROOT}/${host}"
31623162

3163-
# FIXME this if statement is a trick to have a more readable
3164-
# diff for the PR that made the following code
3165-
# amenable to dry run testing
3166-
if [ -n "${DRY_RUN}" -o -z "${DRY_RUN}" ]; then
3167-
set -x
3168-
3169-
CURRENT_INSTALL_DIR=${host_install_destdir}
3170-
CURRENT_PREFIX="${TOOLCHAIN_PREFIX}"
3171-
3172-
# Copy executables and shared libraries from the `host_install_destdir` to
3173-
# INSTALL_SYMROOT and run dsymutil on them.
3174-
(cd "${CURRENT_INSTALL_DIR}" &&
3175-
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -print | \
3176-
filter_paths "${DARWIN_SYMROOT_PATH_FILTERS}" | \
3177-
cpio --insecure -pdm -v "${host_symroot}")
3178-
3179-
dsymutil_path=
3180-
if [[ -n "${DARWIN_INSTALL_EXTRACT_SYMBOLS_USE_JUST_BUILT_DSYMUTIL}" ]]; then
3181-
dsymutil_path=$(find_just_built_local_host_llvm_tool dsymutil)
3182-
else
3183-
dsymutil_path=$(xcrun_find_tool dsymutil)
3184-
fi
3163+
set -x
3164+
3165+
CURRENT_INSTALL_DIR=${host_install_destdir}
3166+
CURRENT_PREFIX="${TOOLCHAIN_PREFIX}"
3167+
3168+
# Copy executables and shared libraries from the `host_install_destdir` to
3169+
# INSTALL_SYMROOT and run dsymutil on them.
3170+
(cd "${CURRENT_INSTALL_DIR}" &&
3171+
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -print | \
3172+
filter_paths "${DARWIN_SYMROOT_PATH_FILTERS}" | \
3173+
cpio --insecure -pdm -v "${host_symroot}")
31853174

3186-
# Run dsymutil on executables and shared libraries.
3187-
#
3188-
# Exclude shell scripts and static archives.
3189-
# Tweak carefully the amount of parallelism -- dsymutil can be memory intensive and
3190-
# as such too many instance can exhaust the memory and slow down/panic the machine
3191-
printJSONStartTimestamp dsymutil
3192-
(cd "${host_symroot}" &&
3193-
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -not -name "*.a" -not -name "*.py" -print | \
3194-
xargs -n 1 -P ${DSYMUTIL_JOBS} ${dsymutil_path})
3195-
printJSONEndTimestamp dsymutil
3196-
3197-
# Strip executables, shared libraries and static libraries in
3198-
# `host_install_destdir`.
3199-
find "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" \
3200-
'(' -perm -0111 -or -name "*.a" ')' -type f -print | \
3201-
xargs -n 1 -P ${BUILD_JOBS} $(xcrun_find_tool strip) -S
3202-
3203-
# Codesign dylibs after strip tool
3204-
# rdar://45388785
3205-
find "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" \
3206-
'(' -name "*.dylib" ')' -type f -print | \
3207-
xargs -n 1 -P ${BUILD_JOBS} $(xcrun_find_tool codesign) -f -s -
3208-
3209-
{ set +x; } 2>/dev/null
3175+
dsymutil_path=
3176+
if [[ -n "${DARWIN_INSTALL_EXTRACT_SYMBOLS_USE_JUST_BUILT_DSYMUTIL}" ]]; then
3177+
dsymutil_path=$(find_just_built_local_host_llvm_tool dsymutil)
3178+
else
3179+
dsymutil_path=$(xcrun_find_tool dsymutil)
32103180
fi
3181+
3182+
# Run dsymutil on executables and shared libraries.
3183+
#
3184+
# Exclude shell scripts and static archives.
3185+
# Tweak carefully the amount of parallelism -- dsymutil can be memory intensive and
3186+
# as such too many instance can exhaust the memory and slow down/panic the machine
3187+
printJSONStartTimestamp dsymutil
3188+
(cd "${host_symroot}" &&
3189+
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -not -name "*.a" -not -name "*.py" -print | \
3190+
xargs -n 1 -P ${DSYMUTIL_JOBS} ${dsymutil_path})
3191+
printJSONEndTimestamp dsymutil
3192+
3193+
# Strip executables, shared libraries and static libraries in
3194+
# `host_install_destdir`.
3195+
find "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" \
3196+
'(' -perm -0111 -or -name "*.a" ')' -type f -print | \
3197+
xargs -n 1 -P ${BUILD_JOBS} $(xcrun_find_tool strip) -S
3198+
3199+
# Codesign dylibs after strip tool
3200+
# rdar://45388785
3201+
find "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" \
3202+
'(' -name "*.dylib" ')' -type f -print | \
3203+
xargs -n 1 -P ${BUILD_JOBS} $(xcrun_find_tool codesign) -f -s -
3204+
3205+
{ set +x; } 2>/dev/null
32113206
fi
32123207
done
32133208
# Everything is 'installed', but some products may be awaiting lipo.

0 commit comments

Comments
 (0)