Skip to content

Commit

Permalink
Added Rust 1.66.0 (#1705)
Browse files Browse the repository at this point in the history
* Added Rust 1.66.0

* Regenerate documentation
  • Loading branch information
UebelAndre authored Dec 16, 2022
1 parent 1469cd7 commit 019f871
Show file tree
Hide file tree
Showing 23 changed files with 311 additions and 39 deletions.
6 changes: 3 additions & 3 deletions cargo/cargo_build_script_runner/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn run_buildrs() -> Result<(), String> {
let exec_root = env::current_dir().expect("Failed to get current directory");
let manifest_dir_env = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR was not set");
let rustc_env = env::var("RUSTC").expect("RUSTC was not set");
let manifest_dir = exec_root.join(&manifest_dir_env);
let manifest_dir = exec_root.join(manifest_dir_env);
let rustc = exec_root.join(&rustc_env);
let Options {
progname,
Expand All @@ -48,15 +48,15 @@ fn run_buildrs() -> Result<(), String> {
input_dep_env_paths,
} = parse_args()?;

let out_dir_abs = exec_root.join(&out_dir);
let out_dir_abs = exec_root.join(out_dir);
// For some reason Google's RBE does not create the output directory, force create it.
create_dir_all(&out_dir_abs)
.unwrap_or_else(|_| panic!("Failed to make output directory: {:?}", out_dir_abs));

let target_env_vars =
get_target_env_vars(&rustc_env).expect("Error getting target env vars from rustc");

let mut command = Command::new(exec_root.join(&progname));
let mut command = Command::new(exec_root.join(progname));
command
.current_dir(&manifest_dir)
.envs(target_env_vars)
Expand Down
9 changes: 4 additions & 5 deletions crate_universe/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ impl Context {
let crates: BTreeMap<CrateId, CrateContext> = annotations
.metadata
.crates
.iter()
// Convert the crate annotations into more renderable contexts
.map(|(_, annotation)| {
.values()
.map(|annotation| {
let context = CrateContext::new(
annotation,
&annotations.metadata.packages,
Expand Down Expand Up @@ -281,8 +280,8 @@ impl Context {
pub fn flat_workspace_member_deps(&self) -> BTreeMap<CrateId, Option<String>> {
let workspace_member_dependencies: BTreeSet<CrateDependency> = self
.workspace_members
.iter()
.map(|(id, _)| &self.crates[id])
.keys()
.map(|id| &self.crates[id])
.flat_map(|ctx| {
// Build an interator of all dependency CrateIds.
// TODO: This expansion is horribly verbose and should be refactored but closures
Expand Down
4 changes: 2 additions & 2 deletions crate_universe/src/rendering/template_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ impl TemplateEngine {
context.insert("context", ctx);

ctx.crates
.iter()
.map(|(id, _)| {
.keys()
.map(|id| {
let aliases = ctx.crate_aliases(id, false, false);
let build_aliases = ctx.crate_aliases(id, true, false);

Expand Down
14 changes: 7 additions & 7 deletions crate_universe/src/splicing/splicer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl<'a> SplicerKind<'a> {
fs::create_dir_all(&dot_cargo_dir)?;
}

fs::copy(cargo_config_path, &dot_cargo_dir.join("config.toml"))?;
fs::copy(cargo_config_path, dot_cargo_dir.join("config.toml"))?;
}

Ok(())
Expand Down Expand Up @@ -488,8 +488,8 @@ impl Splicer {
// Load all manifests
let manifests = splicing_manifest
.manifests
.iter()
.map(|(path, _)| {
.keys()
.map(|path| {
let m = read_manifest(path)
.with_context(|| format!("Failed to read manifest at {}", path.display()))?;
Ok((path.clone(), m))
Expand Down Expand Up @@ -615,7 +615,7 @@ pub fn write_root_manifest(path: &Path, manifest: cargo_toml::Manifest) -> Resul
}

// TODO(https://gitlab.com/crates.rs/cargo_toml/-/issues/3)
let value = toml::Value::try_from(&manifest)?;
let value = toml::Value::try_from(manifest)?;
fs::write(path, toml::to_string(&value)?)
.context(format!("Failed to write manifest to {}", path.display()))
}
Expand Down Expand Up @@ -1165,7 +1165,7 @@ mod test {
fs::create_dir_all(external_manifest.parent().unwrap()).unwrap();
fs::write(
&external_manifest,
&textwrap::dedent(
textwrap::dedent(
r#"
[package]
name = "external_workspace_member"
Expand Down Expand Up @@ -1211,8 +1211,8 @@ mod test {

// Modify the root manifest to remove the rendered package
fs::write(
&cache_dir.as_ref().join("Cargo.toml"),
&textwrap::dedent(
cache_dir.as_ref().join("Cargo.toml"),
textwrap::dedent(
r#"
[workspace]
members = [
Expand Down
8 changes: 4 additions & 4 deletions crate_universe/src/utils/starlark/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ mod test {
let actual_file = subdir.join("greatgrandchild");
create_dir_all(subdir).unwrap();
{
File::create(&workspace).unwrap();
File::create(&build_file).unwrap();
File::create(workspace).unwrap();
File::create(build_file).unwrap();
File::create(&actual_file).unwrap();
}
let label = Label::from_absolute_path(&actual_file).unwrap();
Expand All @@ -322,7 +322,7 @@ mod test {
let actual_file = subdir.join("greatgrandchild");
create_dir_all(subdir).unwrap();
{
File::create(&build_file).unwrap();
File::create(build_file).unwrap();
File::create(&actual_file).unwrap();
}
let err = Label::from_absolute_path(&actual_file)
Expand All @@ -340,7 +340,7 @@ mod test {
let actual_file = subdir.join("greatgrandchild");
create_dir_all(subdir).unwrap();
{
File::create(&workspace).unwrap();
File::create(workspace).unwrap();
File::create(&actual_file).unwrap();
}
let err = Label::from_absolute_path(&actual_file)
Expand Down
2 changes: 1 addition & 1 deletion docs/cargo.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c
| <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'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | <code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code> |
| <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/concepts/labels">List of labels</a> | optional | <code>[]</code> |
| <a id="cargo_bootstrap_repository-timeout"></a>timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | <code>600</code> |
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.65.0"</code> |
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.66.0"</code> |


<a id="cargo_dep_env"></a>
Expand Down
4 changes: 2 additions & 2 deletions docs/crate_universe.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ that is called behind the scenes to update dependencies.
| <a id="crates_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/rules/lib/dict">Dictionary: String -> String</a> | required | |
| <a id="crates_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'), <code>{cfg}</code> (eg. 'exec'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | <code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code> |
| <a id="crates_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'), <code>{cfg}</code> (eg. 'exec'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'cargo.exe') will be replaced in the string if present. | String | optional | <code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code> |
| <a id="crates_repository-rust_version"></a>rust_version | The version of Rust the currently registered toolchain is using. Eg. <code>1.56.0</code>, or <code>nightly/2021-09-08</code> | String | optional | <code>"1.65.0"</code> |
| <a id="crates_repository-rust_version"></a>rust_version | The version of Rust the currently registered toolchain is using. Eg. <code>1.56.0</code>, or <code>nightly/2021-09-08</code> | String | optional | <code>"1.66.0"</code> |
| <a id="crates_repository-splicing_config"></a>splicing_config | The configuration flags to use for splicing Cargo maniests. Use <code>//crate_universe:defs.bzl\%rsplicing_config</code> to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | <code>""</code> |
| <a id="crates_repository-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | <code>["i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "aarch64-pc-windows-msvc", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "armv7-linux-androideabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf"]</code> |

Expand Down Expand Up @@ -623,7 +623,7 @@ Define dependencies of the `cargo-bazel` Rust target

| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="crate_universe_dependencies-rust_version"></a>rust_version | The version of rust to use when generating dependencies. | `"1.65.0"` |
| <a id="crate_universe_dependencies-rust_version"></a>rust_version | The version of rust to use when generating dependencies. | `"1.66.0"` |
| <a id="crate_universe_dependencies-bootstrap"></a>bootstrap | If true, a <code>cargo_bootstrap_repository</code> target will be generated. | `False` |


Expand Down
2 changes: 1 addition & 1 deletion docs/flatten.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c
| <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'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | <code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code> |
| <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/concepts/labels">List of labels</a> | optional | <code>[]</code> |
| <a id="cargo_bootstrap_repository-timeout"></a>timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | <code>600</code> |
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.65.0"</code> |
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.66.0"</code> |


<a id="cargo_dep_env"></a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "6dcd6fba667c2a840bf66b00bccf9b13845e9f1fc9052d45a17e472e4dc449e2",
"checksum": "65c0eb8b3b139244ffb2542508ffa52acac2de117584247b90ab67c3bd9ba1ba",
"crates": {
"aho-corasick 0.7.20": {
"name": "aho-corasick",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "d4bb99369d5f0fa1d593884a4d0ced3d54c8b952d130be207b8b679fcb6ea19f",
"checksum": "b819ab7a9515daeda37fef72ae16248adc6932c0e099da7064a227fb0dd096d0",
"crates": {
"ansi_term 0.12.1": {
"name": "ansi_term",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "e6c182632c28e4441c118b555f41b59a7232e59082e633fdc39f4331836e74a9",
"checksum": "0c935c42cf606198258d84ea1786a3186c83117c21fc2952d76059d41546602d",
"crates": {
"aho-corasick 0.7.20": {
"name": "aho-corasick",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "65a10454f6e5293f5ff1bb6771bc382118c0b7caa6b14220ed2698c84d5ce536",
"checksum": "776479ec32348cbf58d045fceee729c2ac70cc3762e85c265995be0e59effd1e",
"crates": {
"async-trait 0.1.59": {
"name": "async-trait",
Expand Down
1 change: 1 addition & 0 deletions examples/ios_build/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ crates_repository(
# `generator` is not necessary in official releases.
# See load satement for `cargo_bazel_bootstrap`.
generator = "@cargo_bazel_bootstrap//:cargo-bazel",
isolated = False,
lockfile = "//:cargo-bazel-lock.json",
manifests = ["//:Cargo.toml"],
splicing_config = splicing_config(
Expand Down
2 changes: 1 addition & 1 deletion examples/ios_build/cargo-bazel-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "a64dac953b35f3e09de8c81bd6d35b5d57c20f7e18c33ef8dd50bba33b975525",
"checksum": "4cf0cbe3b1870c2664b9e9cb3131b366ca35bacb548f07357958cf2030c8e0ea",
"crates": {
"cc 1.0.77": {
"name": "cc",
Expand Down
Loading

0 comments on commit 019f871

Please sign in to comment.