Skip to content

Commit

Permalink
Add option to control stripping resources
Browse files Browse the repository at this point in the history
  • Loading branch information
lplarson committed Oct 14, 2017
1 parent c720ce7 commit 5b7483a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
3 changes: 2 additions & 1 deletion build_incremental.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.build_config
args.build_config,
args.strip_resource_phases
),
),
index
Expand Down
3 changes: 2 additions & 1 deletion builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def main():
args.sandbox_profile_package,
args.add_swift_flags,
args.skip_clean,
args.build_config
args.build_config,
args.strip_resource_phases
),
),
index
Expand Down
26 changes: 25 additions & 1 deletion project.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import sys
import json
import time
import argparse

import common

Expand Down Expand Up @@ -371,8 +372,19 @@ def is_xfailed(xfail_args, compatible_version, platform, swift_branch):
return None


def str2bool(s):
"""Convert an argument string into a boolean."""
if s.lower() == 'true':
return True
elif s.lower() == 'false':
return False
else:
raise argparse.ArgumentTypeError('true/false boolean value expected.')


def add_arguments(parser):
"""Add common arguments to parser."""
parser.register('type', 'bool', str2bool)
parser.add_argument('--verbose',
action='store_true')
# TODO: remove Linux sandbox hack
Expand Down Expand Up @@ -456,6 +468,14 @@ def add_arguments(parser):
dest='build_config',
help='specify "debug" or "release" to override '
'the build configuration in the projects.json file')
parser.add_argument("--strip-resource-phases",
help='strip all resource phases from project file '
'before building (default: true)',
metavar='BOOL',
type='bool',
nargs='?',
const=True,
default=True)

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

def init(self):
Expand Down Expand Up @@ -875,7 +897,7 @@ def dispatch(self, identifier, stdout=sys.stdout, stderr=sys.stderr):
self.added_swift_flags,
self.build_config,
incremental=self.skip_clean,
should_strip_resource_phases=True,
should_strip_resource_phases=self.strip_resource_phases,
stdout=stdout, stderr=stderr)
except common.ExecuteCommandFailure as error:
return self.failed(identifier, error)
Expand Down Expand Up @@ -1024,6 +1046,7 @@ def __init__(self, swiftc, swift_version, swift_branch,
sandbox_profile_xcodebuild,
sandbox_profile_package,
added_swift_flags, build_config,
strip_resource_phases,
project, action):
super(IncrementalActionBuilder,
self).__init__(swiftc, swift_version, swift_branch,
Expand All @@ -1032,6 +1055,7 @@ def __init__(self, swiftc, swift_version, swift_branch,
added_swift_flags,
skip_clean=True,
build_config=build_config,
strip_resource_phases=strip_resource_phases,
project=project,
action=action)
self.proj_path = os.path.join(self.root_path, self.project['path'])
Expand Down
3 changes: 2 additions & 1 deletion runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def main():
args.sandbox_profile_package,
args.add_swift_flags,
args.skip_clean,
args.build_config
args.build_config,
args.strip_resource_phases
),
),
index
Expand Down

0 comments on commit 5b7483a

Please sign in to comment.