From 90a4d2fe03e707d9cc32566768ac1f02d3fd3d68 Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Thu, 2 May 2024 15:50:16 -0700 Subject: [PATCH 1/7] Add swift-foundation-icu to toolchain build --- .../build_script_invocation.py | 3 + .../products/foundation.py | 72 ++++++++++++++++++- .../update-checkout-config.json | 8 ++- 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/utils/swift_build_support/swift_build_support/build_script_invocation.py b/utils/swift_build_support/swift_build_support/build_script_invocation.py index 68eff1377d71d..13f319a09baf6 100644 --- a/utils/swift_build_support/swift_build_support/build_script_invocation.py +++ b/utils/swift_build_support/swift_build_support/build_script_invocation.py @@ -624,6 +624,9 @@ def compute_product_pipelines(self): builder.add_product(products.curl.LibCurl, is_enabled=self.args.build_curl) + builder.add_product(products.foundation.SwiftFoundationICU, + is_enabled=self.args.build_foundation) + # Begin a build-script-impl pipeline for handling the compiler toolchain # and a subset of the tools that we build. We build these in this manner # to preserve current build-script-impl run behavior as we transition diff --git a/utils/swift_build_support/swift_build_support/products/foundation.py b/utils/swift_build_support/swift_build_support/products/foundation.py index 12057fe560d5c..bbeb2f9d5bd88 100644 --- a/utils/swift_build_support/swift_build_support/products/foundation.py +++ b/utils/swift_build_support/swift_build_support/products/foundation.py @@ -10,6 +10,7 @@ # # ---------------------------------------------------------------------------- +from . import cmake_product from . import cmark from . import curl from . import libcxx @@ -21,6 +22,74 @@ from . import swift from . import zlib +class SwiftFoundationICU(cmake_product.CMakeProduct): + @classmethod + def is_build_script_impl_product(cls): + """is_build_script_impl_product -> bool + + Whether this product is produced by build-script-impl. + """ + return False + + @classmethod + def is_before_build_script_impl_product(cls): + """is_before_build_script_impl_product -> bool + + Whether this product is built before any build-script-impl products. + """ + return True + + @classmethod + def product_source_name(cls): + """product_source_name() -> str + + The name of the source code directory of this product. + """ + return "swift-foundation-icu" + + @classmethod + def get_dependencies(cls): + return [swift.Swift] + + @classmethod + def is_nondarwin_only_build_product(cls): + return True + + def should_build(self, host_target): + """should_build() -> Bool + + Whether or not this product should be built with the given arguments. + """ + return self.args.build_foundation + + def build(self, host_target): + """build() -> void + + Perform the build, for a non-build-script-impl product. + """ + self.build_with_cmake(['FoundationICU'], self.args.foundation_build_variant, [], True) + + def should_test(self, host_target): + """should_test() -> Bool + + Whether or not this product should be tested with the given arguments. + """ + return False + + def should_install(self, host_target): + """should_install() -> Bool + + Whether or not this product should be installed with the given + arguments. + """ + return self.args.build_foundation + + def install(self, host_target): + """install() -> void + + Install to the toolchain, for a non-build-script-impl product. + """ + self.install_with_cmake(['install'], self.host_install_destdir(host_target)) class Foundation(product.Product): @classmethod @@ -57,7 +126,8 @@ def get_dependencies(cls): libdispatch.LibDispatch, libxml2.LibXML2, zlib.Zlib, - curl.LibCurl] + curl.LibCurl, + SwiftFoundationICU] @classmethod def is_nondarwin_only_build_product(cls): diff --git a/utils/update_checkout/update-checkout-config.json b/utils/update_checkout/update-checkout-config.json index 4630ac262f944..38f1f5d4fb2b2 100644 --- a/utils/update_checkout/update-checkout-config.json +++ b/utils/update_checkout/update-checkout-config.json @@ -41,7 +41,11 @@ "swift-corelibs-xctest": { "remote": { "id": "apple/swift-corelibs-xctest" } }, "swift-corelibs-foundation": { - "remote": { "id": "apple/swift-corelibs-foundation" } }, + "remote": { "id": "apple/swift-corelibs-foundation" } }, + "swift-foundation-icu": { + "remote": { "id": "apple/swift-foundation-icu" } }, + "swift-foundation": { + "remote": { "id": "apple/swift-foundation" } }, "swift-corelibs-libdispatch": { "remote": { "id": "apple/swift-corelibs-libdispatch" } }, "swift-integration-tests": { @@ -281,6 +285,8 @@ "swift-stress-tester": "main", "swift-corelibs-xctest": "main", "swift-corelibs-foundation": "main", + "swift-foundation-icu": "main", + "swift-foundation": "main", "swift-corelibs-libdispatch": "main", "swift-integration-tests": "main", "swift-xcode-playground-support": "main", From dfa91dc0e590f5dbb6a30a7e2f8bd74e723ca67c Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Thu, 2 May 2024 18:53:38 -0700 Subject: [PATCH 2/7] Move repo dependencies to correct scheme --- utils/update_checkout/update-checkout-config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/update_checkout/update-checkout-config.json b/utils/update_checkout/update-checkout-config.json index 38f1f5d4fb2b2..5ee039c43c3d2 100644 --- a/utils/update_checkout/update-checkout-config.json +++ b/utils/update_checkout/update-checkout-config.json @@ -138,6 +138,8 @@ "swift-stress-tester": "main", "swift-corelibs-xctest": "main", "swift-corelibs-foundation": "main", + "swift-foundation-icu": "main", + "swift-foundation": "main", "swift-corelibs-libdispatch": "main", "swift-integration-tests": "main", "swift-xcode-playground-support": "main", @@ -285,8 +287,6 @@ "swift-stress-tester": "main", "swift-corelibs-xctest": "main", "swift-corelibs-foundation": "main", - "swift-foundation-icu": "main", - "swift-foundation": "main", "swift-corelibs-libdispatch": "main", "swift-integration-tests": "main", "swift-xcode-playground-support": "main", From c04544a0da2df0276cf40942b6de3aec71657376 Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Thu, 2 May 2024 22:04:40 -0700 Subject: [PATCH 3/7] Move swift-foundation-icu build after swift build --- .../swift_build_support/build_script_invocation.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/swift_build_support/swift_build_support/build_script_invocation.py b/utils/swift_build_support/swift_build_support/build_script_invocation.py index 13f319a09baf6..9342cfbe2db75 100644 --- a/utils/swift_build_support/swift_build_support/build_script_invocation.py +++ b/utils/swift_build_support/swift_build_support/build_script_invocation.py @@ -624,9 +624,6 @@ def compute_product_pipelines(self): builder.add_product(products.curl.LibCurl, is_enabled=self.args.build_curl) - builder.add_product(products.foundation.SwiftFoundationICU, - is_enabled=self.args.build_foundation) - # Begin a build-script-impl pipeline for handling the compiler toolchain # and a subset of the tools that we build. We build these in this manner # to preserve current build-script-impl run behavior as we transition @@ -646,6 +643,13 @@ def compute_product_pipelines(self): builder.add_impl_product(products.LibDispatch, is_enabled=self.args.build_libdispatch) + # Begin a pipeline to build Foundation's dependencies now that Swift + # has built. This needs to be done before Foundation can build + builder.begin_pipeline() + + builder.add_product(products.foundation.SwiftFoundationICU, + is_enabled=self.args.build_foundation) + # Begin a new build-script-impl pipeline that builds libraries that we # build as part of build-script-impl but that we should eventually move # onto build-script products. From 0b4f5e6d7d80e376e77152a9674cd8147418f3ef Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Fri, 3 May 2024 11:02:45 -0700 Subject: [PATCH 4/7] Remove swift-foundation-icu from build script --- .../build_script_invocation.py | 7 -- .../products/foundation.py | 72 +------------------ 2 files changed, 1 insertion(+), 78 deletions(-) diff --git a/utils/swift_build_support/swift_build_support/build_script_invocation.py b/utils/swift_build_support/swift_build_support/build_script_invocation.py index 9342cfbe2db75..68eff1377d71d 100644 --- a/utils/swift_build_support/swift_build_support/build_script_invocation.py +++ b/utils/swift_build_support/swift_build_support/build_script_invocation.py @@ -643,13 +643,6 @@ def compute_product_pipelines(self): builder.add_impl_product(products.LibDispatch, is_enabled=self.args.build_libdispatch) - # Begin a pipeline to build Foundation's dependencies now that Swift - # has built. This needs to be done before Foundation can build - builder.begin_pipeline() - - builder.add_product(products.foundation.SwiftFoundationICU, - is_enabled=self.args.build_foundation) - # Begin a new build-script-impl pipeline that builds libraries that we # build as part of build-script-impl but that we should eventually move # onto build-script products. diff --git a/utils/swift_build_support/swift_build_support/products/foundation.py b/utils/swift_build_support/swift_build_support/products/foundation.py index bbeb2f9d5bd88..12057fe560d5c 100644 --- a/utils/swift_build_support/swift_build_support/products/foundation.py +++ b/utils/swift_build_support/swift_build_support/products/foundation.py @@ -10,7 +10,6 @@ # # ---------------------------------------------------------------------------- -from . import cmake_product from . import cmark from . import curl from . import libcxx @@ -22,74 +21,6 @@ from . import swift from . import zlib -class SwiftFoundationICU(cmake_product.CMakeProduct): - @classmethod - def is_build_script_impl_product(cls): - """is_build_script_impl_product -> bool - - Whether this product is produced by build-script-impl. - """ - return False - - @classmethod - def is_before_build_script_impl_product(cls): - """is_before_build_script_impl_product -> bool - - Whether this product is built before any build-script-impl products. - """ - return True - - @classmethod - def product_source_name(cls): - """product_source_name() -> str - - The name of the source code directory of this product. - """ - return "swift-foundation-icu" - - @classmethod - def get_dependencies(cls): - return [swift.Swift] - - @classmethod - def is_nondarwin_only_build_product(cls): - return True - - def should_build(self, host_target): - """should_build() -> Bool - - Whether or not this product should be built with the given arguments. - """ - return self.args.build_foundation - - def build(self, host_target): - """build() -> void - - Perform the build, for a non-build-script-impl product. - """ - self.build_with_cmake(['FoundationICU'], self.args.foundation_build_variant, [], True) - - def should_test(self, host_target): - """should_test() -> Bool - - Whether or not this product should be tested with the given arguments. - """ - return False - - def should_install(self, host_target): - """should_install() -> Bool - - Whether or not this product should be installed with the given - arguments. - """ - return self.args.build_foundation - - def install(self, host_target): - """install() -> void - - Install to the toolchain, for a non-build-script-impl product. - """ - self.install_with_cmake(['install'], self.host_install_destdir(host_target)) class Foundation(product.Product): @classmethod @@ -126,8 +57,7 @@ def get_dependencies(cls): libdispatch.LibDispatch, libxml2.LibXML2, zlib.Zlib, - curl.LibCurl, - SwiftFoundationICU] + curl.LibCurl] @classmethod def is_nondarwin_only_build_product(cls): From 34278bcbd15f62a478e049ac8015715e69ca4ae0 Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Mon, 20 May 2024 14:31:30 -0700 Subject: [PATCH 5/7] Provide source dirs to Foundations build for dependencies --- utils/build-script-impl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/build-script-impl b/utils/build-script-impl index 9beb8119ab079..b3a172a2841c0 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -1236,10 +1236,13 @@ STRESSTEST_PACKAGE_DIR="${WORKSPACE}/swift-stress-tester" XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest" FOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation" FOUNDATION_STATIC_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation" +FOUNDATION_SWIFTFOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-foundation" +FOUNDATION_SWIFTFOUNDATIONICU_SOURCE_DIR="${WORKSPACE}/swift-foundation-icu" LIBDISPATCH_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch" LIBDISPATCH_STATIC_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch" LIBICU_SOURCE_DIR="${WORKSPACE}/icu" LIBCXX_SOURCE_DIR="${WORKSPACE}/llvm-project/runtimes" +SWIFT_COLLECTIONS_SOURCE_DIR="${WORKSPACE}/swift-collections" SWIFT_PATH_TO_STRING_PROCESSING_SOURCE="${WORKSPACE}/swift-experimental-string-processing" SWIFTSYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax" SWIFT_SYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax" @@ -2519,6 +2522,10 @@ for host in "${ALL_HOSTS[@]}"; do -DFOUNDATION_PATH_TO_LIBDISPATCH_BUILD=$(build_directory ${host} libdispatch) -Ddispatch_DIR=$(build_directory ${host} libdispatch)/cmake/modules + -D_SwiftFoundation_SourceDIR=${FOUNDATION_SWIFTFOUNDATION_SOURCE_DIR} + -D_SwiftFoundationICU_SourceDIR=${FOUNDATION_SWIFTFOUNDATIONICU_SOURCE_DIR} + -D_SwiftCollections_SourceDIR=${SWIFT_COLLECTIONS_SOURCE_DIR} + # NOTE(compnerd) we disable tests because XCTest is not ready # yet, but we will reconfigure when the time comes. -DENABLE_TESTING:BOOL=NO From e4164297ecc65a95f8ac2b18e10073422108cb9a Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Mon, 20 May 2024 14:34:43 -0700 Subject: [PATCH 6/7] Update swift-collections to 1.1 --- utils/update_checkout/update-checkout-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/update_checkout/update-checkout-config.json b/utils/update_checkout/update-checkout-config.json index 5ee039c43c3d2..117b64df994ed 100644 --- a/utils/update_checkout/update-checkout-config.json +++ b/utils/update_checkout/update-checkout-config.json @@ -125,7 +125,7 @@ "swiftpm": "main", "swift-argument-parser": "1.2.3", "swift-atomics": "1.2.0", - "swift-collections": "1.0.5", + "swift-collections": "1.1.0", "swift-crypto": "3.0.0", "swift-certificates": "1.0.1", "swift-asn1": "1.0.0", From 4e9d6d90aab91d8d4bc2cb003fbaae647aef0cae Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Fri, 24 May 2024 14:33:11 -0700 Subject: [PATCH 7/7] Pass SwiftSyntax path to scl-f build --- utils/build-script-impl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/build-script-impl b/utils/build-script-impl index b3a172a2841c0..b0e28a657f54d 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -2522,6 +2522,8 @@ for host in "${ALL_HOSTS[@]}"; do -DFOUNDATION_PATH_TO_LIBDISPATCH_BUILD=$(build_directory ${host} libdispatch) -Ddispatch_DIR=$(build_directory ${host} libdispatch)/cmake/modules + -DSwiftSyntax_DIR=$(build_directory ${host} swift)/cmake/modules + -D_SwiftFoundation_SourceDIR=${FOUNDATION_SWIFTFOUNDATION_SOURCE_DIR} -D_SwiftFoundationICU_SourceDIR=${FOUNDATION_SWIFTFOUNDATIONICU_SOURCE_DIR} -D_SwiftCollections_SourceDIR=${SWIFT_COLLECTIONS_SOURCE_DIR}