Skip to content

Commit 48954d1

Browse files
authored
Merge pull request #86 from rabbitmq/hex-contents-rule
Add `untar` rule
2 parents e83eeb5 + 09b9cfe commit 48954d1

File tree

3 files changed

+78
-7
lines changed

3 files changed

+78
-7
lines changed

.github/workflows/test.yaml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
otp:
15-
- "23.3"
1615
- "24.3"
17-
- "25.0"
16+
- "25.1"
1817
steps:
1918
- name: CHECKOUT
2019
uses: actions/checkout@v2
@@ -45,9 +44,8 @@ jobs:
4544
fail-fast: false
4645
matrix:
4746
otp:
48-
- "23.3"
4947
- "24.3"
50-
- "25.0"
48+
- "25.1"
5149
steps:
5250
- name: CHECKOUT
5351
uses: actions/checkout@v2
@@ -92,9 +90,8 @@ jobs:
9290
fail-fast: false
9391
matrix:
9492
otp:
95-
- "23.3"
9693
- "24.3"
97-
- "25.0"
94+
- "25.1"
9895
steps:
9996
- name: CHECKOUT
10097
uses: actions/checkout@v2
@@ -117,6 +114,40 @@ jobs:
117114
with:
118115
name: bazel-testlogs-bzlmod-${{matrix.otp}}
119116
path: ${{ steps.resolve-test-logs-path.outputs.LOGS_PATH }}/*
117+
test-bzlmod-windows:
118+
runs-on: windows-latest
119+
strategy:
120+
fail-fast: false
121+
matrix:
122+
otp:
123+
- "25.1"
124+
steps:
125+
- name: CHECKOUT
126+
uses: actions/checkout@v2
127+
- name: CONFIGURE ERLANG
128+
uses: erlef/setup-beam@v1
129+
with:
130+
otp-version: ${{ matrix.otp }}
131+
- name: CONFIGURE BAZEL
132+
working-directory: test
133+
shell: bash
134+
run: |
135+
cat << EOF >> user.bazelrc
136+
startup --windows_enable_symlinks
137+
build --enable_runfiles
138+
build --color=yes
139+
EOF
140+
- name: TEST
141+
working-directory: test
142+
shell: cmd
143+
run: |
144+
where erl > tmpFile
145+
set /p ERL_PATH= < tmpFile
146+
del tmpFile
147+
148+
set ERLANG_HOME=%ERL_PATH:\bin\erl.exe=%
149+
150+
bazelisk test //...
120151
test-bzlmod-internal-erlang:
121152
runs-on: ubuntu-latest
122153
steps:

bzlmod/erlang_package.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ GitPackage = provider(fields = [
3939
])
4040

4141
def log(ctx, msg):
42-
ctx.execute([ctx.which("echo"), "RULES_ERLANG: " + msg], timeout = 1, quiet = False)
42+
ctx.execute(["echo", "RULES_ERLANG: " + msg], timeout = 1, quiet = False)
4343

4444
def hex_tree(
4545
ctx,

untar.bzl

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
load(":util.bzl", "path_join")
2+
3+
def _impl(ctx):
4+
outputs = [
5+
ctx.actions.declare_file(f.name)
6+
for f in ctx.attr.outs
7+
]
8+
9+
args = ctx.actions.args()
10+
args.add("-x")
11+
args.add("--file")
12+
args.add(ctx.file.archive)
13+
args.add("--directory")
14+
args.add(path_join(
15+
ctx.bin_dir.path,
16+
ctx.label.workspace_root,
17+
ctx.label.package,
18+
))
19+
20+
ctx.actions.run(
21+
outputs = outputs,
22+
inputs = ctx.files.archive,
23+
executable = "tar",
24+
arguments = [args],
25+
)
26+
27+
return [DefaultInfo(files = depset(outputs))]
28+
29+
untar = rule(
30+
implementation = _impl,
31+
attrs = {
32+
"archive": attr.label(
33+
allow_single_file = True,
34+
mandatory = True,
35+
),
36+
"outs": attr.output_list(
37+
mandatory = True,
38+
),
39+
},
40+
)

0 commit comments

Comments
 (0)