Skip to content

Commit bded632

Browse files
authored
Merge pull request #32224 from gottesmm/pr-62982e80e54331e66895fc94aa8491a27c38b0d7
[build-script] Explicitly separate build-script-impl products and non-build-script-impl-products when building the list of products to build.
2 parents c045802 + 37fefa7 commit bded632

File tree

1 file changed

+37
-21
lines changed

1 file changed

+37
-21
lines changed

utils/build-script

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,13 @@ class BuildScriptInvocation(object):
451451
]
452452

453453
# Compute any product specific cmake arguments.
454-
for product_class in self.compute_product_classes():
454+
#
455+
# NOTE: The sum(list(...)) is b/c compute_product_classes returns a
456+
# tuple of lists of which the first is the build-script-impl products
457+
# and the second is the non-build-script-impl-products. It guarantees
458+
# that when we concatenate these two lists together we get a valid
459+
# dependency graph.
460+
for product_class in sum(list(self.compute_product_classes()), []):
455461
if not product_class.is_build_script_impl_product():
456462
continue
457463

@@ -793,33 +799,41 @@ class BuildScriptInvocation(object):
793799
return options
794800

795801
def compute_product_classes(self):
796-
"""compute_product_classes() -> list
802+
"""compute_product_classes() -> (list, list)
803+
804+
Compute the list first of all build-script-impl products and then all
805+
non-build-script-impl products. It is assumed that concatenating the two
806+
lists together will result in a valid dependency graph for the
807+
compilation.
797808
798-
Compute the list of all Product classes used in this build. This list
799-
is constructed in dependency order.
800809
"""
801810

802811
# FIXME: This is a weird division (returning a list of class objects),
803812
# but it matches the existing structure of the `build-script-impl`.
804-
805-
product_classes = []
806-
product_classes.append(products.CMark)
807-
product_classes.append(products.LLVM)
813+
impl_product_classes = []
814+
impl_product_classes.append(products.CMark)
815+
impl_product_classes.append(products.LLVM)
808816
if self.args.build_libcxx:
809-
product_classes.append(products.LibCXX)
817+
impl_product_classes.append(products.LibCXX)
810818
if self.args.build_libicu:
811-
product_classes.append(products.LibICU)
812-
product_classes.append(products.Swift)
819+
impl_product_classes.append(products.LibICU)
820+
impl_product_classes.append(products.Swift)
813821
if self.args.build_lldb:
814-
product_classes.append(products.LLDB)
822+
impl_product_classes.append(products.LLDB)
815823
if self.args.build_libdispatch:
816-
product_classes.append(products.LibDispatch)
824+
impl_product_classes.append(products.LibDispatch)
817825
if self.args.build_foundation:
818-
product_classes.append(products.Foundation)
826+
impl_product_classes.append(products.Foundation)
819827
if self.args.build_xctest:
820-
product_classes.append(products.XCTest)
828+
impl_product_classes.append(products.XCTest)
821829
if self.args.build_llbuild:
822-
product_classes.append(products.LLBuild)
830+
impl_product_classes.append(products.LLBuild)
831+
# Sanity check that all of our impl classes are actually
832+
# build_script_impl products.
833+
for prod in impl_product_classes:
834+
assert(prod.is_build_script_impl_product())
835+
836+
product_classes = []
823837
if self.args.build_swiftpm:
824838
product_classes.append(products.SwiftPM)
825839
if self.args.build_swiftsyntax:
@@ -844,7 +858,12 @@ class BuildScriptInvocation(object):
844858
product_classes.append(products.SwiftInspect)
845859
if self.args.tsan_libdispatch_test:
846860
product_classes.append(products.TSanLibDispatch)
847-
return product_classes
861+
# Sanity check that all of our non-impl classes are actually
862+
# not build_script_impl products.
863+
for prod in product_classes:
864+
assert(not prod.is_build_script_impl_product())
865+
866+
return (impl_product_classes, product_classes)
848867

849868
def execute(self):
850869
"""Execute the invocation with the configured arguments."""
@@ -872,10 +891,7 @@ class BuildScriptInvocation(object):
872891
#
873892
# FIXME: This should really be per-host, but the current structure
874893
# matches that of `build-script-impl`.
875-
product_classes = self.compute_product_classes()
876-
877-
impl_product_classes = [cls for cls in product_classes
878-
if cls.is_build_script_impl_product()]
894+
(impl_product_classes, product_classes) = self.compute_product_classes()
879895

880896
# Execute each "pass".
881897

0 commit comments

Comments
 (0)