-
-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b89c43
commit 6fc0ca9
Showing
6 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
def copy_cmd(ctx, src, dst): | ||
# Most Windows binaries built with MSVC use a certain argument quoting | ||
# scheme. Bazel uses that scheme too to quote arguments. However, | ||
# cmd.exe uses different semantics, so Bazel's quoting is wrong here. | ||
# To fix that we write the command to a .bat file so no command line | ||
# quoting or escaping is required. | ||
bat = ctx.actions.declare_file(ctx.label.name + "-cmd.bat") | ||
ctx.actions.write( | ||
output = bat, | ||
# Do not use lib/shell.bzl's shell.quote() method, because that uses | ||
# Bash quoting syntax, which is different from cmd.exe's syntax. | ||
content = "@copy /Y \"%s\" \"%s\" >NUL" % ( | ||
src.path.replace("/", "\\"), | ||
dst.path.replace("/", "\\"), | ||
), | ||
is_executable = True, | ||
) | ||
ctx.actions.run( | ||
inputs = [src], | ||
tools = [bat], | ||
outputs = [dst], | ||
executable = "cmd.exe", | ||
arguments = ["/C", bat.path.replace("/", "\\")], | ||
mnemonic = "CopyFile", | ||
progress_message = "Copying files", | ||
use_default_shell_env = True, | ||
) | ||
|
||
def copy_bash(ctx, src, dst): | ||
ctx.actions.run_shell( | ||
tools = [src], | ||
outputs = [dst], | ||
command = "cp -f \"$1\" \"$2\"", | ||
arguments = [src.path, dst.path], | ||
mnemonic = "CopyFile", | ||
progress_message = "Copying files", | ||
use_default_shell_env = True, | ||
) |