Skip to content

Commit 23b427f

Browse files
committed
build-script: remove any swift files in the generated file dir before generating new ones
1 parent e1a52d6 commit 23b427f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

build-script.py

+5
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ def generate_gyb_files(verbose, add_source_locations, tar_path):
107107
if not os.path.exists(generated_files_dir):
108108
os.makedirs(generated_files_dir)
109109

110+
# Clear any *.swift files that are relics from the previous run.
111+
for previous_gyb_gen_file in os.listdir(generated_files_dir):
112+
if previous_gyb_gen_file.endswith('.swift'):
113+
check_call(['rm', previous_gyb_gen_file], cwd=generated_files_dir)
114+
110115
# Generate the new .swift files in a temporary directory and only copy them
111116
# to Sources/SwiftSyntax/gyb_generated if they are different than the files
112117
# already residing there. This way we don't touch the generated .swift

0 commit comments

Comments
 (0)