-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
25 lines (22 loc) · 829 Bytes
/
build.rs
File metadata and controls
25 lines (22 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
fn main() {
let lock = std::fs::read_to_string("Cargo.lock").expect("Failed to read Cargo.lock");
let mut found_microformats = false;
for line in lock.lines() {
if line.contains("name = \"microformats\"")
&& !line.contains("microformats-parser-website")
&& !line.contains("microformats-types")
{
found_microformats = true;
continue;
}
if found_microformats && line.starts_with("version = ") {
let version = line.split('"').nth(1).expect("Failed to parse version");
println!("cargo:rustc-env=MF2_VERSION={}", version);
break;
}
}
if !found_microformats {
panic!("Could not find microformats version in Cargo.lock");
}
println!("cargo:rerun-if-changed=Cargo.lock");
}