feat: write_source_files bulk write for windows (#43)

This commit is contained in:
Derek Cormier 2022-03-02 12:56:50 -08:00 committed by GitHub
parent 71c1b893d6
commit ca764e53e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -61,6 +61,8 @@ def _write_source_files_bat(ctx):
ctx.label.name + "_update.bat",
)
additional_update_scripts = [target[_WriteSourceFilesInfo].executable for target in ctx.attr.additional_update_targets]
content = """
@rem Generated by write_source_files.bzl, do not edit.
@echo off
@ -85,7 +87,13 @@ echo Copying %in% to %out% in %cd%
copy %in% %out% >NUL
""".format(in_file = ctx.files.in_files[i].short_path.replace("/", "\\"), out_file = ctx.files.out_files[i].short_path).replace("/", "\\")
for i in range(len(ctx.attr.in_files))
])
]) + """
cd %runfiles_dir%
@rem Run the update scripts for all write_source_file deps
""" + "\n".join(["""
call {update_script}
""".format(update_script = update_script.short_path) for update_script in additional_update_scripts])
content = content.replace("\n", "\r\n")