Skip to content

Use build type parameter when building and testing using xcodebuild. #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions build_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,20 @@ def build(args):
swiftc = os.path.abspath(args.swiftc)
build_dir = os.path.abspath(args.build_dir)

if args.build_style == "debug":
style_options = "Debug"
else:
style_options = "Release"

run("xcodebuild -workspace {source_dir}/XCTest.xcworkspace "
"-scheme SwiftXCTest "
"-configuration {style_options} "
"SWIFT_EXEC=\"{swiftc}\" "
"SWIFT_LINK_OBJC_RUNTIME=YES "
"SYMROOT=\"{build_dir}\" OBJROOT=\"{build_dir}\"".format(
swiftc=swiftc,
build_dir=build_dir,
style_options=style_options,
source_dir=SOURCE_DIR))

if args.test:
Expand All @@ -92,14 +99,21 @@ def test(args):
swiftc = os.path.abspath(args.swiftc)
build_dir = os.path.abspath(args.build_dir)

if args.build_style == "debug":
style_options = "Debug"
else:
style_options = "Release"

run("xcodebuild -workspace {source_dir}/XCTest.xcworkspace "
"-scheme SwiftXCTestFunctionalTests "
"-configuration {style_options} "
"SWIFT_EXEC=\"{swiftc}\" "
"SWIFT_LINK_OBJC_RUNTIME=YES "
"SYMROOT=\"{build_dir}\" OBJROOT=\"{build_dir}\" "
"| grep -v \" export\"".format(
swiftc=swiftc,
build_dir=build_dir,
style_options=style_options,
source_dir=SOURCE_DIR))

@staticmethod
Expand Down Expand Up @@ -443,6 +457,20 @@ def main(args=sys.argv[1:]):
"--libdispatch-src-dir",
help="Path to swift-corelibs-libdispatch source tree, which "
"the built XCTest.so will be linked against.")
test_parser.add_argument(
"--release",
help="builds the tests for release",
action="store_const",
dest="build_style",
const="release",
default="debug")
test_parser.add_argument(
"--debug",
help="builds the tests for debug (the default)",
action="store_const",
dest="build_style",
const="debug",
default="debug")

install_parser = subparsers.add_parser(
"install",
Expand Down