File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ def _channel(version):
1010 return "beta"
1111 return "stable"
1212
13+ def _rustc_flags_to_select (rustc_flags_by_triple ):
14+ return select (
15+ {"@rules_rs//rs/experimental/platforms/config:" + triple : flags for triple , flags in rustc_flags_by_triple .items ()} |
16+ {"//conditions:default" : []},
17+ )
18+
1319def declare_rustc_toolchains (
1420 * ,
1521 version ,
@@ -98,11 +104,8 @@ def declare_rustc_toolchains(
98104 "//conditions:default" : [],
99105 }),
100106 default_edition = edition ,
101- extra_exec_rustc_flags = extra_exec_rustc_flags .get (triple ),
102- extra_rustc_flags = select (
103- {"@rules_rs//rs/experimental/platforms/config:" + triple : flags for triple , flags in extra_rustc_flags .items ()} |
104- {"//conditions:default" : []},
105- ),
107+ extra_exec_rustc_flags = _rustc_flags_to_select (extra_exec_rustc_flags ),
108+ extra_rustc_flags = _rustc_flags_to_select (extra_rustc_flags ),
106109 exec_triple = triple ,
107110 target_triple = select (target_triple_select ),
108111 visibility = ["//visibility:public" ],
Original file line number Diff line number Diff line change @@ -158,6 +158,11 @@ rust_crate(
158158
159159 binaries = {bin ["name" ]: bin ["path" ] for bin in cargo_toml .get ("bin" , []) if bin ["name" ] in rctx .attr .gen_binaries }
160160
161+ implicit_binary_name = package ["name" ]
162+ implicit_binary_path = "src/main.rs"
163+ if implicit_binary_name in rctx .attr .gen_binaries and implicit_binary_name not in binaries and rctx .path (implicit_binary_path ).exists :
164+ binaries [implicit_binary_name ] = implicit_binary_path
165+
161166 return build_content .format (
162167 name = repr (name ),
163168 hub_name = rctx .attr .hub_name ,
You can’t perform that action at this time.
0 commit comments