Skip to content

Commit

Permalink
add env_var output for cargo:rustc-env (see rust-lang/cargo#3929)
Browse files Browse the repository at this point in the history
  • Loading branch information
durka committed May 24, 2017
1 parent 343aa7f commit 794fb51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ output!(/// Pass a library search path to the compiler as a `-L` flag
output!(/// Pass a cfg flag to the compiler
fn cfg, "rustc-cfg", &str);

output!(/// Set a variable in the compiler's environment
fn env_var, "rustc-env", &str, &str);

output!(/// Specify a file or directory whose timestamp will trigger a rerun of the build script
/// (note: to recursively track a directory, see `rerun_walk`)
fn rerun, "rerun-if-changed", <&Path>);
Expand Down
1 change: 1 addition & 0 deletions tests/foo/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fn main() {
link_lib(LibKind::Dylib, Path::new("whatever"));
link_search(SearchKind::All, Path::new("wherever"));
cfg("whoever");
env_var("FOO", "foo");
rerun(Path::new("whichever"));
rerun_walk(Path::new("src"), |_| true);
warning("success");
Expand Down
1 change: 1 addition & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ fn test() {
cargo:rustc-link-lib=dylib=whatever
cargo:rustc-link-search=all=wherever
cargo:rustc-cfg=whoever
cargo:rustc-env=FOO=foo
cargo:rerun-if-changed=whichever
cargo:rerun-if-changed=src
cargo:rerun-if-changed=src/lib.rs
Expand Down

0 comments on commit 794fb51

Please sign in to comment.