Avoid spurious build script runs (#4150)
* Don't attempt to track the generated clif.isle in cargo This causes the build script to rerun every time for me. * Put build script debug messages on stderr instead of stdout This keeps stdout reserved for cargo build script directives
This commit is contained in:
@@ -166,6 +166,7 @@ struct IsleCompilations {
|
|||||||
struct IsleCompilation {
|
struct IsleCompilation {
|
||||||
output: std::path::PathBuf,
|
output: std::path::PathBuf,
|
||||||
inputs: Vec<std::path::PathBuf>,
|
inputs: Vec<std::path::PathBuf>,
|
||||||
|
untracked_inputs: Vec<std::path::PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Construct the list of compilations (transformations from ISLE
|
/// Construct the list of compilations (transformations from ISLE
|
||||||
@@ -205,31 +206,31 @@ fn get_isle_compilations(
|
|||||||
IsleCompilation {
|
IsleCompilation {
|
||||||
output: out_dir.join("isle_x64.rs"),
|
output: out_dir.join("isle_x64.rs"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
clif_isle.clone(),
|
|
||||||
prelude_isle.clone(),
|
prelude_isle.clone(),
|
||||||
src_isa_x64.join("inst.isle"),
|
src_isa_x64.join("inst.isle"),
|
||||||
src_isa_x64.join("lower.isle"),
|
src_isa_x64.join("lower.isle"),
|
||||||
],
|
],
|
||||||
|
untracked_inputs: vec![clif_isle.clone()],
|
||||||
},
|
},
|
||||||
// The aarch64 instruction selector.
|
// The aarch64 instruction selector.
|
||||||
IsleCompilation {
|
IsleCompilation {
|
||||||
output: out_dir.join("isle_aarch64.rs"),
|
output: out_dir.join("isle_aarch64.rs"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
clif_isle.clone(),
|
|
||||||
prelude_isle.clone(),
|
prelude_isle.clone(),
|
||||||
src_isa_aarch64.join("inst.isle"),
|
src_isa_aarch64.join("inst.isle"),
|
||||||
src_isa_aarch64.join("lower.isle"),
|
src_isa_aarch64.join("lower.isle"),
|
||||||
],
|
],
|
||||||
|
untracked_inputs: vec![clif_isle.clone()],
|
||||||
},
|
},
|
||||||
// The s390x instruction selector.
|
// The s390x instruction selector.
|
||||||
IsleCompilation {
|
IsleCompilation {
|
||||||
output: out_dir.join("isle_s390x.rs"),
|
output: out_dir.join("isle_s390x.rs"),
|
||||||
inputs: vec![
|
inputs: vec![
|
||||||
clif_isle.clone(),
|
|
||||||
prelude_isle.clone(),
|
prelude_isle.clone(),
|
||||||
src_isa_s390x.join("inst.isle"),
|
src_isa_s390x.join("inst.isle"),
|
||||||
src_isa_s390x.join("lower.isle"),
|
src_isa_s390x.join("lower.isle"),
|
||||||
],
|
],
|
||||||
|
untracked_inputs: vec![clif_isle.clone()],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@@ -276,10 +277,15 @@ fn run_compilation(
|
|||||||
) -> Result<(), Box<dyn std::error::Error + 'static>> {
|
) -> Result<(), Box<dyn std::error::Error + 'static>> {
|
||||||
use cranelift_isle as isle;
|
use cranelift_isle as isle;
|
||||||
|
|
||||||
println!("Rebuilding {}", compilation.output.display());
|
eprintln!("Rebuilding {}", compilation.output.display());
|
||||||
|
|
||||||
let code = (|| {
|
let code = (|| {
|
||||||
let lexer = isle::lexer::Lexer::from_files(&compilation.inputs[..])?;
|
let lexer = isle::lexer::Lexer::from_files(
|
||||||
|
compilation
|
||||||
|
.inputs
|
||||||
|
.iter()
|
||||||
|
.chain(compilation.untracked_inputs.iter()),
|
||||||
|
)?;
|
||||||
let defs = isle::parser::parse(lexer)?;
|
let defs = isle::parser::parse(lexer)?;
|
||||||
|
|
||||||
let mut options = isle::codegen::CodegenOptions::default();
|
let mut options = isle::codegen::CodegenOptions::default();
|
||||||
@@ -355,7 +361,7 @@ fn run_compilation(
|
|||||||
code
|
code
|
||||||
});
|
});
|
||||||
|
|
||||||
println!(
|
eprintln!(
|
||||||
"Writing ISLE-generated Rust code to {}",
|
"Writing ISLE-generated Rust code to {}",
|
||||||
compilation.output.display()
|
compilation.output.display()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ impl Formatter {
|
|||||||
let path_str = format!("{}/{}", directory, filename.as_ref());
|
let path_str = format!("{}/{}", directory, filename.as_ref());
|
||||||
|
|
||||||
let path = path::Path::new(&path_str);
|
let path = path::Path::new(&path_str);
|
||||||
println!("Writing generated file: {}", path.display());
|
eprintln!("Writing generated file: {}", path.display());
|
||||||
let mut f = fs::File::create(path)?;
|
let mut f = fs::File::create(path)?;
|
||||||
|
|
||||||
for l in self.lines.iter().map(|l| l.as_bytes()) {
|
for l in self.lines.iter().map(|l| l.as_bytes()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user