Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit b396924

Browse files
committed
Add more crates
Signed-off-by: Quanyi Ma <eli@patch.sh>
1 parent 7093e2a commit b396924

File tree

609 files changed

+172662
-105
lines changed

Some content is hidden

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

609 files changed

+172662
-105
lines changed

BUCK

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,81 @@ cargo.rust_binary(
66
srcs = glob(["src/**/*.rs"]),
77
crate_root = "src/main.rs",
88
deps = [
9-
"//third-party/rust/crates/libc/0.2.169:libc",
9+
# Shlex
1010
"//third-party/rust/crates/shlex/1.3.0:shlex",
11+
"//third-party/rust/crates/shlex/1.3.0:shlex-no-std",
12+
# ---
13+
14+
# zstd-sys
1115
"//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys",
16+
"//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys-experimental",
17+
# ---
18+
19+
# cfg-if
1220
"//third-party/rust/crates/cfg-if/1.0.0:cfg-if",
21+
# ---
22+
23+
# libc
24+
"//third-party/rust/crates/libc/0.2.169:libc",
25+
# ---
26+
27+
# syn
28+
# "//third-party/rust/crates/syn/2.0.81",
29+
# ---
30+
31+
# Serde
32+
# "//third-party/rust/crates/serde/1.0.60:serde",
33+
# ---
34+
35+
# Serde_derive
36+
# "//third-party/rust/crates/serde_derive/1.0.218:serde_derive",
37+
# ---
38+
39+
# foreign-types
40+
"//third-party/rust/crates/foreign-types/0.3.2:foreign-types",
41+
# ---
42+
43+
# foreign-types-shared/
1344
"//third-party/rust/crates/foreign-types-shared/0.1.1:foreign-types-shared",
45+
# ---
46+
47+
# once_cell
48+
"//third-party/rust/crates/once_cell/1.20.3:once_cell",
49+
"//third-party/rust/crates/once_cell/1.20.3:once_cell-alloc",
50+
"//third-party/rust/crates/once_cell/1.20.3:once_cell-std",
51+
"//third-party/rust/crates/once_cell/1.20.3:once_cell-unstable",
52+
# "//third-party/rust/crates/once_cell/1.20.3:once_cell-parking_lot",
53+
"//third-party/rust/crates/once_cell/1.20.3:once_cell-critical-section",
54+
# "//third-party/rust/crates/once_cell/1.20.3:once_cell-polyfill",
55+
# "//third-party/rust/crates/once_cell/1.20.3:once_cell-portable-atomic",
56+
# ---
57+
58+
# parking_lot_core
59+
# "//third-party/rust/crates/parking_lot_core/0.9.10:parking_lot_core",
60+
# ---
61+
62+
# critical-section
63+
"//third-party/rust/crates/critical-section/1.1.3:critical-section",
64+
"//third-party/rust/crates/critical-section/1.1.3:critical-section-std",
65+
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-bool",
66+
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-none",
67+
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-u8",
68+
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-u16",
69+
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-u32",
70+
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-u64",
71+
"//third-party/rust/crates/critical-section/1.2.0:critical-section",
72+
"//third-party/rust/crates/critical-section/1.2.0:critical-section-std",
73+
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-bool",
74+
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-none",
75+
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-u8",
76+
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-u16",
77+
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-u32",
78+
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-u64",
79+
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-usize",
80+
# ---
81+
82+
# portable-atomic
83+
# "//third-party/rust/crates/portable-atomic/1.8.0:portable-atomic",
1484
],
1585
visibility = ["PUBLIC"],
1686
)

BUG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Bug List
2+
3+
### critical-section-1.1.3
4+
5+
```bash
6+
buck2 build //third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-usize
7+
```
8+
9+
```bash
10+
Action failed: root//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-usize (failure_filter diag)
11+
Local command returned non-zero exit code 1
12+
Reproduce locally: `env -- 'BUCK_SCRATCH_PATH=buck-out/v2/tmp/root/af28991d2c6d7ebb/failure_filter/diag' /usr/bin/env 'P ...<omitted>... tic_pic-metadata-fast-diag/critical_section_restore_state_usize-metadata-fast_build_status-diag.json (run `buck2 log what-failed` to get the full command)`
13+
stdout:
14+
stderr:
15+
error[E0308]: mismatched types
16+
--> third-party/rust/crates/critical-section/1.1.3/src/lib.rs:150:21
17+
|
18+
150 | return Self(());
19+
| ---- ^^ expected `usize`, found `()`
20+
| |
21+
| arguments to this function are incorrect
22+
|
23+
note: tuple struct defined here
24+
--> third-party/rust/crates/critical-section/1.1.3/src/lib.rs:132:12
25+
|
26+
132 | pub struct RestoreState(RawRestoreState);
27+
| ^^^^^^^^^^^^
28+
29+
30+
error: aborting due to 1 previous error
31+
32+
33+
For more information about this error, try `rustc --explain E0308`.
34+
35+
Missing required input file rlib-pic-static_pic-metadata-fast-diag/libcritical_section_restore_state_usize-69c32067.rmeta (buck-out/v2/gen/root/200212f73efcd57d/third-party/rust/crates/critical-section/1.1.3/__critical-section-restore-state-usize__/rlib-pic-static_pic-metadata-fast-diag/libcritical_section_restore_state_usize-69c32067.rmeta)
36+
Build ID: d46e9ebb-c371-49a7-b5a9-dbb2789d24f2
37+
Analyzing targets. Remaining 0/1
38+
Executing actions. Remaining 0/5 0.1s exec time total
39+
Command: build. Finished 2 local
40+
Time elapsed: 0.1s
41+
BUILD FAILED
42+
Failed to build 'root//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-usize (prelude//platforms:default#200212f73efcd57d)'
43+
```

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
# buck2-rust-third-party
1+
## BUCK files of Crate
2+
3+
### Purpose
4+
5+
1. openssl-sys - 0.9.106
6+
2. rustc-std-workspace-core - 1.0.1
7+
8+
### Building All
9+
10+
`buck2 build //:buck2-rust-third-party`
11+
12+
### Buck2 TODO
13+
14+
- [ ] Check OS/Architecture and other build parameters
15+
- [ ] How to run tests with Buck2
16+
17+
### Bug List
18+
19+
[bug list](BUG.md)

