Skip to content

Re-add support for building Wasm libraries as executables. #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ def _rust_binary_impl(ctx):
return rustc_compile_action(
ctx = ctx,
toolchain = toolchain,
crate_type = "bin",
crate_type = ctx.attr.crate_type,
crate_info = rust_common.crate_info(
name = crate_name,
type = "bin",
root = crate_root_src(ctx.attr, ctx.files.srcs, crate_type = "bin"),
type = ctx.attr.crate_type,
root = crate_root_src(ctx.attr, ctx.files.srcs, ctx.attr.crate_type),
srcs = depset(ctx.files.srcs),
deps = depset(ctx.attr.deps),
proc_macro_deps = depset(ctx.attr.proc_macro_deps),
Expand Down Expand Up @@ -793,6 +793,15 @@ rust_proc_macro = rule(
)

_rust_binary_attrs = {
"crate_type": attr.string(
doc = _tidy("""
Crate type that will be passed to `rustc` to be used for building this crate.

This option is a temporary workaround and should be used only when building
for WebAssembly targets (//rust/platform:wasi and //rust/platform:wasm).
"""),
default = "bin",
),
"linker_script": attr.label(
doc = _tidy("""
Link script to forward into linker via rustc options.
Expand Down