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

Commit 640176e

Browse files
committed
chore: add pkg-config crate and related test files
Signed-off-by: Quanyi Ma <eli@patch.sh>
1 parent c5aaf1f commit 640176e

File tree

23 files changed

+2274
-257
lines changed

23 files changed

+2274
-257
lines changed

BUCK

Lines changed: 0 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,6 @@ cargo.rust_binary(
2121
"//third-party/rust/crates/winapi/0.3.9:winapi", # --config rust.features=everything,impl-debug,impl-default --config rust.target=i686-pc-windows-gnu
2222
# ---
2323

24-
# rand_core
25-
"//third-party/rust/crates/rand_core/0.3.1:rand_core",
26-
"//third-party/rust/crates/rand_core/0.4.0:rand_core",
27-
28-
# autocfg
29-
"//third-party/rust/crates/autocfg/1.4.0:autocfg",
30-
31-
# equivalent
32-
"//third-party/rust/crates/equivalent/1.0.2:equivalent",
33-
34-
# fny
35-
"//third-party/rust/crates/fnv/1.0.7:fnv",
36-
37-
# rustc-std-workspace-core
38-
"//third-party/rust/crates/rustc-std-workspace-core/1.0.1:rustc-std-workspace-core",
39-
40-
# lexopt
41-
"//third-party/rust/crates/lexopt/0.3.0:lexopt",
42-
43-
# opaque-debug
44-
"//third-party/rust/crates/opaque-debug/0.3.1:opaque-debug",
45-
46-
# anstyle
47-
# Example: `buck2 run //third-party/rust/crates/anstyle/1.0.10:dump-style`
48-
"//third-party/rust/crates/anstyle/1.0.10:anstyle",
49-
"//third-party/rust/crates/anstyle/1.0.10:dump-style",
50-
5124
# zstd-sys
5225
"//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys",
5326
"//third-party/rust/crates/zstd-sys/2.0.14+zstd.1.5.7:zstd-sys",
@@ -56,110 +29,14 @@ cargo.rust_binary(
5629
# zstd-safe
5730
"//third-party/rust/crates/zstd-safe/7.2.1:zstd-safe",
5831

59-
# cfg-if
60-
"//third-party/rust/crates/cfg-if/1.0.0:cfg-if",
61-
# ---
62-
63-
# time-core
64-
"//third-party/rust/crates/time-core/0.1.4:time-core",
65-
6632
# libc
6733
"//third-party/rust/crates/libc/0.2.169:libc",
6834
# ---
6935

70-
# tinyvec_macros
71-
"//third-party/rust/crates/tinyvec_macros/0.1.1:tinyvec_macros",
72-
73-
# try-lock
74-
"//third-party/rust/crates/try-lock/0.2.5:try-lock",
75-
76-
# untrusted
77-
"//third-party/rust/crates/untrusted/0.9.0:untrusted",
78-
79-
# utf8parse
80-
"//third-party/rust/crates/utf8parse/0.2.2:utf8parse",
81-
82-
# openssl-probe
83-
"//third-party/rust/crates/openssl-probe/0.1.6:openssl-probe",
84-
85-
# pin-utils
86-
"//third-party/rust/crates/pin-utils/0.1.0:pin-utils",
87-
88-
# quick-error
89-
"//third-party/rust/crates/quick-error/2.0.1:quick-error",
90-
91-
# scopeguard
92-
"//third-party/rust/crates/scopeguard/1.2.0:scopeguard",
93-
94-
# static_assertions
95-
"//third-party/rust/crates/static_assertions/1.1.0:static_assertions",
96-
97-
# syn
98-
# "//third-party/rust/crates/syn/2.0.81:syn",
99-
# ---
100-
101-
# Serde
102-
#"//third-party/rust/crates/serde/1.0.60:serde",
103-
# ---
104-
105-
# Serde_derive
106-
#"//third-party/rust/crates/serde_derive/1.0.218:serde_derive",
107-
# ---
108-
109-
# foreign-types
110-
"//third-party/rust/crates/foreign-types/0.3.2:foreign-types",
111-
# ---
112-
11336
# foreign-types-shared/
11437
"//third-party/rust/crates/foreign-types-shared/0.1.1:foreign-types-shared",
11538
"//third-party/rust/crates/foreign-types-shared/0.3.1:foreign-types-shared",
11639
# ---
117-
118-
# once_cell
119-
"//third-party/rust/crates/once_cell/1.20.3:once_cell",
120-
"//third-party/rust/crates/once_cell/1.20.3:once_cell-alloc",
121-
"//third-party/rust/crates/once_cell/1.20.3:once_cell-std",
122-
"//third-party/rust/crates/once_cell/1.20.3:once_cell-unstable",
123-
# "//third-party/rust/crates/once_cell/1.20.3:once_cell-parking_lot",
124-
"//third-party/rust/crates/once_cell/1.20.3:once_cell-critical-section",
125-
# "//third-party/rust/crates/once_cell/1.20.3:once_cell-polyfill",
126-
# "//third-party/rust/crates/once_cell/1.20.3:once_cell-portable-atomic",
127-
# ---
128-
129-
# parking_lot_core
130-
# "//third-party/rust/crates/parking_lot_core/0.9.10:parking_lot_core",
131-
# ---
132-
133-
# critical-section
134-
"//third-party/rust/crates/critical-section/1.1.3:critical-section",
135-
"//third-party/rust/crates/critical-section/1.1.3:critical-section-std",
136-
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-bool",
137-
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-none",
138-
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-u8",
139-
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-u16",
140-
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-u32",
141-
"//third-party/rust/crates/critical-section/1.1.3:critical-section-restore-state-u64",
142-
"//third-party/rust/crates/critical-section/1.2.0:critical-section",
143-
"//third-party/rust/crates/critical-section/1.2.0:critical-section-std",
144-
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-bool",
145-
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-none",
146-
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-u8",
147-
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-u16",
148-
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-u32",
149-
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-u64",
150-
"//third-party/rust/crates/critical-section/1.2.0:critical-section-restore-state-usize",
151-
# ---
152-
153-
# portable-atomic
154-
# "//third-party/rust/crates/portable-atomic/1.8.0:portable-atomic",
155-
156-
# Shlex
157-
"//third-party/rust/crates/shlex/1.3.0:shlex",
158-
"//third-party/rust/crates/shlex/1.3.0:shlex-no-std",
159-
# ---
160-
161-
# version_check
162-
"//third-party/rust/crates/version_check/0.9.5:version_check",
16340
],
16441
visibility = ["PUBLIC"],
16542
)

