mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
Fix namespace collision for test.
To avoid linking issues with Rust's libtest, the crate for the test utility was changed to 'uutest'. However, the user doesn't need to see this so a few hoops were jumped through to make this transparent. I also updated the make rules to build the individual features first and then uutils. This makes 'make && make test' look more organized.
This commit is contained in:
parent
cfadcfaf64
commit
d4e0ea41a3
6 changed files with 19 additions and 30 deletions
14
build.rs
14
build.rs
|
@ -29,8 +29,7 @@ pub fn main() {
|
|||
let mut map: UtilityMap = HashMap::new();\n".as_bytes()).unwrap();
|
||||
for krate in crates {
|
||||
match krate.as_ref() {
|
||||
"false" => {},
|
||||
"true" => {},
|
||||
"false" | "true" | "test" => {},
|
||||
_ => cf.write_all(format!("extern crate {krate} as uu{krate};\n", krate=krate).as_bytes()).unwrap(),
|
||||
}
|
||||
|
||||
|
@ -44,12 +43,11 @@ pub fn main() {
|
|||
map.insert(\"sha384sum\", uuhashsum::uumain);
|
||||
map.insert(\"sha512sum\", uuhashsum::uumain);\n".as_bytes()).unwrap();
|
||||
},
|
||||
"false" =>
|
||||
mf.write_all("fn uufalse(_: Vec<String>) -> i32 { 1 }
|
||||
map.insert(\"false\", uufalse as fn(Vec<String>) -> i32);\n".as_bytes()).unwrap(),
|
||||
"true" =>
|
||||
mf.write_all("fn uutrue(_: Vec<String>) -> i32 { 0 }
|
||||
map.insert(\"true\", uutrue as fn(Vec<String>) -> i32);\n".as_bytes()).unwrap(),
|
||||
"false" | "true" | "test" => {
|
||||
mf.write_all(format!("fn uu{}", krate).as_bytes()).unwrap();
|
||||
mf.write_all("(_: Vec<String>) -> i32 { 1 }\n".as_bytes()).unwrap();
|
||||
mf.write_all(format!("map.insert(\"{krate}\", uu{krate} as fn(Vec<String>) -> i32);\n", krate=krate).as_bytes()).unwrap();
|
||||
},
|
||||
_ =>
|
||||
mf.write_all(format!("map.insert(\"{krate}\", uu{krate}::uumain as fn(Vec<String>) -> i32);\n", krate= krate).as_bytes()).unwrap(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue