0

[rust] Fetch Rust toolchain by default on Linux.

Our very first step towards enabling Rust code in Chromium canary is to
start to distribute the Rust toolchain. Initially, we'll do that only on
Linux.

Bug: 1292038
Change-Id: Id9a514fd0585c21a0fc0c0259b04ae9844d14f40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4287201
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Adrian Taylor <adetaylor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1111454}
This commit is contained in:
Adrian Taylor
2023-03-01 07:04:14 +00:00
committed by Chromium LUCI CQ
parent de73b33f25
commit 8a824c2359
22 changed files with 58 additions and 55 deletions
DEPS
docs
infra/config
generated
builders
ci
android-rust-arm32-rel
android-rust-arm64-dbg
android-rust-arm64-rel
linux-rust-x64-dbg
linux-rust-x64-rel
mac-rust-x64-rel
win-rust-x64-dbg
win-rust-x64-rel
try
android-rust-arm32-rel
android-rust-arm64-dbg
android-rust-arm64-rel
linux-rust-x64-dbg
linux-rust-x64-rel-android-toolchain
linux-rust-x64-rel
mac-rust-x64-rel
win-rust-x64-dbg
win-rust-x64-rel
subprojects
tools
crates
rust

27
DEPS

@ -136,11 +136,8 @@ vars = {
# Fetch clang-tidy into the same bin/ directory as our clang binary.
'checkout_clang_tidy': False,
# Fetch clang libraries and headers in order to build clang tooling. This is
# required to build C++-Rust interop codegen tools. This may break things that
# use it when clang rolls, and is meant for prototyping. You should talk to
# tools/clang/OWNERS before depending on it.
'checkout_clang_libs': 'use_rust',
# Fetch clang libraries and headers in order to build clang tooling.
'checkout_clang_libs': False,
# Fetch clangd into the same bin/ directory as our clang binary.
'checkout_clangd': False,
@ -156,7 +153,7 @@ vars = {
# ..._rs_api_impl.cc that are generated by prebuilt (see
# tools/rust/build_crubit.py) Crubit tools during Chromium build (see
# also //build/rust/rs_bindings_from_cc.gni).
'checkout_crubit': 'use_rust',
'checkout_crubit': False,
# By default checkout the OpenXR loader library only on Windows. The OpenXR
# backend for VR in Chromium is currently only supported for Windows, but
@ -255,7 +252,10 @@ vars = {
# We avoid doing this on toolchain build bots (where
# `checkout_rust_toolchain_deps` is set) since they are building the Rust
# toolchain.
'fetch_prebuilt_chromium_rust_toolchain': 'use_rust and host_os == "linux" and not checkout_rust_toolchain_deps',
'checkout_rust': 'host_os == "linux" and not checkout_rust_toolchain_deps',
# Fetch the Android team's Rust toolchain.
'fetch_android_chromium_rust_toolchain': False,
# Build in-tree Rust toolchain. checkout_clang_libs must also be True. The
# corresponding GN arg use_chromium_rust_toolchain directs the build to use
@ -278,12 +278,10 @@ vars = {
# reclient CIPD package version
'reclient_version': 're_client_version:0.96.2.d36a87c-gomaip',
# Fetch Rust-related packages.
'use_rust': False,
# Fetch dependencies needed to build Rust toolchain. Not needed if developing
# Rust code in Chromium; instead enable use_rust. Only use if building the
# Rust toolchain.
# Rust code in Chromium; instead enable checkout_rust
# (which is gradually being made the default across different platforms).
# Only use if building the Rust toolchain.
'checkout_rust_toolchain_deps': False,
'android_git': 'https://android.googlesource.com',
@ -582,8 +580,7 @@ deps = {
},
],
'dep_type': 'cipd',
# TODO(https://crbug.com/1292038): gate this on use_rust as well as host_os.
'condition': 'host_os == "linux"',
'condition': 'fetch_android_rust_toolchain',
},
# We don't know target_cpu at deps time. At least until there's a universal
@ -4075,7 +4072,7 @@ hooks = [
# Update prebuilt Rust toolchain.
'name': 'rust-toolchain',
'pattern': '.',
'condition': 'fetch_prebuilt_chromium_rust_toolchain',
'condition': 'checkout_rust',
'action': ['python3', 'src/tools/rust/update_rust.py'],
},
{

@ -34,9 +34,9 @@ For questions or help, reach out to `rust-dev@chromium.org` or `#rust` on the
# Building with Rust support
1. Add `"checkout_rust": True` to your `.gclient` file in the `"custom vars"`
section. (This is the default on Linux, so you can skip this).
1. Add `enable_rust = true` in your `gn` arguments, via `gn args <outdir>`.
1. Add `"use_rust": True` to your `.gclient` file in the `"custom vars"`
section.
If you use VSCode, we have [additional advice below](#using-vscode).

@ -27,8 +27,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust",
"android"
"android",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -27,8 +27,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust",
"android"
"android",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -27,8 +27,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust",
"android"
"android",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,7 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,7 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_rust",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_rust",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_rust",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -27,8 +27,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust",
"android"
"android",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -27,8 +27,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust",
"android"
"android",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -27,8 +27,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust",
"android"
"android",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,7 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,7 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,7 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_rust",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_rust",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -22,7 +22,8 @@
},
"legacy_gclient_config": {
"apply_configs": [
"use_rust"
"checkout_rust",
"checkout_clang_libs"
],
"config": "chromium"
}

@ -31,8 +31,8 @@ ci.builder(
gclient_config = builder_config.gclient_config(
config = "chromium",
apply_configs = [
"use_rust",
"android",
"checkout_clang_libs",
],
),
chromium_config = builder_config.chromium_config(
@ -57,8 +57,8 @@ ci.builder(
gclient_config = builder_config.gclient_config(
config = "chromium",
apply_configs = [
"use_rust",
"android",
"checkout_clang_libs",
],
),
chromium_config = builder_config.chromium_config(
@ -83,8 +83,8 @@ ci.builder(
gclient_config = builder_config.gclient_config(
config = "chromium",
apply_configs = [
"use_rust",
"android",
"checkout_clang_libs",
],
),
chromium_config = builder_config.chromium_config(
@ -108,7 +108,9 @@ ci.builder(
builder_spec = builder_config.builder_spec(
gclient_config = builder_config.gclient_config(
config = "chromium",
apply_configs = ["use_rust"],
apply_configs = [
"checkout_clang_libs",
],
),
chromium_config = builder_config.chromium_config(
config = "chromium",
@ -128,7 +130,9 @@ ci.builder(
builder_spec = builder_config.builder_spec(
gclient_config = builder_config.gclient_config(
config = "chromium",
apply_configs = ["use_rust"],
apply_configs = [
"checkout_clang_libs",
],
),
chromium_config = builder_config.chromium_config(
config = "chromium",
@ -148,7 +152,7 @@ ci.builder(
builder_spec = builder_config.builder_spec(
gclient_config = builder_config.gclient_config(
config = "chromium",
apply_configs = ["use_rust"],
apply_configs = ["checkout_rust", "checkout_clang_libs"],
),
chromium_config = builder_config.chromium_config(
config = "chromium",
@ -169,7 +173,7 @@ ci.builder(
builder_spec = builder_config.builder_spec(
gclient_config = builder_config.gclient_config(
config = "chromium",
apply_configs = ["use_rust"],
apply_configs = ["checkout_rust", "checkout_clang_libs"],
),
chromium_config = builder_config.chromium_config(
config = "chromium",
@ -190,7 +194,7 @@ ci.builder(
builder_spec = builder_config.builder_spec(
gclient_config = builder_config.gclient_config(
config = "chromium",
apply_configs = ["use_rust"],
apply_configs = ["checkout_rust", "checkout_clang_libs"],
),
chromium_config = builder_config.chromium_config(
config = "chromium",

@ -59,10 +59,7 @@ fn check_path<'a>(root: &Path, p_str: &'a str) -> io::Result<&'a Path> {
if !root.join(p).exists() {
return Err(io::Error::new(
io::ErrorKind::Other,
format!(
"could not find {} (invoked from Chromium checkout root? is use_rust enabled in .gclient?)",
p.display()
),
format!("could not find {} (invoked from Chromium checkout root?)", p.display()),
));
}

@ -57,8 +57,7 @@ of the entry):
'version': 'version:2@2022-01-01',
},
],
'dep_type': 'cipd',
'condition': 'checkout_rust_toolchain_deps or use_rust',
# ...
},
```
@ -262,7 +261,7 @@ solutions = [
...
"custom_vars": {
"checkout_bazel": True,
"use_rust": True,
"checkout_crubit": True,
},
},
]