Skip to content

Commit

Permalink
Add --skip-clean flag
Browse files Browse the repository at this point in the history
  • Loading branch information
lplarson committed Apr 25, 2017
1 parent 99d7100 commit 1e3d2ac
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 2 additions & 1 deletion builder.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.skip_clean
),
),
index
Expand Down
6 changes: 5 additions & 1 deletion common.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ def git_clone(url, path, tree=None, recursive=True,
returncodes.append(check_execute(command, stdout=stdout, stderr=stderr))
if tree:
returncodes.append(git_checkout(tree, path,
force=True,
stdout=stdout, stderr=stderr))
if recursive:
returncodes.append(git_submodule_update(path,
Expand All @@ -359,10 +360,12 @@ def git_sha(path, stdout=sys.stdout, stderr=sys.stderr):


def git_update(url, configured_sha, path,
incremental=False,
stdout=sys.stdout, stderr=sys.stderr):
"""Update a repository to a given sha if necessary."""
returncodes = []
git_clean(path, stdout=stdout, stderr=stderr)
if not incremental:
git_clean(path, stdout=stdout, stderr=stderr)
current_sha = git_sha(path, stdout=stdout, stderr=stderr)
debug_print('current_sha: ' + current_sha, stderr=stderr)
debug_print('configured_sha: ' + configured_sha, stderr=stderr)
Expand All @@ -373,6 +376,7 @@ def git_update(url, configured_sha, path,
stdout=stdout, stderr=stderr))
try:
returncodes.append(git_checkout(configured_sha, path,
force=True,
stdout=stdout, stderr=stderr))
returncodes.append(git_submodule_update(
path, stdout=stdout, stderr=stderr
Expand Down
13 changes: 12 additions & 1 deletion project.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ def add_arguments(parser):
metavar="FLAGS",
help='add flags to each Swift invocation',
default='')
parser.add_argument("--skip-clean",
help='skip all git and build clean steps before '
'building projects',
action='store_true')


def add_minimal_arguments(parser):
Expand Down Expand Up @@ -740,6 +744,7 @@ def __init__(self, swiftc, swift_version, swift_branch,
sandbox_profile_xcodebuild,
sandbox_profile_package,
added_swift_flags,
skip_clean,
project, action):
self.swiftc = swiftc
self.swift_version = swift_version
Expand All @@ -752,6 +757,7 @@ def __init__(self, swiftc, swift_version, swift_branch,
self.root_path = common.private_workspace('project_cache')
self.current_platform = platform.system()
self.added_swift_flags = added_swift_flags
self.skip_clean = skip_clean
self.init()

def init(self):
Expand Down Expand Up @@ -781,10 +787,13 @@ def checkout(self, ref, ref_is_sha, pull_after_update,
if os.path.exists(path):
if ref_is_sha:
common.git_update(self.project['url'], ref, path,
incremental=self.skip_clean,
stdout=stdout, stderr=stderr)
else:
common.git_clean(path, stdout=stdout, stderr=stderr)
if not self.skip_clean:
common.git_clean(path, stdout=stdout, stderr=stderr)
common.git_checkout(ref, path,
force=True,
stdout=stdout, stderr=stderr)
if pull_after_update:
common.git_pull(path, stdout=stdout, stderr=stderr)
Expand All @@ -803,6 +812,7 @@ def dispatch(self, identifier, stdout=sys.stdout, stderr=sys.stderr):
self.sandbox_profile_xcodebuild,
self.sandbox_profile_package,
self.added_swift_flags,
incremental=self.skip_clean,
stdout=stdout, stderr=stderr)
except common.ExecuteCommandFailure as error:
return self.failed(identifier, error)
Expand Down Expand Up @@ -840,6 +850,7 @@ def dispatch(self, identifier, stdout=sys.stdout, stderr=sys.stderr):
self.sandbox_profile_xcodebuild,
self.sandbox_profile_package,
self.added_swift_flags,
incremental=self.skip_clean,
should_strip_resource_phases=True,
stdout=stdout, stderr=stderr)
except common.ExecuteCommandFailure as error:
Expand Down
1 change: 1 addition & 0 deletions runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def main():
args.sandbox_profile_xcodebuild,
args.sandbox_profile_package,
args.add_swift_flags,
args.skip_clean
),
),
index
Expand Down

0 comments on commit 1e3d2ac

Please sign in to comment.