Skip to content

Commit 399e539

Browse files
[bazel] add tarball as an optional output (#1383)
Usage would be something like: ``` filegroup( name = "hello-world-tarball", srcs = [":hello-world-wasm"], output_group = "_wasm_tar", ) ```
1 parent d52c465 commit 399e539

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

bazel/emscripten_toolchain/wasm_cc_binary.bzl

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,15 @@ def _wasm_cc_binary_impl(ctx):
128128
executable = ctx.executable._wasm_binary_extractor,
129129
)
130130

131-
return DefaultInfo(
132-
files = depset(ctx.outputs.outputs),
133-
# This is needed since rules like web_test usually have a data
134-
# dependency on this target.
135-
data_runfiles = ctx.runfiles(transitive_files = depset(ctx.outputs.outputs)),
136-
)
131+
return [
132+
DefaultInfo(
133+
files = depset(ctx.outputs.outputs),
134+
# This is needed since rules like web_test usually have a data
135+
# dependency on this target.
136+
data_runfiles = ctx.runfiles(transitive_files = depset(ctx.outputs.outputs)),
137+
),
138+
OutputGroupInfo(_wasm_tar = cc_target.files),
139+
]
137140

138141
def _wasm_cc_binary_legacy_impl(ctx):
139142
cc_target = ctx.attr.cc_target[0]
@@ -162,13 +165,16 @@ def _wasm_cc_binary_legacy_impl(ctx):
162165
executable = ctx.executable._wasm_binary_extractor,
163166
)
164167

165-
return DefaultInfo(
166-
executable = ctx.outputs.wasm,
167-
files = depset(outputs),
168-
# This is needed since rules like web_test usually have a data
169-
# dependency on this target.
170-
data_runfiles = ctx.runfiles(transitive_files = depset(outputs)),
171-
)
168+
return [
169+
DefaultInfo(
170+
executable = ctx.outputs.wasm,
171+
files = depset(outputs),
172+
# This is needed since rules like web_test usually have a data
173+
# dependency on this target.
174+
data_runfiles = ctx.runfiles(transitive_files = depset(outputs)),
175+
),
176+
OutputGroupInfo(_wasm_tar = cc_target.files),
177+
]
172178

173179
_wasm_cc_binary = rule(
174180
implementation = _wasm_cc_binary_impl,

0 commit comments

Comments
 (0)