Skip to content

Commit b3c8c2d

Browse files
authored
Merge branch 'main' into policy
2 parents 71119cb + 4be4fbe commit b3c8c2d

File tree

152 files changed

+7274
-7695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+7274
-7695
lines changed

.bazelci/presubmit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ aspects_flags: &aspects_flags
1717
- "--config=rustfmt"
1818
- "--config=clippy"
1919
min_rust_version_shell_commands: &min_rust_version_shell_commands
20-
- sed -i 's|^rust_register_toolchains(|rust_register_toolchains(versions = ["1.74.0"],\n|' WORKSPACE.bazel
21-
- sed -i 's|^rust\.toolchain(|rust.toolchain(versions = ["1.74.0"],\n|' MODULE.bazel
20+
- sed -i 's|^rust_register_toolchains(|rust_register_toolchains(versions = ["1.85.0"],\n|' WORKSPACE.bazel
21+
- sed -i 's|^rust\.toolchain(|rust.toolchain(versions = ["1.85.0"],\n|' MODULE.bazel
2222
nightly_flags: &nightly_flags
2323
- "--//rust/toolchain/channel=nightly"
2424
nightly_aspects_flags: &nightly_aspects_flags
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Release Runfiles
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- rust/runfiles/Cargo.toml
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
validation:
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- uses: actions/checkout@v4
20+
# TODO: Unfortunately it's not obvious how to restrict `workflow_dispatch` to a particular branch
21+
# so this step ensures releases are always done off of `main`.
22+
- name: Ensure branch is 'main'
23+
run: |
24+
git fetch origin &> /dev/null
25+
branch="$(git rev-parse --abbrev-ref HEAD)"
26+
if [[ "${branch}" != "main" ]]; then
27+
echo "The release branch must be main. Got '${branch}'' instead." >&2
28+
exit 1
29+
else
30+
echo "Branch is '${branch}'"
31+
fi
32+
builds:
33+
needs: validation
34+
runs-on: ubuntu-22.04
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Install rust toolchains for host
38+
run: |
39+
# Detect the current version of rust
40+
version="$(grep 'DEFAULT_RUST_VERSION =' ./rust/private/common.bzl | grep -o '[[:digit:].]\+')"
41+
rustup override set "${version}"
42+
rustup update stable && rustup default stable
43+
- name: Publish to crates.io
44+
run: cargo publish --token ${CRATES_TOKEN}
45+
working-directory: ./rust/runfiles
46+
env:
47+
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}

MODULE.bazel

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ internal_deps = use_extension("//rust/private:internal_extensions.bzl", "i")
2121
use_repo(
2222
internal_deps,
2323
"rrra",
24-
"rrra__anyhow-1.0.71",
25-
"rrra__camino-1.1.9",
26-
"rrra__clap-4.3.11",
27-
"rrra__env_logger-0.10.0",
28-
"rrra__itertools-0.11.0",
29-
"rrra__log-0.4.19",
30-
"rrra__serde-1.0.171",
31-
"rrra__serde_json-1.0.102",
24+
"rrra__anyhow-1.0.102",
25+
"rrra__camino-1.2.2",
26+
"rrra__clap-4.6.0",
27+
"rrra__env_logger-0.11.10",
28+
"rrra__itertools-0.14.0",
29+
"rrra__log-0.4.29",
30+
"rrra__serde-1.0.228",
31+
"rrra__serde_json-1.0.149",
3232
"rules_rust_tinyjson",
3333
)
3434

