@@ -534,6 +534,8 @@ def main():
534
534
help = "Path to Foundation build directory" )
535
535
parser .add_argument ("--xctest" , dest = "xctest_path" ,
536
536
help = "Path to XCTest build directory" )
537
+ parser .add_argument ("--release" , action = "store_true" ,
538
+ help = "Build stage 2 for release" )
537
539
args = parser .parse_args ()
538
540
539
541
if not args .swiftc_path :
@@ -638,6 +640,9 @@ def main():
638
640
cmd .extend (["-Xswiftc" , "-I{}" .format (args .foundation_path )])
639
641
cmd .extend (["-Xswiftc" , "-I{}" .format (core_foundation_path )])
640
642
643
+ if args .release :
644
+ cmd .extend (["--configuration" , "release" ])
645
+
641
646
cmd = env_cmd + cmd
642
647
643
648
note ("building self-hosted 'swift-build': %s" % (
@@ -646,16 +651,20 @@ def main():
646
651
if result != 0 :
647
652
error ("build failed with exit status %d" % (result ,))
648
653
649
- swift_build_path = os .path .join (build_path , "debug" , "swift-build" )
650
- swift_test_path = os .path .join (build_path , "debug" , "swift-test" )
651
- note ("built: %s" % (swift_build_path ,))
654
+ if args .release :
655
+ conf = "release"
656
+ else :
657
+ conf = "debug"
658
+
659
+ swift_build_path = os .path .join (build_path , conf , "swift-build" )
660
+ swift_test_path = os .path .join (build_path , conf , "swift-test" )
652
661
653
662
# If testing, run each of the test bundles.
654
663
if "test" in build_actions :
655
664
# Construct the test environment.
656
665
env_cmd = ["env" , "SWIFT_EXEC=" + os .path .join (bindir , "swiftc" ),
657
666
"SWIFT_BUILD_PATH=" + build_path ]
658
- cmd = env_cmd + [os . path . join ( build_path , "debug" , "swift-test" ) ]
667
+ cmd = env_cmd + [swift_test_path ]
659
668
result = subprocess .call (cmd , cwd = g_project_root )
660
669
if result != 0 :
661
670
error ("tests failed with exit status %d" % (result ,))
0 commit comments