(path_to_cargo_folder: &Path)
| 111 | } |
| 112 | |
| 113 | fn compile_locally(path_to_cargo_folder: &Path) -> Result<(), Box<dyn std::error::Error>> { |
| 114 | let target = local_build_target(); |
| 115 | let manifest = path_to_cargo_folder.join("Cargo.toml"); |
| 116 | let mut cmd = Command::new("cargo"); |
| 117 | |
| 118 | if cfg!(not(target_os = "windows")) { |
| 119 | cmd.env("CFLAGS", "-lrt"); |
| 120 | cmd.env("LDFLAGS", "-lrt"); |
| 121 | } |
| 122 | |
| 123 | let output = cmd |
| 124 | .env("RUSTFLAGS", "-C target-feature=+crt-static") |
| 125 | .args(["build", "--release", "--manifest-path"]) |
| 126 | .arg(&manifest) |
| 127 | .args(["--target", target]) |
| 128 | .output()?; |
| 129 | |
| 130 | if !output.status.success() { |
| 131 | let err = String::from_utf8_lossy(&output.stderr); |
| 132 | eprintln!("{}", err); |
| 133 | return Err(format!("Compilation failed: {}", output.status).into()); |
| 134 | } |
| 135 | |
| 136 | if !output.stderr.is_empty() { |
| 137 | let warnings = String::from_utf8_lossy(&output.stderr); |
| 138 | println!("{}", warnings); |
| 139 | } |
| 140 | |
| 141 | Ok(()) |
| 142 | } |
| 143 | |
| 144 | fn run_compiler(path_to_cargo_folder: &Path) -> Result<(), Box<dyn std::error::Error>> { |
| 145 | if is_running_in_container() { |
no test coverage detected