@@ -206,6 +206,10 @@ def build(args):
206206 build_dir = build_dir ,
207207 foundation_build_dir = foundation_build_dir ))
208208
209+ # Build the static library
210+ run ("ar rcs {build_dir}/libXCTest.a {build_dir}/XCTest.o" .format (
211+ build_dir = build_dir ))
212+
209213 if args .test :
210214 # Execute main() using the arguments necessary to run the tests.
211215 main (args = ["test" ,
@@ -217,9 +221,13 @@ def build(args):
217221 # we also install the built XCTest products.
218222 if args .module_path is not None and args .lib_path is not None :
219223 # Execute main() using the arguments necessary for installation.
220- main ( args = ["install" , build_dir ,
224+ install_args = ["install" , build_dir ,
221225 "--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 )
223231
224232 note ('Done.' )
225233
@@ -307,6 +315,14 @@ def install(args):
307315 os .path .join (build_dir , xctest_swiftdoc ),
308316 os .path .join (module_install_path , xctest_swiftdoc )))
309317
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+
310326 @staticmethod
311327 def core_foundation_build_dir (foundation_build_dir , foundation_install_prefix ):
312328 """
@@ -352,6 +368,7 @@ def main(args=sys.argv[1:]):
352368 --build-dir="/tmp/XCTest_build" \\
353369 --foundation-build-dir "/swift/usr/lib/swift/linux" \\
354370 --library-install-path="/swift/usr/lib/swift/linux" \\
371+ --static-library-install-path="/swift/usr/lib/swift_static/linux" \\
355372 --module-install-path="/swift/usr/lib/swift/linux/x86_64"
356373
357374 Note that installation is not supported on Darwin as this library
@@ -416,6 +433,11 @@ def main(args=sys.argv[1:]):
416433 help = "Location at which to install XCTest.so. This directory will be "
417434 "created if it doesn't already exist." ,
418435 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" )
419441 build_parser .add_argument (
420442 "--release" ,
421443 help = "builds for release" ,
@@ -508,6 +530,10 @@ def main(args=sys.argv[1:]):
508530 "-l" , "--library-install-path" ,
509531 help = "Location at which to install XCTest.so. This directory will be "
510532 "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." )
511537
512538 # Many versions of Python require a subcommand must be specified.
513539 # We handle this here: if no known subcommand (or none of the help options)
0 commit comments