Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion wild/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,7 @@ fn build_obj(
output_path.clone()
};

if is_newer(&output_file, deps.iter()) {
if command_line_unchanged(&command, &output_file) && is_newer(&output_file, deps.iter()) {
return Ok(BuiltObject {
path: output_path,
inputs,
Expand All @@ -2295,6 +2295,8 @@ fn build_obj(
);
}

write_cmd_file(&command, &output_file)?;

if needs_run_with {
post_process_rust_run_script(&output_path).with_context(|| {
format!(
Expand All @@ -2312,6 +2314,26 @@ fn build_obj(
})
}

fn cmd_path(output_path: &Path) -> PathBuf {
add_to_path(output_path, ".cmd")
}

/// Returns whether the command-line used to produce `output_path` is the same as previously used.
fn command_line_unchanged(command: &Command, output_path: &Path) -> bool {
let cmd_path = cmd_path(output_path);
if let Ok(existing_cmd) = std::fs::read_to_string(&cmd_path) {
existing_cmd == command_as_str(command)
} else {
false
}
}

fn write_cmd_file(command: &Command, output_file: &Path) -> Result {
let cmd_path = cmd_path(output_file);
std::fs::write(&cmd_path, command_as_str(command))?;
Ok(())
}

/// Verifies that if we've created or considered creating `output_path` previously in this process,
/// that it was with the same command-line.
fn verify_path_unique_for_args(output_path: &Path, command: &Command) -> Result {
Expand Down
Loading