-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the 'dev-why3' binary by 'dev-env' which sets shell environme…
…nt variables This is strictly more flexible: instead of requiring the use of a custom why3 wrapper, we provide a way to setup a shell environment where `why3` resolves to the correct binary, and WHY3CONFIG indicates the config file. This will then "just work" for binaries such as why3_tools that link to the why3 api, since they will pick up WHY3CONFIG.
- Loading branch information
Showing
7 changed files
with
44 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ edition = "2021" | |
[dependencies] | ||
creusot-setup = { path = "../creusot-setup" } | ||
anyhow = "1.0" | ||
which = "6.0" |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use anyhow::anyhow; | ||
use std::{env, path::PathBuf}; | ||
use which::which; | ||
|
||
pub fn main() -> anyhow::Result<()> { | ||
let paths = creusot_dev_config::paths()?; | ||
|
||
let why3_path = which(&paths.why3)?; | ||
eprintln!("Using Why3 at: {}", &why3_path.display()); | ||
let why3_dir = PathBuf::from(&why3_path.parent().ok_or(anyhow!("finding why3's location"))?); | ||
let new_path = match env::var_os("PATH") { | ||
Some(path) => { | ||
let mut path_elts = env::split_paths(&path).collect::<Vec<_>>(); | ||
path_elts.insert(0, why3_dir); | ||
env::join_paths(path_elts)? | ||
} | ||
None => env::join_paths([why3_dir].iter())?, | ||
}; | ||
println!("PATH={:?}; export PATH;", &new_path); | ||
|
||
if let Some(config) = &paths.why3_config { | ||
eprintln!("Using Why3 config at: {}", config.display()); | ||
println!("WHY3CONFIG='{}'; export WHY3CONFIG;", &config.display()); | ||
} | ||
Ok(()) | ||
} |
This file was deleted.
Oops, something went wrong.
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,4 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTPATH=$(dirname "$BASH_SOURCE") | ||
cargo run --bin dev-why3 -- --warn-off=unused_variable --warn-off=clone_not_abstract --warn-off=axiom_abstract ide -L $SCRIPTPATH/prelude $@ | ||
eval $(cargo run --bin dev-env) | ||
why3 --warn-off=unused_variable --warn-off=clone_not_abstract --warn-off=axiom_abstract ide -L $SCRIPTPATH/prelude $@ |