Skip to content

Commit b901a7c

Browse files
gnarled-cipherlaszlocsomor
authored andcommitted
Point to executable (#119)
//actions_run:merge will not hit merge.sh. The proposed changes updates the label so that it goes to //actions_run:merge.sh.
1 parent 8da4b9b commit b901a7c

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

rules/actions_run/BUILD

+25-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,34 @@ concat(
88
"body.html",
99
"footer.html",
1010
],
11+
merge_tool = select({
12+
"//conditions:default": "//actions_run:merge_on_linux",
13+
"on_linux": "//actions_run:merge_on_linux",
14+
"on_windows": "//actions_run:merge_on_windows.bat",
15+
}),
1116
)
1217

1318
# This target is used by the shell rule.
1419
sh_binary(
15-
name = "merge",
20+
name = "merge_on_linux",
1621
srcs = ["merge.sh"],
1722
)
23+
24+
sh_binary(
25+
name = "merge_on_windows.bat",
26+
srcs = ["merge.bat"],
27+
)
28+
29+
config_setting(
30+
name = "on_linux",
31+
constraint_values = [
32+
"@platforms//os:linux"
33+
],
34+
)
35+
36+
config_setting(
37+
name = "on_windows",
38+
constraint_values = [
39+
"@platforms//os:windows"
40+
],
41+
)

rules/actions_run/execute.bzl

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ def _impl(ctx):
1818
outputs = [ctx.outputs.out],
1919
arguments = args,
2020
progress_message = "Merging into %s" % ctx.outputs.out.short_path,
21-
executable = ctx.executable._merge_tool,
21+
executable = ctx.executable.merge_tool,
2222
)
2323

2424
concat = rule(
2525
implementation = _impl,
2626
attrs = {
2727
"chunks": attr.label_list(allow_files = True),
2828
"out": attr.output(mandatory = True),
29-
"_merge_tool": attr.label(
29+
"merge_tool": attr.label(
3030
executable = True,
3131
cfg = "host",
3232
allow_files = True,

rules/actions_run/merge.bat

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@echo OFF
2+
set files=
3+
4+
set out=%1
5+
6+
:addparam
7+
shift
8+
if "%1"=="" goto paramscomplete
9+
set files=%files% %1
10+
goto addparam
11+
:paramscomplete
12+
13+
type %files:/=\% > %out:/=\%

0 commit comments

Comments
 (0)