mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
feat(build-rs): Add cargo_manifest_path
This commit is contained in:
parent
4ff0809afd
commit
611ec991fb
@ -47,6 +47,7 @@ fn smoke_test_inputs() {
|
|||||||
dbg!(cargo_encoded_rustflags());
|
dbg!(cargo_encoded_rustflags());
|
||||||
dbg!(cargo_feature("unstable"));
|
dbg!(cargo_feature("unstable"));
|
||||||
dbg!(cargo_manifest_dir());
|
dbg!(cargo_manifest_dir());
|
||||||
|
dbg!(cargo_manifest_path());
|
||||||
dbg!(cargo_manifest_links());
|
dbg!(cargo_manifest_links());
|
||||||
dbg!(cargo_pkg_authors());
|
dbg!(cargo_pkg_authors());
|
||||||
dbg!(cargo_pkg_description());
|
dbg!(cargo_pkg_description());
|
||||||
|
@ -29,6 +29,18 @@ pub fn cargo_manifest_dir() -> PathBuf {
|
|||||||
to_path(var_or_panic("CARGO_MANIFEST_DIR"))
|
to_path(var_or_panic("CARGO_MANIFEST_DIR"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The path to the manifest of your package.
|
||||||
|
#[track_caller]
|
||||||
|
pub fn cargo_manifest_path() -> PathBuf {
|
||||||
|
var_os("CARGO_MANIFEST_PATH")
|
||||||
|
.map(to_path)
|
||||||
|
.unwrap_or_else(|| {
|
||||||
|
let mut path = cargo_manifest_dir();
|
||||||
|
path.push("Cargo.toml");
|
||||||
|
path
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// The manifest `links` value.
|
/// The manifest `links` value.
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn cargo_manifest_links() -> Option<String> {
|
pub fn cargo_manifest_links() -> Option<String> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user