-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add crate for testing build configs (#2326)
I intend to publish this to crates.io after review. This will be used to test #2312.
- Loading branch information
1 parent
4cdada1
commit 233bb35
Showing
5 changed files
with
33 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "test_data_passing_crate" | ||
description = "Used by https://github.com/bazelbuild/rules_rust to test cargo emulation" | ||
version = "0.1.0" | ||
edition = "2021" | ||
repository = "https://github.com/bazelbuild/rules_rust" |
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,3 @@ | ||
# test_data_passing_crate | ||
|
||
This crate exists, and is published to crates.io, so that we can write tests for crate_universe which assert over what opt level and OUT_DIR were used when third-party crates from crates.io were being built. |
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,10 @@ | ||
fn main() { | ||
println!( | ||
"cargo:rustc-env=BUILD_SCRIPT_OPT_LEVEL={}", | ||
std::env::var("OPT_LEVEL").unwrap() | ||
); | ||
println!( | ||
"cargo:rustc-env=BUILD_SCRIPT_OUT_DIR={}", | ||
std::env::var("OUT_DIR").unwrap() | ||
); | ||
} |
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,7 @@ | ||
pub const fn get_opt_level() -> &'static str { | ||
env!("BUILD_SCRIPT_OPT_LEVEL") | ||
} | ||
|
||
pub const fn get_out_dir() -> &'static str { | ||
env!("BUILD_SCRIPT_OUT_DIR") | ||
} |