third-party/README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,20 @@ For now, I am trying to generate `BUCK` with `Cargo.toml` with Claude, and the p
8282

8383
编写附件 Cargo.toml 对应功能的 BUCK 文件,满足 Buck2 编译的需求,要求包括:
8484

85-
1. BUCK 文件中的注释使用英文;
86-
2. 交互过程使用中文;
87-
3. 使用 `load("@prelude//rust:cargo_package.bzl", "cargo")`;
88-
4. BUCK 文件中没有 `version``licenses` 字段;
89-
5. BUCK 文件中 `edition` 字段固定使用 `2021`
90-
6. 如果有依赖存在,请使用 `//third-party/rust/crates/<crate_name>/<crate_version>:<crate_name>` 来替换;
91-
7. 请在基础模板下进行修改:
85+
* BUCK 文件中的注释使用英文;
86+
* 交互过程使用中文;
87+
* 使用 `load("@prelude//rust:cargo_package.bzl", "cargo")`;
88+
* BUCK 文件中没有 `version``licenses` 字段;
89+
* BUCK 文件中 `edition` 字段固定使用 `2021`
90+
* 如果有依赖存在,请使用 `//third-party/rust/crates/<crate_name>/<crate_version>:<crate_name>` 来替换;
91+
* 如果有 Feature, 使用如下的方式来设计:
92+
```
93+
FEATURES = {
94+
"debug": [],
95+
"default": ["legacy", "zdict_builder"],
96+
}
97+
```
98+
* 请在基础模板下进行修改:
9299
```
93100
load("@prelude//rust:cargo_package.bzl", "cargo")
94101
@@ -97,8 +104,10 @@ cargo.rust_library(
97104
edition = "2021",
98105
srcs = glob(["src/**/*.rs"]),
99106
crate_root = "src/lib.rs",
100-
visibility = ["PUBLIC"],
101-
features = ["default"],
107+
features = FEATURES["default"],
108+
rustc_flags = [],
109+
env = {},
102110
deps = [],
111+
visibility = ["PUBLIC"],
103112
)
104113
```

third-party/TODO.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
### Not Implemented
44

5-
[ ] cfg-if `rustc-dep-of-std = ["core", "compiler_builtins"]`
5+
- [ ] `cfg-if-1.0.0` - `//third-party/rust/crates/cfg-if/1.0.0:cfg-if-rustc-dep`
6+
- [ ] `syn-2.0.81` - Test and benchmarks test
Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
load("@prelude//rust:cargo_package.bzl", "cargo")
22

3+
# This file is created for cfg-if crate
4+
# Original author: Alex Crichton <alex@alexcrichton.com>
5+
# A macro to ergonomically define an item depending on a large number of #[cfg]
6+
# parameters. Structured like an if-else chain, the first matching branch is the
7+
# item that gets emitted.
8+
39
cargo.rust_library(
410
name = "cfg-if",
511
edition = "2021",
612
srcs = glob(["src/**/*.rs"]),
713
crate_root = "src/lib.rs",
8-
features = ["default"],
914
visibility = ["PUBLIC"],
15+
features = ["default"],
1016
deps = [],
1117
)
18+
19+
# Define additional targets for rustc-dep-of-std feature
20+
cargo.rust_library(
21+
name = "cfg-if-rustc-dep",
22+
edition = "2021",
23+
srcs = glob(["src/**/*.rs"]),
24+
crate_root = "src/lib.rs",
25+
visibility = ["PUBLIC"],
26+
features = ["rustc-dep-of-std"],
27+
deps = [
28+
"//third-party/rust/crates/compiler_builtins/0.1.2:compiler_builtins",
29+
"//third-party/rust/crates/rustc-std-workspace-core/1.0.0:core",
30+
],
31+
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[cells]
2+
root = .
3+
prelude = prelude
4+
toolchains = toolchains
5+
none = none
6+
7+
[cell_aliases]
8+
config = prelude
9+
ovr_config = prelude
10+
fbcode = none
11+
fbsource = none
12+
fbcode_macros = none
13+
buck = none
14+
15+
# Uses a copy of the prelude bundled with the buck2 binary. You can alternatively delete this
16+
# section and vendor a copy of the prelude to the `prelude` directory of your project.
17+
[external_cells]
18+
prelude = bundled
19+
20+
[parser]
21+
target_platform_detector_spec = target:root//...->prelude//platforms:default
22+
23+
[build]
24+
execution_platforms = prelude//platforms:default
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"git": {
3+
"sha1": "3a328a84040b721034a1b084e4a9dea8218a90f8"
4+
},
5+
"path_in_vcs": ""
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @rust-embedded/hal
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
block_labels = ["needs-decision"]
2+
delete_merged_branches = true
3+
required_approvals = 1
4+
status = [
5+
"clippy (1.54)",
6+
"clippy (1.63)",
7+
"clippy (1.63, std)",
8+
"rustfmt",
9+
"test (1.54)",
10+
"test (1.63)",
11+
"test (1.63, std)",
12+
]

0 commit comments

Comments
 (0)