31
31
import ProductPipelineListBuilder
32
32
from swift_build_support .swift_build_support .targets \
33
33
import StdlibDeploymentTarget
34
+ from swift_build_support .swift_build_support .utils import clear_log_time
34
35
from swift_build_support .swift_build_support .utils \
35
36
import exit_rejecting_arguments
36
37
from swift_build_support .swift_build_support .utils import fatal_error
38
+ from swift_build_support .swift_build_support .utils import log_time_in_scope
37
39
38
40
39
41
class BuildScriptInvocation (object ):
@@ -50,6 +52,8 @@ def __init__(self, toolchain, args):
50
52
51
53
self .build_libparser_only = args .build_libparser_only
52
54
55
+ clear_log_time ()
56
+
53
57
@property
54
58
def install_all (self ):
55
59
return self .args .install_all or self .args .infer_dependencies
@@ -790,10 +794,11 @@ def _execute_merged_host_lipo_core_action(self):
790
794
self ._execute_action ("merged-hosts-lipo-core" )
791
795
792
796
def _execute_action (self , action_name ):
793
- shell .call_without_sleeping (
794
- [BUILD_SCRIPT_IMPL_PATH ] + self .impl_args +
795
- ["--only-execute" , action_name ],
796
- env = self .impl_env , echo = self .args .verbose_build )
797
+ with log_time_in_scope (action_name ):
798
+ shell .call_without_sleeping (
799
+ [BUILD_SCRIPT_IMPL_PATH ] + self .impl_args +
800
+ ["--only-execute" , action_name ],
801
+ env = self .impl_env , echo = self .args .verbose_build )
797
802
798
803
def execute_product_build_steps (self , product_class , host_target ):
799
804
product_source = product_class .product_source_name ()
@@ -810,14 +815,20 @@ def execute_product_build_steps(self, product_class, host_target):
810
815
source_dir = self .workspace .source_dir (product_source ),
811
816
build_dir = build_dir )
812
817
if product .should_clean (host_target ):
813
- print ("--- Cleaning %s ---" % product_name )
814
- product .clean (host_target )
818
+ log_message = "Cleaning %s" % product_name
819
+ print ("--- {} ---" .format (log_message ))
820
+ with log_time_in_scope (log_message ):
821
+ product .clean (host_target )
815
822
if product .should_build (host_target ):
816
- print ("--- Building %s ---" % product_name )
817
- product .build (host_target )
823
+ log_message = "Building %s" % product_name
824
+ print ("--- {} ---" .format (log_message ))
825
+ with log_time_in_scope (log_message ):
826
+ product .build (host_target )
818
827
if product .should_test (host_target ):
819
- print ("--- Running tests for %s ---" % product_name )
820
- product .test (host_target )
828
+ log_message = "Running tests for %s" % product_name
829
+ print ("--- {} ---" .format (log_message ))
830
+ with log_time_in_scope (log_message ):
831
+ product .test (host_target )
821
832
print ("--- Finished tests for %s ---" % product_name )
822
833
# Install the product if it should be installed specifically, or
823
834
# if it should be built and `install_all` is set to True.
@@ -827,5 +838,7 @@ def execute_product_build_steps(self, product_class, host_target):
827
838
if product .should_install (host_target ) or \
828
839
(self .install_all and product .should_build (host_target ) and
829
840
not product .is_ignore_install_all_product ()):
830
- print ("--- Installing %s ---" % product_name )
831
- product .install (host_target )
841
+ log_message = "Installing %s" % product_name
842
+ print ("--- {} ---" .format (log_message ))
843
+ with log_time_in_scope (log_message ):
844
+ product .install (host_target )
0 commit comments