mirror of
https://github.com/uutils/coreutils
synced 2024-10-01 13:35:03 +00:00
change ~ add work-around for crate name collisions
- imported crate name collisions bypass implemented ## [why] There may be some core or external crates required/used by this project that collide with uutil names. For example, the `test` util collides with the rust core crate 'test' which is used behind the scenes for testing. Without the renaming scheme used here, cryptic and fatal compiler errors occur when compiling the integration tests.
This commit is contained in:
parent
db2e950918
commit
f051f62445
|
@ -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" }
|
||||
|
|
11
build.rs
11
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"
|
||||
|
|
Loading…
Reference in a new issue