uudoc: require a feature to build

This is used to not build uudoc by default. See https://github.com/uutils/coreutils/issues/3411
This commit is contained in:
Terts Diepraam 2022-04-24 23:18:04 +02:00 committed by Sylvestre Ledru
parent 91ccdb6479
commit a10f234854
2 changed files with 5 additions and 2 deletions

View file

@ -254,6 +254,7 @@ feat_os_windows_legacy = [
##
# * bypass/override ~ translate 'test' feature name to avoid dependency collision with rust core 'test' crate (o/w surfaces as compiler errors during testing)
test = [ "uu_test" ]
uudoc = [ "zip" ]
[workspace]
@ -265,7 +266,7 @@ lazy_static = { version="1.3" }
textwrap = { version="0.15", features=["terminal_size"] }
uucore = { version=">=0.0.11", package="uucore", path="src/uucore" }
selinux = { version="0.2", optional = true }
zip = { version = "0.6.0", default_features=false, features=["deflate"] }
zip = { version = "0.6.0", optional=true, default_features=false, features=["deflate"] }
# * uutils
uu_test = { optional=true, version="0.0.13", package="uu_test", path="src/uu/test" }
#
@ -415,3 +416,4 @@ path = "src/bin/coreutils.rs"
[[bin]]
name = "uudoc"
path = "src/bin/uudoc.rs"
required-features = ["uudoc"]

View file

@ -28,8 +28,9 @@ pub fn main() {
if val == "1" && key.starts_with(ENV_FEATURE_PREFIX) {
let krate = key[ENV_FEATURE_PREFIX.len()..].to_lowercase();
match krate.as_ref() {
"default" | "macos" | "unix" | "windows" | "selinux" => continue, // common/standard feature names
"default" | "macos" | "unix" | "windows" | "selinux" | "zip" => continue, // common/standard feature names
"nightly" | "test_unimplemented" => continue, // crate-local custom features
"uudoc" => continue, // is not a utility
"test" => continue, // over-ridden with 'uu_test' to avoid collision with rust core crate 'test'
s if s.starts_with(FEATURE_PREFIX) => continue, // crate feature sets
_ => {} // util feature name