Skip to content

Commit e235256

Browse files
authored
Merge pull request swiftlang#38888 from gottesmm/stage2-swift-split-build-script-impl
[build-script] Split the build-script-impl pipeline into two pipelines so I can put a build-script product pipeline in between.
2 parents db65543 + 4f149d0 commit e235256

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

utils/swift_build_support/swift_build_support/build_script_invocation.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def compute_product_pipelines(self):
529529
# the build-script code base. The main difference is that these are all
530530
# build, tested, and installed all at once instead of performing build,
531531
# test, install like a normal build-script product.
532-
builder.begin_impl_pipeline(should_run_epilogue_operations=True)
532+
builder.begin_impl_pipeline(should_run_epilogue_operations=False)
533533

534534
# If --skip-build-llvm is passed in, LLVM cannot be completely disabled, as
535535
# Swift still needs a few LLVM targets like tblgen to be built for it to be
@@ -544,6 +544,11 @@ def compute_product_pipelines(self):
544544
is_enabled=self.args.build_swift)
545545
builder.add_impl_product(products.LLDB,
546546
is_enabled=self.args.build_lldb)
547+
548+
# Begin a new build-script-impl pipeline that builds libraries that we
549+
# build as part of build-script-impl but that we should eventually move
550+
# onto build-script products.
551+
builder.begin_impl_pipeline(should_run_epilogue_operations=True)
547552
builder.add_impl_product(products.LibDispatch,
548553
is_enabled=self.args.build_libdispatch)
549554
builder.add_impl_product(products.Foundation,
@@ -622,13 +627,17 @@ def execute(self):
622627

623628
# Execute each "product pipeline".
624629
for index in range(len(product_pipelines)):
630+
perform_epilogue_opts = last_impl_index == index
625631
pipeline = product_pipelines[index]
632+
626633
# Skip empty pipelines.
627634
if len(pipeline) == 0:
635+
if perform_epilogue_opts:
636+
self._execute_merged_host_lipo_core_action()
628637
continue
638+
629639
is_impl = pipeline[0].is_build_script_impl_product()
630640
if is_impl:
631-
perform_epilogue_opts = last_impl_index == index
632641
self._execute_impl(pipeline, all_hosts, perform_epilogue_opts)
633642
else:
634643
assert(index != last_impl_index)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# REQUIRES: standalone_build
2+
# REQUIRES: OS=macosx
3+
4+
# RUN: %empty-directory(%t)
5+
# RUN: mkdir -p %t
6+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --dry-run --cmake %cmake --infer --swiftpm --verbose-build 2>&1 | %FileCheck %s
7+
8+
# Make sure we build swift, llvm, llbuild, then do core lipo, then build
9+
# swiftpm, and finally finish by running the rest of the epilogue operations.
10+
11+
# CHECK: cmake -G Ninja {{.*}}llvm-project/llvm
12+
# CHECK: cmake -G Ninja {{.*}}swift
13+
# CHECK: --only-execute {{.*}}-llbuild-build
14+
# CHECK: --only-execute merged-hosts-lipo-core
15+
# CHECK: --- Building swiftpm ---
16+
# CHECK: --only-execute merged-hosts-lipo
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RUN: %empty-directory(%t)
2+
# RUN: mkdir -p %t
3+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --verbose-build --dry-run --cmake %cmake 2>&1 | %FileCheck %s
4+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --verbose-build --dry-run --cmake %cmake --infer 2>&1 | %FileCheck %s
5+
# RUN: SKIP_XCODE_VERSION_CHECK=1 SWIFT_BUILD_ROOT=%t %swift_src_root/utils/build-script --verbose-build --dry-run --cmake %cmake --infer --swiftpm 2>&1 | %FileCheck %s
6+
7+
# Make sure we run the merged hosts lipo step regardless of whether or not we
8+
# are building anything from the 2nd build-script-impl phase with or without
9+
# infer.
10+
11+
# CHECK: --only-execute merged-hosts-lipo

validation-test/BuildSystem/infer_dumps_deps_if_verbose_build.test

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010
# CHECK: Initial Product List:
1111
# CHECK: earlyswiftdriver
1212
# CHECK: -- Build Graph Inference --
13-
# CHECK: Initial Product List:
13+
# CHECK-NEXT: Initial Product List:
1414
# CHECK: llvm
1515
# CHECK: swift
16+
# CHECK-NOT: llbuild
1617
# CHECK: -- Build Graph Inference --
17-
# CHECK: Initial Product List:
18+
# CHECK-NEXT: Initial Product List:
1819
# CHECK: swiftpm
20+
# CHECK-NOT: llbuild
1921
# CHECK: Final Build Order:
2022
# CHECK: earlyswiftdriver
2123
# CHECK: cmark
2224
# CHECK: llvm
2325
# CHECK: swift
26+
# CHECK: llbuild
2427
# CHECK: swiftpm
2528

2629
# Ensure early SwiftDriver is built first

0 commit comments

Comments
 (0)