Skip to content

Commit 50d8970

Browse files
committed
Remove cargo-metadata dependency
1 parent 937f4fa commit 50d8970

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6262
- The `embedded-hal` Read implementation of `Serial` does now return `WoudBlock`
6363
if the peripheral is busy. Also if an `Overrun` occured the receive data
6464
register (RDR) is flushed to have a more consistent API. ([#253])
65+
- Remove `cargo-metadata` as a build dependency to cut down dependencies and
66+
the reliance on `resolver = "2"`. ([#270])
6567

6668
### Fixed
6769

@@ -438,6 +440,7 @@ let clocks = rcc
438440
[defmt]: https://github.com/knurling-rs/defmt
439441
[filter]: https://defmt.ferrous-systems.com/filtering.html
440442

443+
[#270]: https://github.com/stm32-rs/stm32f3xx-hal/pull/270
441444
[#266]: https://github.com/stm32-rs/stm32f3xx-hal/pull/266
442445
[#265]: https://github.com/stm32-rs/stm32f3xx-hal/pull/265
443446
[#264]: https://github.com/stm32-rs/stm32f3xx-hal/pull/264

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ panic-rtt-target = { version = "0.1", features = ["cortex-m"] }
6565
rtt-target = { version = "0.3.0", features = ["cortex-m"] }
6666

6767
[build-dependencies]
68-
cargo_metadata = "0.13.1"
6968
slice-group-by = "0.2.6"
7069

7170
[features]

build.rs

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,39 @@ use std::fs::File;
44
use std::io::prelude::*;
55
use std::path::PathBuf;
66

7-
use cargo_metadata::MetadataCommand;
87
// TODO(Sh3Rm4n - 2021-04-28):
98
// Remove when [feature="slice_group_by"] is stable.
109
// See with https://github.com/rust-lang/rust/issues/80552.
1110
use slice_group_by::GroupBy;
1211

12+
const DEVICE_VARIANTS: [&str; 25] = [
13+
"stm32f301x6",
14+
"stm32f301x8",
15+
"stm32f318x8",
16+
"stm32f302x6",
17+
"stm32f302x8",
18+
"stm32f302xb",
19+
"stm32f302xc",
20+
"stm32f302xd",
21+
"stm32f302xe",
22+
"stm32f303x6",
23+
"stm32f303x8",
24+
"stm32f303xb",
25+
"stm32f303xc",
26+
"stm32f303xd",
27+
"stm32f303xe",
28+
"stm32f328x8",
29+
"stm32f358xc",
30+
"stm32f398xe",
31+
"stm32f373x8",
32+
"stm32f373xb",
33+
"stm32f373xc",
34+
"stm32f378xc",
35+
"stm32f334x4",
36+
"stm32f334x6",
37+
"stm32f334x8",
38+
];
39+
1340
fn main() {
1441
check_device_feature();
1542
if cfg!(feature = "ld") {
@@ -36,20 +63,7 @@ fn check_device_feature() {
3663
std::process::exit(1);
3764
}
3865

39-
// get all device variants from the metadata
40-
let metadata = MetadataCommand::new().exec().unwrap();
41-
let device_variants: HashSet<String> = metadata
42-
.root_package()
43-
.unwrap()
44-
.features
45-
.iter()
46-
.filter_map(|(feature, dependent_features)| {
47-
dependent_features
48-
.iter()
49-
.any(|dependent_feature| dependent_feature == "device-selected")
50-
.then(|| feature.clone())
51-
})
52-
.collect();
66+
let device_variants: HashSet<String> = DEVICE_VARIANTS.iter().map(|s| s.to_string()).collect();
5367

5468
// get all selected features via env variables
5569
let selected_features: HashSet<String> = env::vars()

0 commit comments

Comments
 (0)