[infra] copy_tree.py should not blow away existing files

Otherwise, files calculated by ninja to be clean are deleted, but
not rebuilt.

related #31774

Change-Id: I5f0c2a3f6b06de20195d8a3b7320dd59df38fbdb
Reviewed-on: https://dart-review.googlesource.com/33700
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
This commit is contained in:
Zachary Anderson 2018-01-09 23:18:07 -08:00 committed by commit-bot@chromium.org
parent ec3c098ee0
commit 2e87c35c04

View file

@ -65,7 +65,8 @@ def CopyTree(src, dst, ignore=None):
else:
ignored_names = set()
os.makedirs(dst)
if not os.path.exists(dst):
os.makedirs(dst)
errors = []
for name in names:
if name in ignored_names:
@ -143,8 +144,6 @@ def Main(argv):
SourcesToGN(args.gn_paths)
return 0
if os.path.exists(args.to):
shutil.rmtree(args.to)
if args.exclude_patterns == None:
CopyTree(args.copy_from, args.to)
else: