@@ -371,6 +371,7 @@ def main(argv):
371371
372372 if platforms :
373373 _collect_integration_tests (config , testapps , root_output_dir , output_dir , FLAGS .artifact_name )
374+ _collect_build_logs (root_output_dir , output_dir , FLAGS .artifact_name )
374375 build_passes = _summarize_build_results (
375376 testapps = testapps ,
376377 platforms = platforms ,
@@ -471,14 +472,9 @@ def build_testapp(dir_helper, api_config, ios_config, target):
471472 shutil .copy (
472473 os .path .join (dir_helper .root_dir , api_config .entitlements ),
473474 os .path .join (dir_helper .unity_project_editor_dir , "dev.entitlements" ))
474- try :
475- # This is a patch. Unity 2018 retrun non 0 value, but it build successfully
476- _run (arg_builder .get_args_to_open_project (build_flags ))
477- logging .info ("Finished building target %s xcode project" , target )
478- except (subprocess .SubprocessError , RuntimeError ) as e :
479- logging .info (str (e ))
480- finally :
481- run_xcodebuild (dir_helper = dir_helper , ios_config = ios_config , device_type = device_type )
475+ _run (arg_builder .get_args_to_open_project (build_flags ))
476+ logging .info ("Finished building target %s xcode project" , target )
477+ run_xcodebuild (dir_helper = dir_helper , ios_config = ios_config , device_type = device_type )
482478 else :
483479 if api_config .minify :
484480 build_flags += ["-AppBuilderHelper.minify" , api_config .minify ]
@@ -637,6 +633,31 @@ def run_xcodebuild(dir_helper, ios_config, device_type):
637633 configuration = ios_config .configuration )
638634
639635
636+ def _collect_build_logs (root_output_dir , output_dir , artifact_name ):
637+ log_extension = ".build.log"
638+ log_paths = []
639+ for file_dir , _ , file_names in os .walk (output_dir ):
640+ for file_name in file_names :
641+ if file_name .endswith (log_extension ):
642+ log_paths .append (os .path .join (file_dir , file_name ))
643+ logging .info (root_output_dir )
644+ logging .info (output_dir )
645+ logging .info ("Collecting build log artifacts from: %s" , log_paths )
646+
647+ if not log_paths :
648+ return
649+
650+ artifact_path = os .path .join (root_output_dir , "testapps-" + artifact_name , "build-logs" )
651+ logging .info ("Collecting build log artifacts to: %s" , artifact_path )
652+ for path in log_paths :
653+ file_name = os .path .basename (path )
654+ testapp_name = os .path .basename (os .path .dirname (path ))
655+ log_output_dir = os .path .join (artifact_path , testapp_name )
656+ if not os .path .exists (log_output_dir ):
657+ os .makedirs (log_output_dir )
658+ shutil .move (path , os .path .join (log_output_dir , file_name ))
659+
660+
640661def _collect_integration_tests (config , testapps , root_output_dir , output_dir , artifact_name ):
641662 """Collect testapps to dir /${output_dir}/testapps-${artifact_name}/${platform}/${api}.
642663 In CI, testapps will be upload as Artifacts.
@@ -1037,7 +1058,7 @@ def _fix_path(path):
10371058 return os .path .abspath (os .path .expanduser (path ))
10381059
10391060
1040- def _run (args , timeout = 3000 , capture_output = False , text = None , check = True ):
1061+ def _run (args , timeout = 1200 , capture_output = False , text = None , check = True ):
10411062 """Executes a command in a subprocess."""
10421063 logging .info ("Running in subprocess: %s" , " " .join (args ))
10431064 return subprocess .run (
@@ -1190,7 +1211,7 @@ def make_log_path(self, name):
11901211 (str) Absolute path.
11911212
11921213 """
1193- return os .path .join (self .output_dir , name + ".log" )
1214+ return os .path .join (self .output_dir , name + ".build. log" )
11941215
11951216
11961217if __name__ == "__main__" :
0 commit comments