diff options
author | Jonas Schievink <[email protected]> | 2021-01-27 13:21:05 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-01-27 13:25:51 +0000 |
commit | 481a74eda7d004ec4a9992834d098fc0280d2a36 (patch) | |
tree | 787bb42b245b3fca4efa72c9c5c1359ecc86627e /crates/project_model/src | |
parent | 6a6a80eb1fba0f9d206f9384ecb78bf4ac87691e (diff) |
Export `CARGO` for proc. macros
Diffstat (limited to 'crates/project_model/src')
-rw-r--r-- | crates/project_model/src/build_data.rs | 5 |
1 files changed, 4 insertions, 1 deletions
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 { | |||
175 | /// Should be synced with <https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates> | 175 | /// Should be synced with <https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates> |
176 | fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, String)>) { | 176 | fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, String)>) { |
177 | // FIXME: Missing variables: | 177 | // FIXME: Missing variables: |
178 | // CARGO, CARGO_PKG_HOMEPAGE, CARGO_CRATE_NAME, CARGO_BIN_NAME, CARGO_BIN_EXE_<name> | 178 | // CARGO_PKG_HOMEPAGE, CARGO_CRATE_NAME, CARGO_BIN_NAME, CARGO_BIN_EXE_<name> |
179 | 179 | ||
180 | let mut manifest_dir = package.manifest_path.clone(); | 180 | let mut manifest_dir = package.manifest_path.clone(); |
181 | manifest_dir.pop(); | 181 | manifest_dir.pop(); |
@@ -183,6 +183,9 @@ fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, St | |||
183 | env.push(("CARGO_MANIFEST_DIR".into(), cargo_manifest_dir.into())); | 183 | env.push(("CARGO_MANIFEST_DIR".into(), cargo_manifest_dir.into())); |
184 | } | 184 | } |
185 | 185 | ||
186 | // Not always right, but works for common cases. | ||
187 | env.push(("CARGO".into(), "cargo".into())); | ||
188 | |||
186 | env.push(("CARGO_PKG_VERSION".into(), package.version.to_string())); | 189 | env.push(("CARGO_PKG_VERSION".into(), package.version.to_string())); |
187 | env.push(("CARGO_PKG_VERSION_MAJOR".into(), package.version.major.to_string())); | 190 | env.push(("CARGO_PKG_VERSION_MAJOR".into(), package.version.major.to_string())); |
188 | env.push(("CARGO_PKG_VERSION_MINOR".into(), package.version.minor.to_string())); | 191 | env.push(("CARGO_PKG_VERSION_MINOR".into(), package.version.minor.to_string())); |