Skip to content

Commit 1e3d2ac

Browse files
committed
Add --skip-clean flag
1 parent 99d7100 commit 1e3d2ac

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

Diff for: builder.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def main():
4646
args.swift_branch,
4747
args.sandbox_profile_xcodebuild,
4848
args.sandbox_profile_package,
49-
args.add_swift_flags
49+
args.add_swift_flags,
50+
args.skip_clean
5051
),
5152
),
5253
index

Diff for: common.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ def git_clone(url, path, tree=None, recursive=True,
336336
returncodes.append(check_execute(command, stdout=stdout, stderr=stderr))
337337
if tree:
338338
returncodes.append(git_checkout(tree, path,
339+
force=True,
339340
stdout=stdout, stderr=stderr))
340341
if recursive:
341342
returncodes.append(git_submodule_update(path,
@@ -359,10 +360,12 @@ def git_sha(path, stdout=sys.stdout, stderr=sys.stderr):
359360

360361

361362
def git_update(url, configured_sha, path,
363+
incremental=False,
362364
stdout=sys.stdout, stderr=sys.stderr):
363365
"""Update a repository to a given sha if necessary."""
364366
returncodes = []
365-
git_clean(path, stdout=stdout, stderr=stderr)
367+
if not incremental:
368+
git_clean(path, stdout=stdout, stderr=stderr)
366369
current_sha = git_sha(path, stdout=stdout, stderr=stderr)
367370
debug_print('current_sha: ' + current_sha, stderr=stderr)
368371
debug_print('configured_sha: ' + configured_sha, stderr=stderr)
@@ -373,6 +376,7 @@ def git_update(url, configured_sha, path,
373376
stdout=stdout, stderr=stderr))
374377
try:
375378
returncodes.append(git_checkout(configured_sha, path,
379+
force=True,
376380
stdout=stdout, stderr=stderr))
377381
returncodes.append(git_submodule_update(
378382
path, stdout=stdout, stderr=stderr

Diff for: project.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ def add_arguments(parser):
439439
metavar="FLAGS",
440440
help='add flags to each Swift invocation',
441441
default='')
442+
parser.add_argument("--skip-clean",
443+
help='skip all git and build clean steps before '
444+
'building projects',
445+
action='store_true')
442446

443447

444448
def add_minimal_arguments(parser):
@@ -740,6 +744,7 @@ def __init__(self, swiftc, swift_version, swift_branch,
740744
sandbox_profile_xcodebuild,
741745
sandbox_profile_package,
742746
added_swift_flags,
747+
skip_clean,
743748
project, action):
744749
self.swiftc = swiftc
745750
self.swift_version = swift_version
@@ -752,6 +757,7 @@ def __init__(self, swiftc, swift_version, swift_branch,
752757
self.root_path = common.private_workspace('project_cache')
753758
self.current_platform = platform.system()
754759
self.added_swift_flags = added_swift_flags
760+
self.skip_clean = skip_clean
755761
self.init()
756762

757763
def init(self):
@@ -781,10 +787,13 @@ def checkout(self, ref, ref_is_sha, pull_after_update,
781787
if os.path.exists(path):
782788
if ref_is_sha:
783789
common.git_update(self.project['url'], ref, path,
790+
incremental=self.skip_clean,
784791
stdout=stdout, stderr=stderr)
785792
else:
786-
common.git_clean(path, stdout=stdout, stderr=stderr)
793+
if not self.skip_clean:
794+
common.git_clean(path, stdout=stdout, stderr=stderr)
787795
common.git_checkout(ref, path,
796+
force=True,
788797
stdout=stdout, stderr=stderr)
789798
if pull_after_update:
790799
common.git_pull(path, stdout=stdout, stderr=stderr)
@@ -803,6 +812,7 @@ def dispatch(self, identifier, stdout=sys.stdout, stderr=sys.stderr):
803812
self.sandbox_profile_xcodebuild,
804813
self.sandbox_profile_package,
805814
self.added_swift_flags,
815+
incremental=self.skip_clean,
806816
stdout=stdout, stderr=stderr)
807817
except common.ExecuteCommandFailure as error:
808818
return self.failed(identifier, error)
@@ -840,6 +850,7 @@ def dispatch(self, identifier, stdout=sys.stdout, stderr=sys.stderr):
840850
self.sandbox_profile_xcodebuild,
841851
self.sandbox_profile_package,
842852
self.added_swift_flags,
853+
incremental=self.skip_clean,
843854
should_strip_resource_phases=True,
844855
stdout=stdout, stderr=stderr)
845856
except common.ExecuteCommandFailure as error:

Diff for: runner.py

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def main():
4747
args.sandbox_profile_xcodebuild,
4848
args.sandbox_profile_package,
4949
args.add_swift_flags,
50+
args.skip_clean
5051
),
5152
),
5253
index

0 commit comments

Comments
 (0)