Skip to content

Commit

Permalink
Merge branch 'main' into fix/plus
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Nov 10, 2022

Verified

This commit was signed with the committer’s verified signature.
codebytere Shelley Vohr
2 parents ba98c1a + 28c090e commit 7d63c5d
Showing 26 changed files with 264 additions and 137 deletions.
14 changes: 2 additions & 12 deletions cargo/cargo_bootstrap.bzl
Original file line number Diff line number Diff line change
@@ -183,15 +183,8 @@ def _cargo_bootstrap_repository_impl(repository_ctx):
version_str = repository_ctx.attr.version

host_triple = get_host_triple(repository_ctx)

if repository_ctx.attr.rust_toolchain_repository_template:
# buildifier: disable=print
print("Warning: `rust_toolchain_repository_template` is deprecated. Please use `rust_toolchain_cargo_template` and `rust_toolchain_rustc_template`")
cargo_template = "@{}{}".format(repository_ctx.attr.rust_toolchain_repository_template, "//:bin/{tool}")
rustc_template = "@{}{}".format(repository_ctx.attr.rust_toolchain_repository_template, "//:bin/{tool}")
else:
cargo_template = repository_ctx.attr.rust_toolchain_cargo_template
rustc_template = repository_ctx.attr.rust_toolchain_rustc_template
cargo_template = repository_ctx.attr.rust_toolchain_cargo_template
rustc_template = repository_ctx.attr.rust_toolchain_rustc_template

