From 481a74eda7d004ec4a9992834d098fc0280d2a36 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 27 Jan 2021 14:21:05 +0100 Subject: Export `CARGO` for proc. macros --- crates/project_model/src/build_data.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/project_model') diff --git a/crates/project_model/src/build_data.rs b/crates/project_model/src/build_data.rs index cf32995e0..3ff347e2c 100644 --- a/crates/project_model/src/build_data.rs +++ b/crates/project_model/src/build_data.rs @@ -175,7 +175,7 @@ fn is_dylib(path: &Path) -> bool { /// Should be synced with fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, String)>) { // FIXME: Missing variables: - // CARGO, CARGO_PKG_HOMEPAGE, CARGO_CRATE_NAME, CARGO_BIN_NAME, CARGO_BIN_EXE_ + // CARGO_PKG_HOMEPAGE, CARGO_CRATE_NAME, CARGO_BIN_NAME, CARGO_BIN_EXE_ let mut manifest_dir = package.manifest_path.clone(); manifest_dir.pop(); @@ -183,6 +183,9 @@ fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, St env.push(("CARGO_MANIFEST_DIR".into(), cargo_manifest_dir.into())); } + // Not always right, but works for common cases. + env.push(("CARGO".into(), "cargo".into())); + env.push(("CARGO_PKG_VERSION".into(), package.version.to_string())); env.push(("CARGO_PKG_VERSION_MAJOR".into(), package.version.major.to_string())); env.push(("CARGO_PKG_VERSION_MINOR".into(), package.version.minor.to_string())); -- cgit v1.2.3