-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add build.rs to include README.md in workspace Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Deny unsafe for good measures Signed-off-by: Oliver Tale-Yazdi <[email protected]> --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]>
- Loading branch information
Showing
3 changed files
with
18 additions
and
2 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 |
---|---|---|
|
@@ -7,7 +7,7 @@ authors = ["Oliver Tale-Yazdi <[email protected]>"] | |
description = "Emit warnings from inside proc macros." | ||
repository = "https://github.com/ggwpez/proc-macro-warning" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
build = "build.rs" | ||
|
||
[dependencies] | ||
proc-macro2 = { version = "1.0.56", default-features = false } | ||
|
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,15 @@ | ||
// Only needed to find the README to use `include_str!` on it. | ||
|
||
fn main() { | ||
// Go upwards until we find a README.md | ||
let mut path = std::env::current_dir().unwrap(); | ||
while !path.join("README.md").exists() { | ||
path = path.parent().unwrap().to_path_buf(); | ||
} | ||
path = path.join("README.md"); | ||
// Sanity check that it contains the string "Proc Macro Warning". | ||
let contents = std::fs::read_to_string(&path).unwrap(); | ||
assert!(contents.contains("Proc Macro Warning")); | ||
|
||
println!("cargo:rustc-env=README_PATH={}", path.display()); | ||
} |
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