@@ -144,6 +144,17 @@ def set_configuration(self, configuration):
144
144
# Build single-architecture binaries. It is almost 2 times faster is 32-bit support is not required.
145
145
'--ios_multi_cpus=arm64' ,
146
146
147
+ # Always build universal Watch binaries.
148
+ '--watchos_cpus=armv7k,arm64_32'
149
+ ] + self .common_debug_args
150
+ elif configuration == 'debug_sim_arm64' :
151
+ self .configuration_args = [
152
+ # bazel debug build configuration
153
+ '-c' , 'dbg' ,
154
+
155
+ # Build single-architecture binaries. It is almost 2 times faster is 32-bit support is not required.
156
+ '--ios_multi_cpus=sim_arm64' ,
157
+
147
158
# Always build universal Watch binaries.
148
159
'--watchos_cpus=armv7k,arm64_32'
149
160
] + self .common_debug_args
@@ -317,6 +328,47 @@ def invoke_build(self):
317
328
call_executable (combined_arguments )
318
329
319
330
331
+ def invoke_test (self ):
332
+ combined_arguments = [
333
+ self .build_environment .bazel_path
334
+ ]
335
+ combined_arguments += self .get_startup_bazel_arguments ()
336
+ combined_arguments += ['test' ]
337
+
338
+ combined_arguments += ['--cache_test_results=no' ]
339
+ combined_arguments += ['--test_output=errors' ]
340
+
341
+ combined_arguments += ['Tests/AllTests' ]
342
+
343
+ if self .configuration_path is None :
344
+ raise Exception ('configuration_path is not defined' )
345
+
346
+ combined_arguments += [
347
+ '--override_repository=build_configuration={}' .format (self .configuration_path )
348
+ ]
349
+
350
+ combined_arguments += self .common_args
351
+ combined_arguments += self .common_build_args
352
+ combined_arguments += self .get_define_arguments ()
353
+ combined_arguments += self .get_additional_build_arguments ()
354
+
355
+ if self .remote_cache is not None :
356
+ combined_arguments += [
357
+ '--remote_cache={}' .format (self .remote_cache ),
358
+ '--experimental_remote_downloader={}' .format (self .remote_cache )
359
+ ]
360
+ elif self .cache_dir is not None :
361
+ combined_arguments += [
362
+ '--disk_cache={path}' .format (path = self .cache_dir )
363
+ ]
364
+
365
+ combined_arguments += self .configuration_args
366
+
367
+ print ('TelegramBuild: running' )
368
+ print (subprocess .list2cmdline (combined_arguments ))
369
+ call_executable (combined_arguments )
370
+
371
+
320
372
def clean (bazel , arguments ):
321
373
bazel_command_line = BazelCommandLine (
322
374
bazel = bazel ,
@@ -430,6 +482,27 @@ def build(bazel, arguments):
430
482
bazel_command_line .invoke_build ()
431
483
432
484
485
+ def test (bazel , arguments ):
486
+ bazel_command_line = BazelCommandLine (
487
+ bazel = bazel ,
488
+ override_bazel_version = arguments .overrideBazelVersion ,
489
+ override_xcode_version = arguments .overrideXcodeVersion ,
490
+ bazel_user_root = arguments .bazelUserRoot
491
+ )
492
+
493
+ if arguments .cacheDir is not None :
494
+ bazel_command_line .add_cache_dir (arguments .cacheDir )
495
+ elif arguments .cacheHost is not None :
496
+ bazel_command_line .add_remote_cache (arguments .cacheHost )
497
+
498
+ resolve_configuration (bazel_command_line , arguments )
499
+
500
+ bazel_command_line .set_configuration ('debug_sim_arm64' )
501
+ bazel_command_line .set_build_number ('10000' )
502
+
503
+ bazel_command_line .invoke_test ()
504
+
505
+
433
506
def add_project_and_build_common_arguments (current_parser : argparse .ArgumentParser ):
434
507
group = current_parser .add_mutually_exclusive_group (required = True )
435
508
group .add_argument (
@@ -520,6 +593,13 @@ def add_project_and_build_common_arguments(current_parser: argparse.ArgumentPars
520
593
'''
521
594
)
522
595
596
+ testParser = subparsers .add_parser (
597
+ 'test' , help = '''
598
+ Run all tests.
599
+ '''
600
+ )
601
+ add_project_and_build_common_arguments (testParser )
602
+
523
603
generateProjectParser = subparsers .add_parser ('generateProject' , help = 'Generate Xcode project' )
524
604
generateProjectParser .add_argument (
525
605
'--buildNumber' ,
@@ -646,6 +726,8 @@ def add_project_and_build_common_arguments(current_parser: argparse.ArgumentPars
646
726
generate_project (bazel = bazel_path , arguments = args )
647
727
elif args .commandName == 'build' :
648
728
build (bazel = bazel_path , arguments = args )
729
+ elif args .commandName == 'test' :
730
+ test (bazel = bazel_path , arguments = args )
649
731
else :
650
732
raise Exception ('Unknown command' )
651
733
except KeyboardInterrupt :
0 commit comments