-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build-script] Turn on --no-legacy-impl by default #21772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc @compnerd @Rostepher @gottesmm This is a preliminary for https://forums.swift.org/t/rfc-building-swift-packages-in-build-script/18920 |
utils/build-script
Outdated
impl_args += [ | ||
"--%s-cmake-options=%s" % (product_name, ' '.join(cmake_opts)) | ||
] | ||
if len(cmake_opts) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more idiomatic way to write this would be:
if cmake_opts:
utils/build-script-impl
Outdated
-DSWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_I18N_INCLUDE:STRING="${ICU_TMPINSTALL}/include" | ||
-DSWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_STATICLIB:BOOL=TRUE | ||
-DICU_UC_LIBDIR:PATH="${LIBICU_BUILD_DIR}/lib" | ||
-DICU_I18N_LIBDIR:PATH="${LIBICU_BUILD_DIR}/lib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, does this work? I thought that it requires that the path to the library is given instead. I think it would be nicer if we just used -DSWIFT_${SWIFT_HOST_VARIANT_SDK}_${SWIFT_HOST_VARIANT_ARCH}_ICU_{UC,I18N}=
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just kept these the same as they were before. Maybe they were always dead?
@@ -2623,12 +2637,14 @@ for host in "${ALL_HOSTS[@]}"; do | |||
echo "Cleaning the XCTest build directory" | |||
call rm -rf "${XCTEST_BUILD_DIR}" | |||
|
|||
LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this new variable used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the options immediately below, e.g. Line 2645. Previously it depended on this being set somewhere else
# Set the PKG_CONFIG_PATH so that core-foundation can find the libraries and | ||
# header files | ||
LIBICU_BUILD_DIR="$(build_directory ${host} libicu)" | ||
export PKG_CONFIG_PATH="${LIBICU_BUILD_DIR}/config:${PKG_CONFIG_PATH}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were the CMake options removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which ones? Maybe this comment was on the wrong line? There was a set of options being appended to swift_cmake_options
during the setup of ICU that I moved directly into the configuration for swift.
@swift-ci please test |
@swift-ci please build toolchain |
Build failed |
Build failed |
Any additional feedback, @compnerd? |
utils/build-script
Outdated
] | ||
if cmake_opts: | ||
impl_args += [ | ||
"--%s-cmake-options=%s" % |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Nit-pick) We should be using the more modern Python string formatting via the str.format
method. This could be re-written as: '--{}-cmake-options={}'.format(product_name, ' '.join(cmake_opts))
.
@swift-ci please smoke test |
fc6a94d
to
1f5f24f
Compare
@swift-ci please smoke test |
@compnerd or @Rostepher any additional feedback, or is this good to go? |
I'm fine with merging this. |
Turns on the `--no-legacy-impl` option to build-script by default; the old behaviour is temporarily still available as `--legacy-impl`. This causes build-script to invoke build-script-impl for every individual build/test/install/etc. action rather than a single global invocation. For example, a single invocation might be for `macosx-swift-install`. This will enable the python code in build-script to drive the overall process and add additional steps in between actions without the involvement of build-script-impl. It also provides a path to refactoring the existing actions out of build-script-impl individually. Discussed as part of https://forums.swift.org/t/rfc-building-swift-packages-in-build-script/18920 The --no-legacy-impl flag was originally disabled by default because of concerns about the performance of null builds due to the increased number of script invocations. There is a small optimization in this commit to use `tr` when processing command-line options instead of bash's builtin substitution, which eliminates most of the overhead. After this change, a null build of llvm+swift changes from 1.6 s to 2.1 s on Linux, and from 5 s to 6 s on macOS. Non-null builds and builds that involve more build products than just llvm+swift (e.g. corelibs) are basically unaffected since they are not correctly incremental to begin with. The changes to build-script-impl in this commit are to fix the behaviour of --no-legacy-impl, which had bitrotted since it was introduced. These changes are to make various parts of the script not rely on variables defined in "earlier" parts of the script, which is good hygiene in general.
1f5f24f
to
08eabb4
Compare
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
@compnerd is this ready to go, or did you have more feedback? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the builds are happy, I'm happy.
@swift-ci please build toolchain |
Turns on the
--no-legacy-impl
option to build-script by default; theold behaviour is temporarily still available as
--legacy-impl
.This causes build-script to invoke build-script-impl for every
individual build/test/install/etc. action rather than a single global
invocation. For example, a single invocation might be for
macosx-swift-install
. This will enable the python code in build-scriptto drive the overall process and add additional steps in between actions
without the involvement of build-script-impl. It also provides a path to
refactoring the existing actions out of build-script-impl individually.
Discussed as part of https://forums.swift.org/t/rfc-building-swift-packages-in-build-script/18920
The --no-legacy-impl flag was originally disabled by default because of
concerns about the performance of null builds due to the increased
number of script invocations. There is a small optimization in this
commit to use
tr
when processing command-line options instead ofbash's builtin substitution, which eliminates most of the overhead.
After this change, a null build of llvm+swift changes from 1.6 s to
2.1 s on Linux, and from 5 s to 6 s on macOS. Non-null builds and
builds that involve more build products than just llvm+swift (e.g.
corelibs) are basically unaffected since they are not correctly
incremental to begin with.
The changes to build-script-impl in this commit are to fix the behaviour
of --no-legacy-impl, which had bitrotted since it was introduced. These
changes are to make various parts of the script not rely on variables
defined in "earlier" parts of the script, which is good hygiene in
general.