Skip to content

Commit a21a854

Browse files
authored
Merge pull request #128 from jamala/propagate_build_type
Use build type parameter when building and testing using xcodebuild.
2 parents 03905f5 + c816b20 commit a21a854

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

build_script.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,20 @@ def build(args):
6868
swiftc = os.path.abspath(args.swiftc)
6969
build_dir = os.path.abspath(args.build_dir)
7070

71+
if args.build_style == "debug":
72+
style_options = "Debug"
73+
else:
74+
style_options = "Release"
75+
7176
run("xcodebuild -workspace {source_dir}/XCTest.xcworkspace "
7277
"-scheme SwiftXCTest "
78+
"-configuration {style_options} "
7379
"SWIFT_EXEC=\"{swiftc}\" "
7480
"SWIFT_LINK_OBJC_RUNTIME=YES "
7581
"SYMROOT=\"{build_dir}\" OBJROOT=\"{build_dir}\"".format(
7682
swiftc=swiftc,
7783
build_dir=build_dir,
84+
style_options=style_options,
7885
source_dir=SOURCE_DIR))
7986

8087
if args.test:
@@ -92,14 +99,21 @@ def test(args):
9299
swiftc = os.path.abspath(args.swiftc)
93100
build_dir = os.path.abspath(args.build_dir)
94101

102+
if args.build_style == "debug":
103+
style_options = "Debug"
104+
else:
105+
style_options = "Release"
106+
95107
run("xcodebuild -workspace {source_dir}/XCTest.xcworkspace "
96108
"-scheme SwiftXCTestFunctionalTests "
109+
"-configuration {style_options} "
97110
"SWIFT_EXEC=\"{swiftc}\" "
98111
"SWIFT_LINK_OBJC_RUNTIME=YES "
99112
"SYMROOT=\"{build_dir}\" OBJROOT=\"{build_dir}\" "
100113
"| grep -v \" export\"".format(
101114
swiftc=swiftc,
102115
build_dir=build_dir,
116+
style_options=style_options,
103117
source_dir=SOURCE_DIR))
104118

105119
@staticmethod
@@ -443,6 +457,20 @@ def main(args=sys.argv[1:]):
443457
"--libdispatch-src-dir",
444458
help="Path to swift-corelibs-libdispatch source tree, which "
445459
"the built XCTest.so will be linked against.")
460+
test_parser.add_argument(
461+
"--release",
462+
help="builds the tests for release",
463+
action="store_const",
464+
dest="build_style",
465+
const="release",
466+
default="debug")
467+
test_parser.add_argument(
468+
"--debug",
469+
help="builds the tests for debug (the default)",
470+
action="store_const",
471+
dest="build_style",
472+
const="debug",
473+
default="debug")
446474

447475
install_parser = subparsers.add_parser(
448476
"install",

0 commit comments

Comments
 (0)