third-party/rust/crates/autocfg/1.4.0/BUCK

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ rust_library(
99
features = [],
1010
rustc_flags = [],
1111
env = {},
12-
deps = [],
12+
deps = [
13+
],
1314
visibility = ["PUBLIC"],
1415
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
load("@prelude//rust:cargo_package.bzl", "cargo")
2+
load("//third-party/rust/crates/cc/1.2.16:build.bzl", "get_rust_features")
3+
4+
cargo.rust_library(
5+
name = "cc",
6+
crate = "cc",
7+
edition = "2018",
8+
crate_root = "src/lib.rs",
9+
srcs = glob(["src/**/*.rs"]),
10+
features = get_rust_features(),
11+
deps = [
12+
"//third-party/rust/crates/shlex:1.3.0",
13+
"//third-party/rust/crates/jobserver:0.1.32",
14+
"//third-party/rust/crates/libc:0.2.169",
15+
],
16+
visibility = ["PUBLIC"],
17+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def get_rust_features():
2+
features_config = read_config("rust", "features", "")
3+
4+
if features_config == "":
5+
# Default features from Cargo.toml
6+
return ["derive", "parsing", "printing", "clone-impls", "proc-macro"]
7+
return [f.strip() for f in features_config.split(",") if f.strip()]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"git": {
3+
"sha1": "d75288fde2a0da850cd6834934cd9cba8cefc04d"
4+
},
5+
"path_in_vcs": ""
6+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
13+
jobs:
14+
build:
15+
name: ${{ matrix.rust }}
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
rust:
21+
- 1.31.0
22+
- stable
23+
- beta
24+
- nightly
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: dtolnay/rust-toolchain@master
28+
with:
29+
toolchain: ${{ matrix.rust }}
30+
- name: Use MSRV Cargo.lock
31+
run: cp Cargo.lock.msrv Cargo.lock
32+
if: matrix.rust == '1.31.0'
33+
- name: cargo fmt --all -- --check
34+
run: |
35+
rustup component add rustfmt-preview
36+
cargo fmt --all -- --check
37+
if: matrix.rust == 'stable'
38+
- run: |
39+
cargo build --verbose
40+
- run: |
41+
cargo test --verbose
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/target
2+
/Cargo.lock
3+
.idea
4+
*.iml

0 commit comments

Comments
 (0)