mirror of https://github.com/bazelbuild/rules_rust
rust_test(crate=foo) inherits foo.aliases (#2965)
Inline tests compile the same set of source files as the original crate. The set of aliases required will be the same or occasionally a superset. We shouldn't make users repeat them across targets.
This commit is contained in:
parent
c603a7710d
commit
a6426e06d0
|
@ -346,6 +346,8 @@ def _rust_test_impl(ctx):
|
||||||
ctx.attr.rustc_env,
|
ctx.attr.rustc_env,
|
||||||
data_paths,
|
data_paths,
|
||||||
))
|
))
|
||||||
|
aliases = dict(crate.aliases)
|
||||||
|
aliases.update(ctx.attr.aliases)
|
||||||
|
|
||||||
# Build the test binary using the dependency's srcs.
|
# Build the test binary using the dependency's srcs.
|
||||||
crate_info_dict = dict(
|
crate_info_dict = dict(
|
||||||
|
@ -355,7 +357,7 @@ def _rust_test_impl(ctx):
|
||||||
srcs = depset(srcs, transitive = [crate.srcs]),
|
srcs = depset(srcs, transitive = [crate.srcs]),
|
||||||
deps = depset(deps, transitive = [crate.deps]),
|
deps = depset(deps, transitive = [crate.deps]),
|
||||||
proc_macro_deps = depset(proc_macro_deps, transitive = [crate.proc_macro_deps]),
|
proc_macro_deps = depset(proc_macro_deps, transitive = [crate.proc_macro_deps]),
|
||||||
aliases = ctx.attr.aliases,
|
aliases = aliases,
|
||||||
output = output,
|
output = output,
|
||||||
rustc_output = generate_output_diagnostics(ctx, output),
|
rustc_output = generate_output_diagnostics(ctx, output),
|
||||||
edition = crate.edition,
|
edition = crate.edition,
|
||||||
|
|
|
@ -41,10 +41,6 @@ rust_test(
|
||||||
|
|
||||||
rust_test(
|
rust_test(
|
||||||
name = "mod3_test",
|
name = "mod3_test",
|
||||||
aliases = {
|
|
||||||
":mod1": "alias_a",
|
|
||||||
":mod2": "alias_b",
|
|
||||||
},
|
|
||||||
crate = ":mod3",
|
crate = ":mod3",
|
||||||
edition = "2018",
|
edition = "2018",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue