You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>In cases where Rust targets have heavy interactions with other Bazel targets (<ahref="https://docs.bazel.build/versions/main/be/c-cpp.html">Cc</a>, <ahref="https://rules-proto-grpc.com/en/4.5.0/lang/rust.html">Proto</a>,
269
271
etc.), maintaining Cargo.toml files may have diminishing returns as things like rust-analyzer
270
272
begin to be confused about missing targets or environment variables defined only in Bazel.
271
-
In situations like this, it may be desirable to have a âCargo freeâ setup. You find an example in the in the <ahref="../examples/bzlmod/hello_world_no_cargo">example folder</a>.</p>
273
+
In situations like this, it may be desirable to have a "Cargo free" setup. You find an example in the in the <ahref="../examples/bzlmod/hello_world_no_cargo">example folder</a>.</p>
272
274
<p>crates_repository supports this through the packages attribute,
<p>With cargo you <code>can install</code> binary dependencies (bindeps) as well with <code>cargo install</code> command.</p>
306
+
<p>We don't have such easy facilities available in bazel besides specifying it as a dependency.
307
+
To mimic cargo's bindeps feature we use the unstable feature called <ahref="https://doc.rust-lang.org/nightly/cargo/reference/unstable.html?highlight=feature#artifact-dependencies">artifact-dependencies</a>
308
+
which integrates well with bazel concepts.</p>
309
+
<p>You could use the syntax specified in the above document to place it in <code>Cargo.toml</code>. For that you can consult the following <ahref="https://github.com/bazelbuild/rules_rust/blob/main/examples/crate_universe/MODULE.bazel#L279-L291">example</a>.</p>
310
+
<p>This method has the following consequences:</p>
311
+
<ul>
312
+
<li>if you use shared dependency tree with your project these binary dependencies will interfere with yours (may conflict)</li>
313
+
<li>you have to use nightly <code>host_tools_repo</code> to generate dependencies because</li>
314
+
</ul>
315
+
<p>Alternatively you can specify this in a separate <code>repo</code> with <code>cargo.from_specs</code> syntax:</p>
<p>In cases where Rust targets have heavy interactions with other Bazel targets (<ahref="https://docs.bazel.build/versions/main/be/c-cpp.html">Cc</a>, <ahref="https://rules-proto-grpc.com/en/4.5.0/lang/rust.html">Proto</a>,
2041
2043
etc.), maintaining Cargo.toml files may have diminishing returns as things like rust-analyzer
2042
2044
begin to be confused about missing targets or environment variables defined only in Bazel.
2043
-
In situations like this, it may be desirable to have a âCargo freeâ setup. You find an example in the in the <ahref="../examples/bzlmod/hello_world_no_cargo">example folder</a>.</p>
2045
+
In situations like this, it may be desirable to have a "Cargo free" setup. You find an example in the in the <ahref="../examples/bzlmod/hello_world_no_cargo">example folder</a>.</p>
2044
2046
<p>crates_repository supports this through the packages attribute,
<p>With cargo you <code>can install</code> binary dependencies (bindeps) as well with <code>cargo install</code> command.</p>
2078
+
<p>We don't have such easy facilities available in bazel besides specifying it as a dependency.
2079
+
To mimic cargo's bindeps feature we use the unstable feature called <ahref="https://doc.rust-lang.org/nightly/cargo/reference/unstable.html?highlight=feature#artifact-dependencies">artifact-dependencies</a>
2080
+
which integrates well with bazel concepts.</p>
2081
+
<p>You could use the syntax specified in the above document to place it in <code>Cargo.toml</code>. For that you can consult the following <ahref="https://github.com/bazelbuild/rules_rust/blob/main/examples/crate_universe/MODULE.bazel#L279-L291">example</a>.</p>
2082
+
<p>This method has the following consequences:</p>
2083
+
<ul>
2084
+
<li>if you use shared dependency tree with your project these binary dependencies will interfere with yours (may conflict)</li>
2085
+
<li>you have to use nightly <code>host_tools_repo</code> to generate dependencies because</li>
2086
+
</ul>
2087
+
<p>Alternatively you can specify this in a separate <code>repo</code> with <code>cargo.from_specs</code> syntax:</p>
0 commit comments