Skip to content

Commit 0a55b1d

Browse files
authored
Merge pull request swiftlang#153 from ahoppen/only-remove-deleted-files
Only remove gyb-generated files that don't exist anymore
2 parents cd1e298 + 65c643b commit 0a55b1d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

build-script.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ def generate_gyb_files(verbose, add_source_locations, tar_path):
110110
# Clear any *.swift files that are relics from the previous run.
111111
for previous_gyb_gen_file in os.listdir(generated_files_dir):
112112
if previous_gyb_gen_file.endswith('.swift'):
113-
check_call(['rm', previous_gyb_gen_file], cwd=generated_files_dir)
113+
gyb_file = os.path.join(swiftsyntax_sources_dir,
114+
previous_gyb_gen_file + '.gyb')
115+
if not os.path.exists(gyb_file):
116+
check_call(['rm', previous_gyb_gen_file], cwd=generated_files_dir,
117+
verbose=verbose)
114118

115119
# Generate the new .swift files in a temporary directory and only copy them
116120
# to Sources/SwiftSyntax/gyb_generated if they are different than the files

0 commit comments

Comments
 (0)