Skip to content

Commit a802032

Browse files
committed
Support both local builds and builds as dependency
1 parent 31dc52c commit a802032

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
[env]
2+
BOOTLOADER_LOCAL_BUILD = "1"
3+
14
[target.x86_64-unknown-uefi]
25
runner = "cargo run -p runner"

build.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use std::{
33
process::Command,
44
};
55

6+
const BOOTLOADER_X86_64_UEFI_VERSION: &str = "0.1.0-alpha.0";
7+
68
fn main() {
79
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
810

@@ -18,8 +20,12 @@ fn build_uefi_bootloader(out_dir: &Path) -> PathBuf {
1820
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());
1921
let mut cmd = Command::new(cargo);
2022
cmd.arg("install").arg("bootloader-x86_64-uefi");
21-
// TODO: remove, only for testing, replace by `--version`
22-
cmd.arg("--path").arg("uefi");
23+
if std::env::var("BOOTLOADER_LOCAL_BUILD").is_ok() {
24+
// local build
25+
cmd.arg("--path").arg("uefi");
26+
} else {
27+
cmd.arg("--version").arg(BOOTLOADER_X86_64_UEFI_VERSION);
28+
}
2329
cmd.arg("--locked");
2430
cmd.arg("--target").arg("x86_64-unknown-uefi");
2531
cmd.arg("-Zbuild-std=core")

0 commit comments

Comments
 (0)