Skip to content

Commit 0c84696

Browse files
authored
ci: generate a list of generated files (#10267)
* ci: generate a list of generated files This fix is necessary for Windows users who may be using absolute-path target directories: the previous solution, separating the paths by `:`, runs into issues with Windows absolute paths (e.g., `C:\...`). This change is similar to #10266 but should avoid any further OS compatibility issues during a hypothetical cross-compilation. prtest:full * fix: debug string
1 parent 253579a commit 0c84696

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

cranelift/assembler-x64/build.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use cranelift_assembler_x64_meta as meta;
22
use std::env;
3+
use std::fs::File;
4+
use std::io::Write;
35
use std::path::Path;
46

57
fn main() {
@@ -13,12 +15,12 @@ fn main() {
1315
meta::generate_isle_definitions(out_dir.join("assembler-definitions.isle")),
1416
];
1517

16-
println!(
17-
"cargo:rustc-env=ASSEMBLER_BUILT_FILES={}",
18-
built_files
19-
.iter()
20-
.map(|p| p.to_string_lossy().to_string())
21-
.collect::<Vec<_>>()
22-
.join(":")
23-
);
18+
// Generating this additional bit of Rust is necessary for listing the
19+
// generated files.
20+
let mut vec_of_built_files = File::create(out_dir.join("generated-files.rs")).unwrap();
21+
writeln!(vec_of_built_files, "vec![").unwrap();
22+
for file in &built_files {
23+
writeln!(vec_of_built_files, " {:?}.into(),", file.display()).unwrap();
24+
}
25+
writeln!(vec_of_built_files, "]").unwrap();
2426
}

cranelift/assembler-x64/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,5 @@ pub use rex::RexFlags;
8181

8282
/// List the files generated to create this assembler.
8383
pub fn generated_files() -> Vec<std::path::PathBuf> {
84-
env!("ASSEMBLER_BUILT_FILES")
85-
.split(':')
86-
.map(std::path::PathBuf::from)
87-
.collect()
84+
include!(concat!(env!("OUT_DIR"), "/generated-files.rs"))
8885
}

0 commit comments

Comments
 (0)