@@ -206,6 +206,10 @@ def build(args):
206
206
build_dir = build_dir ,
207
207
foundation_build_dir = foundation_build_dir ))
208
208
209
+ # Build the static library
210
+ run ("ar rcs {build_dir}/libXCTest.a {build_dir}/XCTest.o" .format (
211
+ build_dir = build_dir ))
212
+
209
213
if args .test :
210
214
# Execute main() using the arguments necessary to run the tests.
211
215
main (args = ["test" ,
@@ -217,9 +221,13 @@ def build(args):
217
221
# we also install the built XCTest products.
218
222
if args .module_path is not None and args .lib_path is not None :
219
223
# Execute main() using the arguments necessary for installation.
220
- main ( args = ["install" , build_dir ,
224
+ install_args = ["install" , build_dir ,
221
225
"--module-install-path" , args .module_path ,
222
- "--library-install-path" , args .lib_path ])
226
+ "--library-install-path" , args .lib_path ]
227
+ if args .static_lib_path :
228
+ install_args += ["--static-library-install-path" ,
229
+ args .static_lib_path ]
230
+ main (args = install_args )
223
231
224
232
note ('Done.' )
225
233
@@ -307,6 +315,14 @@ def install(args):
307
315
os .path .join (build_dir , xctest_swiftdoc ),
308
316
os .path .join (module_install_path , xctest_swiftdoc )))
309
317
318
+ if args .static_library_install_path :
319
+ static_library_install_path = os .path .abspath (args .static_library_install_path )
320
+ _mkdirp (static_library_install_path )
321
+ xctest_a = "libXCTest.a"
322
+ run ("cp {} {}" .format (
323
+ os .path .join (build_dir , xctest_a ),
324
+ os .path .join (static_library_install_path , xctest_a )))
325
+
310
326
@staticmethod
311
327
def core_foundation_build_dir (foundation_build_dir , foundation_install_prefix ):
312
328
"""
@@ -352,6 +368,7 @@ def main(args=sys.argv[1:]):
352
368
--build-dir="/tmp/XCTest_build" \\
353
369
--foundation-build-dir "/swift/usr/lib/swift/linux" \\
354
370
--library-install-path="/swift/usr/lib/swift/linux" \\
371
+ --static-library-install-path="/swift/usr/lib/swift_static/linux" \\
355
372
--module-install-path="/swift/usr/lib/swift/linux/x86_64"
356
373
357
374
Note that installation is not supported on Darwin as this library
@@ -416,6 +433,11 @@ def main(args=sys.argv[1:]):
416
433
help = "Location at which to install XCTest.so. This directory will be "
417
434
"created if it doesn't already exist." ,
418
435
dest = "lib_path" )
436
+ build_parser .add_argument (
437
+ "--static-library-install-path" ,
438
+ help = "Location at which to install XCTest.a. This directory will be "
439
+ "created if it doesn't already exist." ,
440
+ dest = "static_lib_path" )
419
441
build_parser .add_argument (
420
442
"--release" ,
421
443
help = "builds for release" ,
@@ -508,6 +530,10 @@ def main(args=sys.argv[1:]):
508
530
"-l" , "--library-install-path" ,
509
531
help = "Location at which to install XCTest.so. This directory will be "
510
532
"created if it doesn't already exist." )
533
+ install_parser .add_argument (
534
+ "-s" , "--static-library-install-path" ,
535
+ help = "Location at which to install XCTest.a. This directory will be "
536
+ "created if it doesn't already exist." )
511
537
512
538
# Many versions of Python require a subcommand must be specified.
513
539
# We handle this here: if no known subcommand (or none of the help options)
0 commit comments