[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",
)
```
This commit is contained in:
@@ -128,12 +128,15 @@ def _wasm_cc_binary_impl(ctx):
|
|||||||
executable = ctx.executable._wasm_binary_extractor,
|
executable = ctx.executable._wasm_binary_extractor,
|
||||||
)
|
)
|
||||||
|
|
||||||
return DefaultInfo(
|
return [
|
||||||
files = depset(ctx.outputs.outputs),
|
DefaultInfo(
|
||||||
# This is needed since rules like web_test usually have a data
|
files = depset(ctx.outputs.outputs),
|
||||||
# dependency on this target.
|
# This is needed since rules like web_test usually have a data
|
||||||
data_runfiles = ctx.runfiles(transitive_files = depset(ctx.outputs.outputs)),
|
# dependency on this target.
|
||||||
)
|
data_runfiles = ctx.runfiles(transitive_files = depset(ctx.outputs.outputs)),
|
||||||
|
),
|
||||||
|
OutputGroupInfo(_wasm_tar = cc_target.files),
|
||||||
|
]
|
||||||
|
|
||||||
def _wasm_cc_binary_legacy_impl(ctx):
|
def _wasm_cc_binary_legacy_impl(ctx):
|
||||||
cc_target = ctx.attr.cc_target[0]
|
cc_target = ctx.attr.cc_target[0]
|
||||||
@@ -162,13 +165,16 @@ def _wasm_cc_binary_legacy_impl(ctx):
|
|||||||
executable = ctx.executable._wasm_binary_extractor,
|
executable = ctx.executable._wasm_binary_extractor,
|
||||||
)
|
)
|
||||||
|
|
||||||
return DefaultInfo(
|
return [
|
||||||
executable = ctx.outputs.wasm,
|
DefaultInfo(
|
||||||
files = depset(outputs),
|
executable = ctx.outputs.wasm,
|
||||||
# This is needed since rules like web_test usually have a data
|
files = depset(outputs),
|
||||||
# dependency on this target.
|
# This is needed since rules like web_test usually have a data
|
||||||
data_runfiles = ctx.runfiles(transitive_files = depset(outputs)),
|
# dependency on this target.
|
||||||
)
|
data_runfiles = ctx.runfiles(transitive_files = depset(outputs)),
|
||||||
|
),
|
||||||
|
OutputGroupInfo(_wasm_tar = cc_target.files),
|
||||||
|
]
|
||||||
|
|
||||||
_wasm_cc_binary = rule(
|
_wasm_cc_binary = rule(
|
||||||
implementation = _wasm_cc_binary_impl,
|
implementation = _wasm_cc_binary_impl,
|
||||||
|
|||||||
Reference in New Issue
Block a user