-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement build sysroot with cargo_metadata
- Loading branch information
Showing
6 changed files
with
213 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ target | |
.liquid | ||
*.dot | ||
log | ||
sysroot/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
pub use flux_attrs::*; | ||
|
||
#[sig(fn(bool[true]) )] | ||
pub fn assert(_: bool) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,7 @@ | ||
#![feature(register_tool)] | ||
use std::path::PathBuf; | ||
|
||
pub const FLUX_SYSROOT: &str = "FLUX_SYSROOT"; | ||
pub const FLUX_FULL_COMPILATION: &str = "FLUX_FULL_COMPILATION"; | ||
|
||
pub fn find_flux_path() -> PathBuf { | ||
let executable_name = if cfg!(windows) { "rustc-flux.exe" } else { "rustc-flux" }; | ||
find_file_in_target_dir(executable_name) | ||
} | ||
|
||
/// Rustc flags to pass Flux when running tests | ||
pub fn default_rustc_flags() -> Vec<String> { | ||
vec!["--crate-type=rlib".to_string(), "--edition=2021".to_string()] | ||
} | ||
|
||
fn find_file_in_target_dir(file: &str) -> PathBuf { | ||
let target_directory = if cfg!(debug_assertions) { "debug" } else { "release" }; | ||
let local_path: PathBuf = ["target", target_directory, file].into_iter().collect(); | ||
if local_path.exists() { | ||
return local_path; | ||
} | ||
let workspace_path: PathBuf = ["..", "target", target_directory, file] | ||
.into_iter() | ||
.collect(); | ||
if workspace_path.exists() { | ||
return workspace_path; | ||
} | ||
panic!("Could not find {file}"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.