@@ -112,7 +112,7 @@ use_repo(
112112
"cui__cargo-lock-10.1.0",
113113
"cui__cargo-platform-0.1.9",
114114
"cui__cargo_metadata-0.19.2",
115-
"cui__cargo_toml-0.22.1",
115+
"cui__cargo_toml-0.22.3",
116116
"cui__cfg-expr-0.18.0",
117117
"cui__clap-4.5.37",
118118
"cui__crates-index-3.7.0",
@@ -134,7 +134,7 @@ use_repo(
134134
"cui__tempfile-3.19.1",
135135
"cui__tera-1.20.0",
136136
"cui__textwrap-0.16.2",
137-
"cui__toml-0.8.21",
137+
"cui__toml-0.9.5",
138138
"cui__tracing-0.1.41",
139139
"cui__tracing-subscriber-0.3.19",
140140
"cui__url-2.5.4",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
load(":transitive_data_test.bzl", "transitive_cbs_data_test_suite")
2+
3+
transitive_cbs_data_test_suite(
4+
name = "transitive_cbs_data_test_suite",
5+
)
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
"""Tests documenting that cargo_build_script `data` files currently act as both
2+
compile_data and runtime data -- they appear in Rustc compile action inputs for
3+
both the direct library and transitive dependents.
4+
5+
See https://github.com/bazelbuild/rules_rust/issues/3609 for context."""
6+
7+
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
8+
load("@bazel_skylib//rules:write_file.bzl", "write_file")
9+
load("//cargo:defs.bzl", "cargo_build_script")
10+
load("//rust:defs.bzl", "rust_library")
11+
12+
def _cbs_data_in_rustc_inputs_impl(ctx):
13+
env = analysistest.begin(ctx)
14+
target = analysistest.target_under_test(env)
15+
16+
rustc_action = None
17+
for action in target.actions:
18+
if action.mnemonic == "Rustc":
19+
rustc_action = action
20+
break
21+
22+
asserts.false(env, rustc_action == None, "Expected a Rustc action")
23+
24+
# cargo_build_script `data` currently flows into BuildInfo.compile_data
25+
# via script_data, so it appears in Rustc action inputs for both the
26+
# direct dependent and transitive dependents. This documents that
27+
# CBS `data` effectively acts as both compile_data and data today.
28+
data_inputs = [i for i in rustc_action.inputs.to_list() if "cbs_data_dep.txt" in i.path]
29+
asserts.true(
30+
env,
31+
len(data_inputs) > 0,
32+
"Expected CBS data file to appear in Rustc action inputs (CBS data currently acts as compile_data)",
33+
)
34+
35+
return analysistest.end(env)
36+
37+
cbs_data_in_rustc_inputs_test = analysistest.make(
38+
_cbs_data_in_rustc_inputs_impl,
39+
)
40+
41+
def _define_test_targets():
42+
write_file(
43+
name = "cbs_data_dep_file",
44+
out = "cbs_data_dep.txt",
45+
content = ["data for build script", ""],
46+
newline = "unix",
47+
)
48+
49+
write_file(
50+
name = "build_rs_src",
51+
out = "build.rs",
52+
content = ["fn main() {}", ""],
53+
newline = "unix",
54+
)
55+
56+
cargo_build_script(
57+
name = "build_script",
58+
srcs = [":build.rs"],
59+
data = [":cbs_data_dep.txt"],
60+
edition = "2021",
61+
)
62+
63+
write_file(
64+
name = "lib_src",
65+
out = "lib.rs",
66+
content = ["pub fn hello() {}", ""],
67+
newline = "unix",
68+
)
69+
70+
rust_library(
71+
name = "lib",
72+
srcs = [":lib.rs"],
73+
deps = [":build_script"],
74+
edition = "2021",
75+
)
76+
77+
write_file(
78+
name = "bin_src",
79+
out = "bin.rs",
80+
content = ["extern crate lib;", ""],
81+
newline = "unix",
82+
)
83+
84+
rust_library(
85+
name = "bin",
86+
srcs = [":bin.rs"],
87+
deps = [":lib"],
88+
edition = "2021",
89+
)
90+
91+
def transitive_cbs_data_test_suite(name):
92+
"""Entry-point macro called from the BUILD file.
93+
94+
Args:
95+
name (str): Name of the macro.
96+
"""
97+
_define_test_targets()
98+
99+
cbs_data_in_rustc_inputs_test(
100+
name = "cbs_data_in_lib_compile_inputs_test",
101+
target_under_test = ":lib",
102+
)
103+
104+
cbs_data_in_rustc_inputs_test(
105+
name = "cbs_data_in_bin_compile_inputs_test",
106+
target_under_test = ":bin",
107+
)
108+
109+
native.test_suite(
110+
name = name,
111+
tests = [
112+
":cbs_data_in_lib_compile_inputs_test",
113+
":cbs_data_in_bin_compile_inputs_test",
114+
],
115+
)

crate_universe/3rdparty/crates/BUILD.bazel

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crate_universe/3rdparty/crates/BUILD.cargo-lock-10.1.0.bazel

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crate_universe/3rdparty/crates/BUILD.cargo_toml-0.22.1.bazel renamed to crate_universe/3rdparty/crates/BUILD.cargo_toml-0.22.3.bazel

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crate_universe/3rdparty/crates/BUILD.crates-index-3.7.0.bazel

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crate_universe/3rdparty/crates/BUILD.serde-1.0.219.bazel

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)