|
32 | 32 | //! [instructions]: https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script
|
33 | 33 |
|
34 | 34 | use super::{fingerprint, BuildRunner, Job, Unit, Work};
|
35 |
| -use crate::core::compiler::artifact; |
36 | 35 | use crate::core::compiler::build_runner::Metadata;
|
37 | 36 | use crate::core::compiler::fingerprint::DirtyReason;
|
38 | 37 | use crate::core::compiler::job_queue::JobState;
|
| 38 | +use crate::core::compiler::{artifact, CompileKind}; |
39 | 39 | use crate::core::{profiles::ProfileRoot, PackageId, Target};
|
40 | 40 | use crate::util::errors::CargoResult;
|
41 | 41 | use crate::util::internal;
|
@@ -277,10 +277,17 @@ fn build_work(build_runner: &mut BuildRunner<'_, '_>, unit: &Unit) -> CargoResul
|
277 | 277 | let to_exec = to_exec.into_os_string();
|
278 | 278 | let mut cmd = build_runner.compilation.host_process(to_exec, &unit.pkg)?;
|
279 | 279 | let debug = unit.profile.debuginfo.is_turned_on();
|
| 280 | + let target_is_json = // TODO: fix it after #14197 merged, use `unit.kind.has_json_ext_ignore_case` |
| 281 | + matches!(unit.kind, CompileKind::Target(ct) if ct.rustc_target().ends_with(".json")); |
| 282 | + |
280 | 283 | cmd.env("OUT_DIR", &script_out_dir)
|
281 | 284 | .env("CARGO_MANIFEST_DIR", unit.pkg.root())
|
282 | 285 | .env("NUM_JOBS", &bcx.jobs().to_string())
|
283 | 286 | .env("TARGET", bcx.target_data.short_name(&unit.kind))
|
| 287 | + .env( |
| 288 | + "TARGET_IS_CUSTOM", |
| 289 | + target_is_json.then_some("1").unwrap_or_default(), |
| 290 | + ) |
284 | 291 | .env("DEBUG", debug.to_string())
|
285 | 292 | .env("OPT_LEVEL", &unit.profile.opt_level)
|
286 | 293 | .env(
|
|
0 commit comments