@@ -244,7 +244,7 @@ class Target(object):
244
244
if args .xctest_path :
245
245
import_paths .append (args .xctest_path )
246
246
print (" import-paths: %s" % json .dumps (import_paths ), file = output )
247
- print (" other-args: %s" % json .dumps (' ' . join ( other_args ) ),
247
+ print (" other-args: %s" % json .dumps (other_args ),
248
248
file = output )
249
249
print (" temps-path: %s" % json .dumps (target_build_dir ), file = output )
250
250
print (" is-library: %s" % json .dumps (
@@ -459,13 +459,15 @@ def create_bootstrap_files(sandbox_path, args):
459
459
link_input_nodes , predecessor_node )
460
460
461
461
462
+ # llbuild tool to use for this command.
463
+ tool = "shell"
464
+
462
465
# Form the command line to link.
463
466
linked_libraries = []
464
467
if target .is_swift and target .is_library :
468
+ tool = "archive"
465
469
link_output_path = os .path .join (lib_dir , "%s.a" % (target .name ,))
466
- link_command = ['rm' , '-f' , pipes .quote (link_output_path ), ';' ,
467
- 'ar' , 'cr' , pipes .quote (link_output_path )]
468
- link_command .append (' ' .join (pipes .quote (o ) for o in objects ))
470
+ link_command = [] # Archive tool auto infers objects from inputs.
469
471
elif target .is_c and target .is_library :
470
472
# We have to use shared library for interpolation between Swift and C so we can't use static library for C Targets.
471
473
link_output_path = os .path .join (lib_dir , target .name + g_shared_lib_ext )
@@ -497,25 +499,25 @@ def create_bootstrap_files(sandbox_path, args):
497
499
link_command .extend (["-Xlinker" , "-l%s" % (lib ,)])
498
500
if platform .system () == 'Linux' :
499
501
link_command .extend (
500
- ["-Xlinker" , "-rpath=\\ $ORIGIN/../lib/swift/linux" ])
502
+ ["-Xlinker" , "-rpath=$ORIGIN/../lib/swift/linux" ])
501
503
if args .foundation_path :
502
504
link_command .extend (["-L" , args .foundation_path ])
503
505
if args .libdispatch_build_dir :
504
506
link_command .extend (["-L" , os .path .join (args .libdispatch_build_dir , "src" , ".libs" )])
505
507
506
508
# Write out the link command.
507
- print (" %s:" % json .dumps (target .linked_virtual_node ), file = output )
508
- print (" tool: shell" , file = output )
509
509
if target .is_library :
510
- print ( " description: Link %s" % target .name , file = output )
510
+ description = " Link %s" % target .name
511
511
else :
512
- print (" description: Link %s" % link_output_path , file = output )
513
- print (" inputs: %s" % json .dumps (
514
- link_input_nodes + objects + linked_libraries ), file = output )
515
- print (" outputs: %s" % json .dumps (
516
- [target .linked_virtual_node , link_output_path ]), file = output )
517
- print (" args: %s" % ' ' .join (link_command ), file = output )
518
- print (file = output )
512
+ description = "Link %s" % link_output_path
513
+ writeTool (
514
+ tool ,
515
+ target .linked_virtual_node ,
516
+ description ,
517
+ link_input_nodes + objects + linked_libraries ,
518
+ [target .linked_virtual_node , link_output_path ],
519
+ link_command ,
520
+ output )
519
521
520
522
# Write the top-level target group command.
521
523
print (" %s:" % json .dumps (target .virtual_node ), file = output )
@@ -537,6 +539,18 @@ def create_bootstrap_files(sandbox_path, args):
537
539
write_bootstrap_version_info (inc_dir , args .vendor_name ,
538
540
args .build_identifier )
539
541
542
+ # Write out the tool into output buffer.
543
+ # Supported tools: shell and archive. args is ignored for archive tool.
544
+ def writeTool (tool , node , description , inputs , outputs , args , output ):
545
+ print (" %s:" % json .dumps (node ), file = output )
546
+ print (" tool: %s" % tool , file = output )
547
+ print (" description: %s" % description , file = output )
548
+ print (" inputs: %s" % json .dumps (inputs ), file = output )
549
+ print (" outputs: %s" % json .dumps (outputs ), file = output )
550
+ if tool == "shell" :
551
+ print (" args: %s" % json .dumps (args ), file = output )
552
+ print (file = output )
553
+
540
554
541
555
def process_runtime_libraries (build_path , args , bootstrap = False ):
542
556
if bootstrap :
0 commit comments