tools = get_rust_tools(
cargo_template = cargo_template,
@@ -275,9 +268,6 @@ cargo_bootstrap_repository = repository_rule(
),
default = "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}",
),
"rust_toolchain_repository_template": attr.string(
doc = "**Deprecated**: Please use `rust_toolchain_cargo_template` and `rust_toolchain_rustc_template`",
),
"rust_toolchain_rustc_template": attr.string(
doc = (
"The template to use for finding the host `rustc` binary. `{version}` (eg. '1.53.0'), " +
2 changes: 1 addition & 1 deletion crate_universe/3rdparty/crates/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ alias(

alias(
name = "cfg-expr",
actual = "@cui__cfg-expr-0.11.0//:cfg_expr",
actual = "@cui__cfg-expr-0.12.0//:cfg_expr",
tags = ["manual"],
)

Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ rust_library(
"noclippy",
"norustfmt",
],
version = "0.11.0",
version = "0.12.0",
deps = [
] + select_with_or({
"//conditions:default": [
12 changes: 6 additions & 6 deletions crate_universe/3rdparty/crates/defs.bzl
Original file line number Diff line number Diff line change
@@ -296,7 +296,7 @@ _NORMAL_DEPENDENCIES = {
"cargo-platform": "@cui__cargo-platform-0.1.2//:cargo_platform",
"cargo_metadata": "@cui__cargo_metadata-0.15.1//:cargo_metadata",
"cargo_toml": "@cui__cargo_toml-0.13.0//:cargo_toml",
"cfg-expr": "@cui__cfg-expr-0.11.0//:cfg_expr",
"cfg-expr": "@cui__cfg-expr-0.12.0//:cfg_expr",
"clap": "@cui__clap-4.0.18//:clap",
"crates-index": "@cui__crates-index-0.18.10//:crates_index",
"hex": "@cui__hex-0.4.3//:hex",
@@ -634,12 +634,12 @@ def crate_repositories():

maybe(
http_archive,
name = "cui__cfg-expr-0.11.0",
sha256 = "b0357a6402b295ca3a86bc148e84df46c02e41f41fef186bda662557ef6328aa",
name = "cui__cfg-expr-0.12.0",
sha256 = "0bbc13bf6290a6b202cc3efb36f7ec2b739a80634215630c8053a313edf6abef",
type = "tar.gz",
urls = ["https://crates.io/api/v1/crates/cfg-expr/0.11.0/download"],
strip_prefix = "cfg-expr-0.11.0",
build_file = Label("@rules_rust//crate_universe/3rdparty/crates:BUILD.cfg-expr-0.11.0.bazel"),
urls = ["https://crates.io/api/v1/crates/cfg-expr/0.12.0/download"],
strip_prefix = "cfg-expr-0.12.0",
build_file = Label("@rules_rust//crate_universe/3rdparty/crates:BUILD.cfg-expr-0.12.0.bazel"),
)

maybe(
4 changes: 2 additions & 2 deletions crate_universe/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crate_universe/Cargo.toml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ cargo_metadata = "0.15.1"
cargo_toml = "0.13.0"
cargo-lock = "8.0.2"
cargo-platform = "0.1.2"
cfg-expr = "0.11.0"
cfg-expr = "0.12.0"
clap = { version = "4.0.13", features = ["derive", "env"] }
crates-index = { version = "0.18.10", default-features = false }
hex = "0.4.3"
2 changes: 1 addition & 1 deletion crate_universe/private/crates_vendor.bzl
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ def _get_output_package(ctx):
ctx.label.package,
ctx.attr.vendor_path,
)
return output
return output.lstrip("/")

def _write_data_file(ctx, name, data):
file = ctx.actions.declare_file("{}.{}".format(ctx.label.name, name))
4 changes: 2 additions & 2 deletions crate_universe/src/splicing/cargo_config.rs
Original file line number Diff line number Diff line change
@@ -114,13 +114,13 @@ impl FromStr for CargoConfig {
}

impl CargoConfig {
/// Load a Cargo conig from a path to a file on disk.
/// Load a Cargo config from a path to a file on disk.
pub fn try_from_path(path: &Path) -> Result<Self> {
let content = fs::read_to_string(path)?;
Self::from_str(&content)
}

/// Look up a reigstry [Source] by it's url.
/// Look up a registry [Source] by its url.
pub fn get_source_from_url(&self, url: &str) -> Option<&Source> {
self.source.values().find(|v| v.registry == url)
}
1 change: 1 addition & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ PAGES = dict([
name = "rust_repositories",
symbols = [
"rules_rust_dependencies",
"rust_analyzer_toolchain_repository",
"rust_register_toolchains",
"rust_repositories",
"rust_repository_set",
2 changes: 1 addition & 1 deletion docs/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_regi

rules_rust_dependencies()

rust_register_toolchains(include_rustc_srcs = True)
rust_register_toolchains()

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")

4 changes: 1 addition & 3 deletions docs/cargo.md
Original file line number Diff line number Diff line change
@@ -13,8 +13,7 @@
<pre>
cargo_bootstrap_repository(<a href="#cargo_bootstrap_repository-name">name</a>, <a href="#cargo_bootstrap_repository-binary">binary</a>, <a href="#cargo_bootstrap_repository-build_mode">build_mode</a>, <a href="#cargo_bootstrap_repository-cargo_lockfile">cargo_lockfile</a>, <a href="#cargo_bootstrap_repository-cargo_toml">cargo_toml</a>, <a href="#cargo_bootstrap_repository-env">env</a>, <a href="#cargo_bootstrap_repository-env_label">env_label</a>,
<a href="#cargo_bootstrap_repository-iso_date">iso_date</a>, <a href="#cargo_bootstrap_repository-repo_mapping">repo_mapping</a>, <a href="#cargo_bootstrap_repository-rust_toolchain_cargo_template">rust_toolchain_cargo_template</a>,
<a href="#cargo_bootstrap_repository-rust_toolchain_repository_template">rust_toolchain_repository_template</a>, <a href="#cargo_bootstrap_repository-rust_toolchain_rustc_template">rust_toolchain_rustc_template</a>, <a href="#cargo_bootstrap_repository-srcs">srcs</a>,
<a href="#cargo_bootstrap_repository-timeout">timeout</a>, <a href="#cargo_bootstrap_repository-version">version</a>)
<a href="#cargo_bootstrap_repository-rust_toolchain_rustc_template">rust_toolchain_rustc_template</a>, <a href="#cargo_bootstrap_repository-srcs">srcs</a>, <a href="#cargo_bootstrap_repository-timeout">timeout</a>, <a href="#cargo_bootstrap_repository-version">version</a>)
</pre>

A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/cargo/)
@@ -34,7 +33,6 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c
| <a id="cargo_bootstrap_repository-iso_date"></a>iso_date | The iso_date of cargo binary the resolver should use. Note: This can only be set if <code>version</code> is <code>beta</code> or <code>nightly</code> | String | optional | "" |
| <a id="cargo_bootstrap_repository-repo_mapping"></a>repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.&lt;p&gt;For example, an entry <code>"@foo": "@bar"</code> declares that, for any time this repository depends on <code>@foo</code> (such as a dependency on <code>@foo//some:target</code>, it should actually resolve that dependency within globally-declared <code>@bar</code> (<code>@bar//some:target</code>). | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
| <a id="cargo_bootstrap_repository-rust_toolchain_cargo_template"></a>rust_toolchain_cargo_template | The template to use for finding the host <code>cargo</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" |
| <a id="cargo_bootstrap_repository-rust_toolchain_repository_template"></a>rust_toolchain_repository_template | **Deprecated**: Please use <code>rust_toolchain_cargo_template</code> and <code>rust_toolchain_rustc_template</code> | String | optional | "" |
| <a id="cargo_bootstrap_repository-rust_toolchain_rustc_template"></a>rust_toolchain_rustc_template | The template to use for finding the host <code>rustc</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | "@rust_{system}_{arch}__{triple}_tools//:bin/{tool}" |
| <a id="cargo_bootstrap_repository-srcs"></a>srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
| <a id="cargo_bootstrap_repository-timeout"></a>timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | 600 |
Loading

0 comments on commit 7d63c5d

Please sign in to comment.