diff --git a/Cargo.toml b/Cargo.toml index a4b2454d3..c81f3946c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -210,6 +210,9 @@ feat_os_windows_legacy = [ "touch", "whoami", ] +## +# * bypass ~ use "uu_" prefix to avoid collision with rust core 'test' crate (o/w surfaces as compiler errors during testing) +test = [ "uu_test" ] [workspace] @@ -218,6 +221,8 @@ lazy_static = { version="1.3" } textwrap = { version="=0.11.0", features=["term_size"] } # !maint: [2020-05-10; rivy] unstable crate using undocumented features; pinned currently, will review uucore = { version="0.0.2", package="uucore", git="https://github.com/uutils/uucore.git", branch="master" } # * uutils +uu_test = { optional=true, version="0.0.1", package="uu_test", path="src/uu/test" } +# arch = { optional=true, version="0.0.1", package="uu_arch", path="src/uu/arch" } base32 = { optional=true, version="0.0.1", package="uu_base32", path="src/uu/base32" } base64 = { optional=true, version="0.0.1", package="uu_base64", path="src/uu/base64" } @@ -294,7 +299,6 @@ sync = { optional=true, version="0.0.1", package="uu_sync", path="src/uu/syn tac = { optional=true, version="0.0.1", package="uu_tac", path="src/uu/tac" } tail = { optional=true, version="0.0.1", package="uu_tail", path="src/uu/tail" } tee = { optional=true, version="0.0.1", package="uu_tee", path="src/uu/tee" } -test = { optional=true, version="0.0.1", package="uu_test", path="src/uu/test" } timeout = { optional=true, version="0.0.1", package="uu_timeout", path="src/uu/timeout" } touch = { optional=true, version="0.0.1", package="uu_touch", path="src/uu/touch" } tr = { optional=true, version="0.0.1", package="uu_tr", path="src/uu/tr" } diff --git a/build.rs b/build.rs index c51ce1481..4dcac8111 100644 --- a/build.rs +++ b/build.rs @@ -68,6 +68,7 @@ pub fn main() { | "yes" | "false" | "true" | "hashsum" + | "uu_test" => { // cf.write_all(format!("extern crate {krate};\n", krate = krate).as_bytes()) // .unwrap(); @@ -79,6 +80,14 @@ pub fn main() { } match krate.as_ref() { + // * use "uu_" prefix as bypass method to avoid name collisions with imported crates, when necessary (eg, 'test') + k if k.starts_with("uu_") + => mf + .write_all( + format!("map.insert(\"{k}\", {krate}::uumain);\n", k = krate.clone().remove("uu_".len()), krate = krate) + .as_bytes(), + ) + .unwrap(), "arch" | "base32" | "base64" | "basename" | "cat" | "chgrp" | "chmod" | "chown" | "chroot" | "cksum" | "comm" | "cp" | "cut" @@ -97,7 +106,7 @@ pub fn main() { | "paste" | "pathchk" | "pinky" | "printenv" | "printf" | "ptx" | "pwd" | "readlink" | "realpath" | "relpath" | "rm" | "rmdir" | "seq" | "shred" | "shuf" | "sleep" | "sort" | "split" | "stat" | "stdbuf" | "sum" | "sync" - | "tac" | "tail" | "tee" | "test" | "timeout" | "touch" | "tr" | "truncate" | "tsort" | "tty" + | "tac" | "tail" | "tee" | "timeout" | "touch" | "tr" | "truncate" | "tsort" | "tty" | "uname" | "unexpand" | "uniq" | "unlink" | "uptime" | "users" | "wc" | "who" | "whoami" | "yes"