(serializer: &Path, input: &Path, output: &Path)
| 8146 | } |
| 8147 | |
| 8148 | fn generate_one_aot_artifact(serializer: &Path, input: &Path, output: &Path) -> Result<()> { |
| 8149 | ensure_file(input)?; |
| 8150 | let input = |
| 8151 | fs::canonicalize(input).with_context(|| format!("canonicalize {}", input.display()))?; |
| 8152 | let output = if output.is_absolute() { |
| 8153 | output.to_path_buf() |
| 8154 | } else { |
| 8155 | env::current_dir() |
| 8156 | .context("read current directory")? |
| 8157 | .join(output) |
| 8158 | }; |
| 8159 | if let Some(parent) = output.parent() { |
| 8160 | fs::create_dir_all(parent).with_context(|| format!("create {}", parent.display()))?; |
| 8161 | } |
| 8162 | |
| 8163 | let mut command = Command::new(serializer); |
| 8164 | command |
| 8165 | .args(["aot-serializer", "serialize", "--input"]) |
| 8166 | .arg(&input) |
| 8167 | .arg("--output") |
| 8168 | .arg(output) |
| 8169 | .env("CARGO_INCREMENTAL", "0"); |
| 8170 | if env::var_os("LLVM_SYS_221_PREFIX").is_none() && Path::new("/opt/homebrew/opt/llvm").exists() |
| 8171 | { |
| 8172 | command.env("LLVM_SYS_221_PREFIX", "/opt/homebrew/opt/llvm"); |
| 8173 | } |
| 8174 | configure_windows_llvm_aot_link(&mut command); |
| 8175 | run_command(&mut command) |
| 8176 | .with_context(|| format!("generate AOT artifact for {}", input.display())) |
| 8177 | } |
| 8178 | |
| 8179 | fn configure_windows_llvm_aot_link(command: &mut Command) { |
| 8180 | if !cfg!(windows) { |
no test coverage detected