@@ -451,7 +451,13 @@ class BuildScriptInvocation(object):
451
451
]
452
452
453
453
# 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 ()), []):
455
461
if not product_class .is_build_script_impl_product ():
456
462
continue
457
463
@@ -793,33 +799,41 @@ class BuildScriptInvocation(object):
793
799
return options
794
800
795
801
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.
797
808
798
- Compute the list of all Product classes used in this build. This list
799
- is constructed in dependency order.
800
809
"""
801
810
802
811
# FIXME: This is a weird division (returning a list of class objects),
803
812
# 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 )
808
816
if self .args .build_libcxx :
809
- product_classes .append (products .LibCXX )
817
+ impl_product_classes .append (products .LibCXX )
810
818
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 )
813
821
if self .args .build_lldb :
814
- product_classes .append (products .LLDB )
822
+ impl_product_classes .append (products .LLDB )
815
823
if self .args .build_libdispatch :
816
- product_classes .append (products .LibDispatch )
824
+ impl_product_classes .append (products .LibDispatch )
817
825
if self .args .build_foundation :
818
- product_classes .append (products .Foundation )
826
+ impl_product_classes .append (products .Foundation )
819
827
if self .args .build_xctest :
820
- product_classes .append (products .XCTest )
828
+ impl_product_classes .append (products .XCTest )
821
829
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 = []
823
837
if self .args .build_swiftpm :
824
838
product_classes .append (products .SwiftPM )
825
839
if self .args .build_swiftsyntax :
@@ -844,7 +858,12 @@ class BuildScriptInvocation(object):
844
858
product_classes .append (products .SwiftInspect )
845
859
if self .args .tsan_libdispatch_test :
846
860
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 )
848
867
849
868
def execute (self ):
850
869
"""Execute the invocation with the configured arguments."""
@@ -872,10 +891,7 @@ class BuildScriptInvocation(object):
872
891
#
873
892
# FIXME: This should really be per-host, but the current structure
874
893
# 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 ()
879
895
880
896
# Execute each "pass".
881
897
0 commit comments