Skip to content

Commit

Permalink
Adding the --build-config option which adds the ability to build with…
Browse files Browse the repository at this point in the history
… a debug or release build configuration.
  • Loading branch information
Ewa Matejska committed Jul 4, 2017
1 parent ffa194f commit 1f9331a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
3 changes: 2 additions & 1 deletion build_incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def main():
args.swift_branch,
args.sandbox_profile_xcodebuild,
args.sandbox_profile_package,
args.add_swift_flags
args.add_swift_flags,
args.build_config
),
),
index
Expand Down
3 changes: 2 additions & 1 deletion builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def main():
args.sandbox_profile_xcodebuild,
args.sandbox_profile_package,
args.add_swift_flags,
args.skip_clean
args.skip_clean,
args.build_config
),
),
index
Expand Down
31 changes: 24 additions & 7 deletions project.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,17 @@ def strip_resource_phases(repo_path, stdout=sys.stdout, stderr=sys.stderr):

def dispatch(root_path, repo, action, swiftc, swift_version,
sandbox_profile_xcodebuild, sandbox_profile_package,
added_swift_flags, should_strip_resource_phases=False,
added_swift_flags, build_config, should_strip_resource_phases=False,
stdout=sys.stdout, stderr=sys.stderr,
incremental=False):
"""Call functions corresponding to actions."""

if action['action'] == 'BuildSwiftPackage':
if build_config == '':
build_config = action['configuration']
return build_swift_package(os.path.join(root_path, repo['path']),
swiftc,
action['configuration'],
build_config,
sandbox_profile_package,
stdout=stdout, stderr=stderr,
added_swift_flags=added_swift_flags,
Expand All @@ -308,7 +310,11 @@ def dispatch(root_path, repo, action, swiftc, swift_version,
'SWIFT_EXEC': swiftc
}

if 'configuration' in action:
if build_config == 'debug':
build_settings['CONFIGURATION'] = 'Debug'
elif build_config == 'release':
build_settings['CONFIGURATION'] = 'Release'
elif 'configuration' in action:
build_settings['CONFIGURATION'] = action['configuration']

other_swift_flags = []
Expand Down Expand Up @@ -443,8 +449,14 @@ def add_arguments(parser):
parser.add_argument("--skip-clean",
help='skip all git and build clean steps before '
'building projects',
action='store_true')

action='store_true'),
parser.add_argument("--build-config",
metavar="NAME",
choices=['debug', 'release'],
dest='build_config',
help='specify "debug" or "release" to override '
'the build configuration in the projects.json file',
default='')

def add_minimal_arguments(parser):
"""Add common arguments to parser."""
Expand Down Expand Up @@ -754,7 +766,7 @@ def __init__(self, swiftc, swift_version, swift_branch,
sandbox_profile_xcodebuild,
sandbox_profile_package,
added_swift_flags,
skip_clean,
skip_clean, build_config,
project, action):
self.swiftc = swiftc
self.swift_version = swift_version
Expand All @@ -768,6 +780,7 @@ def __init__(self, swiftc, swift_version, swift_branch,
self.current_platform = platform.system()
self.added_swift_flags = added_swift_flags
self.skip_clean = skip_clean
self.build_config = build_config
self.init()

def init(self):
Expand Down Expand Up @@ -822,6 +835,7 @@ def dispatch(self, identifier, stdout=sys.stdout, stderr=sys.stderr):
self.sandbox_profile_xcodebuild,
self.sandbox_profile_package,
self.added_swift_flags,
self.build_config,
incremental=self.skip_clean,
stdout=stdout, stderr=stderr)
except common.ExecuteCommandFailure as error:
Expand Down Expand Up @@ -860,6 +874,7 @@ def dispatch(self, identifier, stdout=sys.stdout, stderr=sys.stderr):
self.sandbox_profile_xcodebuild,
self.sandbox_profile_package,
self.added_swift_flags,
self.build_config,
incremental=self.skip_clean,
should_strip_resource_phases=True,
stdout=stdout, stderr=stderr)
Expand Down Expand Up @@ -1006,14 +1021,15 @@ class IncrementalActionBuilder(ActionBuilder):
def __init__(self, swiftc, swift_version, swift_branch,
sandbox_profile_xcodebuild,
sandbox_profile_package,
added_swift_flags,
added_swift_flags, build_config,
project, action):
super(IncrementalActionBuilder,
self).__init__(swiftc, swift_version, swift_branch,
sandbox_profile_xcodebuild,
sandbox_profile_package,
added_swift_flags,
skip_clean=True,
build_config=build_config,
project=project,
action=action)
self.proj_path = os.path.join(self.root_path, self.project['path'])
Expand Down Expand Up @@ -1116,6 +1132,7 @@ def dispatch(self, identifier, incremental, stdout=sys.stdout, stderr=sys.stderr
self.sandbox_profile_xcodebuild,
self.sandbox_profile_package,
self.added_swift_flags,
self.build_config,
should_strip_resource_phases=False,
stdout=stdout, stderr=stderr,
incremental=incremental)
Expand Down
3 changes: 2 additions & 1 deletion runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def main():
args.sandbox_profile_xcodebuild,
args.sandbox_profile_package,
args.add_swift_flags,
args.skip_clean
args.skip_clean,
args.build_config
),
),
index
Expand Down

0 comments on commit 1f9331a

Please sign in to comment.