@@ -371,6 +371,7 @@ def main(argv):
371
371
372
372
if platforms :
373
373
_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 )
374
375
build_passes = _summarize_build_results (
375
376
testapps = testapps ,
376
377
platforms = platforms ,
@@ -471,14 +472,9 @@ def build_testapp(dir_helper, api_config, ios_config, target):
471
472
shutil .copy (
472
473
os .path .join (dir_helper .root_dir , api_config .entitlements ),
473
474
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 )
482
478
else :
483
479
if api_config .minify :
484
480
build_flags += ["-AppBuilderHelper.minify" , api_config .minify ]
@@ -637,6 +633,31 @@ def run_xcodebuild(dir_helper, ios_config, device_type):
637
633
configuration = ios_config .configuration )
638
634
639
635
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
+
640
661
def _collect_integration_tests (config , testapps , root_output_dir , output_dir , artifact_name ):
641
662
"""Collect testapps to dir /${output_dir}/testapps-${artifact_name}/${platform}/${api}.
642
663
In CI, testapps will be upload as Artifacts.
@@ -1037,7 +1058,7 @@ def _fix_path(path):
1037
1058
return os .path .abspath (os .path .expanduser (path ))
1038
1059
1039
1060
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 ):
1041
1062
"""Executes a command in a subprocess."""
1042
1063
logging .info ("Running in subprocess: %s" , " " .join (args ))
1043
1064
return subprocess .run (
@@ -1190,7 +1211,7 @@ def make_log_path(self, name):
1190
1211
(str) Absolute path.
1191
1212
1192
1213
"""
1193
- return os .path .join (self .output_dir , name + ".log" )
1214
+ return os .path .join (self .output_dir , name + ".build. log" )
1194
1215
1195
1216
1196
1217
if __name__ == "__main__" :
0 commit comments