Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize workspace deps and reenable default features where appropriate #4844

Merged
merged 10 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 47 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -209,65 +209,87 @@ diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat.git", rev
diplomat_core = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "3167e39e89ae612233706f1ade3d9e8a5c6ad358" }
diplomat-tool = { git = "https://github.com/rust-diplomat/diplomat.git", rev = "3167e39e89ae612233706f1ade3d9e8a5c6ad358" }

# External deps from crates.io
bincode = { version = "1.3.1", default-features = false }
clap = { version = "4.2.0", default-features = false }
combine = { version = "4.3.1", default-features = false }
# EXTERNAL DEPENDENCIES
#
# Due to semver-related constraints, we generally want to consume crates.io dependencies with
# default features, with some notable exceptions:
#
# 1. Dependencies of core library crates need to be `no_std`
# 2. Some crates have a lot of default features that pull in undesirable transitive deps
#
# We therefore have three groups for our crates.io dependencies.

## External Deps Group 1: Library deps except datagen. No default features.
# Keep in sync with allowlist.rs:
# BASIC_RUNTIME_DEPS
# BASIC_BUILD_DEPS
# EXTRA_SERDE_DEPS
# EXTRA_EXPERIMENTAL_DEPS
# EXTRA_LSTM_DEPS
# EXTRA_RYU_DEPS
# EXTRA_CAPI_DEPS
# EXTRA_BLOB_DEPS
# EXTRA_FS_DEPS
core_maths = { version = "0.1.0", default-features = false }
displaydoc = { version = "0.2.3", default-features = false }
either = { version = "1.9.0", default-features = false }
elsa = { version = "1.10.0", default-features = false }
erased-serde = { version = "0.3.11", default-features = false }
eyre = { version = "0.6.0", default-features = false }
indexmap = { version = "1.0.0", default-features = false }
itertools = { version = "0.10.3", default-features = false}
libc_alloc = { version = "1.0.6", default-features = false }
log = { version = "0.4.17", default-features = false }
memchr = { version = "2.6.0", default-features = false }
ndarray = { version = "0.15.0", default-features = false }
nom = { version = "7.0.0", default-features = false }
num-bigint = { version = "0.4.3", default-features = false }
num-rational = { version = "0.4.0", default-features = false }
num-traits = { version = "0.2.0", default-features = false }
once_cell = {version = "1.15.0", default-features = false}
postcard = { version = "1.0.1", default-features = false }
proc-macro2 = { version = "1.0.61", default-features = false }
quote = { version = "1.0.28", default-features = false }
rayon = { version = "1.3.0", default-features = false }
regex-automata = { version = "0.2.0", default-features = false }
ryu = { version = "1.0.5", default-features = false }
serde = { version = "1.0.110", default-features = false }
serde_json = { version = "1.0.45", default-features = false, features = ["alloc"] } # requires either alloc or std to build
serde-aux = { version = "4.0.0", default-features = false }
serde-json-core = { version = "0.4.0", default-features = false }
simple_logger = { version = "4.0.0", default-features = false }
smallvec = { version = "1.10.0", default-features = false }
stable_deref_trait = { version = "1.2.0", default-features = false }
syn = { version = "2.0.21", default-features = false }
synstructure = { version = "0.13.0", default-features = false }
toml = { version = "0.5.8", default-features = false }
twox-hash = { version = "1.4.2", default-features = false }
unicode-bidi = { version = "0.3.11", default-features = false }
ureq = { version = "2.3.0", default-features = false }
utf16_iter = { version = "1.0.2", default-features = false }
utf8_iter = { version = "1.0.2", default-features = false }
wasmi = { version = "0.31.2", default-features = false }
write16 = { version = "1.0.0", default-features = false }

## External Deps Group 2: Heavy Dev and Datagen deps. No default features.
zip = { version = "0.6.0", default-features = false }
serde-aux = { version = "4.0.0", default-features = false }

## Dev only
## External Deps Group 3: Dev and Datagen deps. Include default features.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did prefer the split between dev deps and non-dev deps. For example this looks like datagen depends on rkyv, so someone might introduce the dep somewhere else.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll land this because it fixes problems and is likely to bitrot, and if you want to propose a different organization you're welcome to do so

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I had this different organisation before

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You had "deps" and "dev deps" , but you didn't distinguish lib deps from datagen deps

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example this looks like datagen depends on rkyv, so someone might introduce the dep somewhere else.

I consider depcheck allowlist.rs to be the source of truth for what depends on what.

arraystring = "0.3.0"
arrayvec = "0.7.2"
atoi = "1.0.0"
bincode = "1.3.1"
clap = "4.2.0"
combine = "4.3.1"
criterion = "0.5.0"
detone = "1.0.0"
elsa = "1.10.0"
erased-serde = "0.3.11"
eyre = "0.6.0"
getrandom = "0.2"
iai = "0.1.1"
indexmap = "1.0.0"
itertools = "0.10.3"
ndarray = "0.15.0"
nom = "7.0.0"
once_cell = "1.15.0"
proc-macro2 = "1.0.61"
quote = "1.0.28"
rand = "0.8"
rand_distr = "0.4"
rand_pcg = "0.3"
rayon = "1.3.0"
rkyv = "0.7"
serde_json = "1.0.45"
simple_logger = "4.0.0"
syn = "2.0.21"
synstructure = "0.13.0"
toml = "0.5.8"
twox-hash = "1.4.2"
ureq = "2.3.0"
walkdir = "2.3.2"
wasmi = "0.31.2"

# Size optimized builds
[profile.release-opt-size]
Expand Down
2 changes: 1 addition & 1 deletion provider/core/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ proc-macro = true
[dependencies]
proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true, features = ["full", "parsing", "proc-macro", "printing", "derive"]}
syn = { workspace = true }

[dev-dependencies]
icu_provider = { path = ".." }
8 changes: 4 additions & 4 deletions provider/datagen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ zerovec = { workspace = true, features = ["serde", "yoke"], optional = true }
## External dependencies
either = { workspace = true, optional = true }
elsa = { workspace = true, optional = true }
itertools = { workspace = true, features = ["use_alloc"], optional = true }
itertools = { workspace = true, optional = true }
ndarray = { workspace = true, optional = true }
num-bigint = { workspace = true, optional = true }
num-rational = { workspace = true, optional = true }
Expand All @@ -92,12 +92,12 @@ serde_json = { workspace = true, optional = true }
serde-aux = { workspace = true, optional = true }
toml = { workspace = true, optional = true }
twox-hash = { workspace = true, optional = true }
ureq = { workspace = true, features = ["tls"], optional = true }
ureq = { workspace = true, optional = true }
zip = { workspace = true, features = ["deflate"], optional = true }

# "bin" feature
clap = { workspace = true, optional = true, features = ["derive", "std"] }
eyre = { workspace = true, optional = true, features = ["default"] }
clap = { workspace = true, optional = true, features = ["derive"] }
eyre = { workspace = true, optional = true }
simple_logger = { workspace = true, optional = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion tools/benchmark/memory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ edition = "2021"

[dependencies]
serde_json = { workspace = true }
clap = { workspace = true, features = ["derive", "std"] }
clap = { workspace = true, features = ["derive"] }
libc = "0.2"
18 changes: 18 additions & 0 deletions tools/depcheck/src/allowlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
/// Dependencies that are always allowed as runtime dependencies
/// In general it is fine to add new ICU4X components or utils here
/// For other crates, please get approval from @unicode-org/icu4x-owners
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const BASIC_RUNTIME_DEPS: &[&str] = &[
// ICU4X components
"icu",
Expand Down Expand Up @@ -67,6 +69,8 @@ pub const BASIC_BUILD_DEPS: &[&str] = &[

/// Dependencies allowed when opting in to serialization
/// This should almost never change
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const EXTRA_SERDE_DEPS: &[&str] = &["deduplicating_array", "serde", "serde_derive"];

/// Dependencies allowed when opting in to compiled data
Expand All @@ -87,6 +91,8 @@ pub const EXTRA_DATA_DEPS: &[&str] = &[

/// Dependencies allowed when opting in to experimental code
/// This will likely grow when we add experimental crates
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const EXTRA_EXPERIMENTAL_DEPS: &[&str] = &[
"icu_experimental",
"icu_pattern",
Expand All @@ -101,14 +107,20 @@ pub const EXTRA_EXPERIMENTAL_DEPS: &[&str] = &[
pub const EXTRA_EXPERIMENTAL_DATA_DEPS: &[&str] = &["icu_experimental_data"];

/// Dependencies allowed when opting in to LSTM segmenter
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const EXTRA_LSTM_DEPS: &[&str] = &[];

/// Dependencies allowed when opting in to fixed_decimal's `ryu` backend
/// This should never change
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const EXTRA_RYU_DEPS: &[&str] = &["ryu"];

/// Runtime dependencies allowed when building `icu_capi`
/// This shuld almost never change
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const EXTRA_CAPI_DEPS: &[&str] = &[
"diplomat-runtime",
"icu_capi",
Expand All @@ -128,10 +140,14 @@ pub const EXTRA_CAPI_BUILD_DEPS: &[&str] = &[

/// Dependencies allowed when opting in to blob providers on FFI
/// This shuld rarely change
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const EXTRA_BLOB_DEPS: &[&str] = &["cobs", "icu_provider_blob", "postcard"];

/// Dependencies allowed when opting in to FS providers on FFI
/// This shuld rarely change
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const EXTRA_FS_DEPS: &[&str] = &["icu_provider_fs", "serde-json-core"];

/// Dependencies needed by datagen (not counting `log`, `zip`, and `rayon` deps)
Expand Down Expand Up @@ -166,6 +182,8 @@ pub const EXTRA_DATAGEN_DEPS: &[&str] = &[

/// Dependencies needed by the `log` crate
/// This should rarely change, and if it does consider toggling features until it doesn't
///
/// Keep in sync with Cargo.toml crates.io dependencies.
pub const EXTRA_LOGGING_DEPS: &[&str] = &["cfg-if", "log"];

/// Dependencies needed by the `zip` crate
Expand Down
6 changes: 3 additions & 3 deletions tools/testdata-scripts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ icu_datagen = { workspace = true, features = ["legacy_api", "use_wasm", "network
icu_locid = { workspace = true, features = ["databake"] }
icu_provider = { workspace = true }

clap = { workspace = true, features = ["derive", "std"] }
eyre = { workspace = true, features = ["default"]}
clap = { workspace = true, features = ["derive"] }
eyre = { workspace = true }
log = { workspace = true }
quote = { workspace = true }
simple_logger = { workspace = true }
ureq = { workspace = true, features = ["tls"] }
ureq = { workspace = true }
zip = { workspace = true, features = ["deflate"] }
2 changes: 1 addition & 1 deletion utils/bies/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ independent = true
all-features = true

[dependencies]
itertools = { workspace = true, features = ["use_alloc"] }
itertools = { workspace = true }
partial-min-max = "0.4"
strum = { version = "0.20", features = ["derive"] }
writeable = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion utils/databake/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ path = "src/lib.rs"
[dependencies]
proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true, features = ["derive", "fold", "proc-macro", "parsing"] }
syn = { workspace = true }
synstructure = { workspace = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion utils/resb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ all-features = true
[dependencies]
indexmap = { workspace = true, optional = true }
log = { workspace = true, optional = true }
nom = { workspace = true, features = ["default"], optional = true }
nom = { workspace = true, optional = true }
serde = { workspace = true, features = ["alloc"]}

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion utils/tinystr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ databake = { workspace = true, optional = true }
[dev-dependencies]
bincode = { workspace = true }
postcard = { workspace = true, features = ["use-std"] }
rand = { workspace = true, features = ["small_rng"] }
rand = { workspace = true }
serde_json = { workspace = true, features = ["alloc"] }

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion utils/tzif/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rust-version.workspace = true
independent = true

[dependencies]
combine= { workspace = true, features = ["default"] }
combine = { workspace = true }

[dev-dependencies]
walkdir = { workspace = true }
2 changes: 1 addition & 1 deletion utils/yoke/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ path = "src/lib.rs"
[dependencies]
proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true, features = ["derive", "fold", "proc-macro", "parsing"] }
syn = { workspace = true, features = ["fold"] }
synstructure = { workspace = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion utils/zerofrom/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ path = "src/lib.rs"
[dependencies]
proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true, features = ["derive", "fold", "visit", "proc-macro", "parsing"] }
syn = { workspace = true, features = ["fold"] }
synstructure = { workspace = true }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion utils/zerovec/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ path = "src/lib.rs"
[dependencies]
proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true, features = ["derive", "parsing", "extra-traits", "proc-macro", "printing", "clone-impls"] }
syn = { workspace = true, features = ["extra-traits"]}

[dev-dependencies]
zerovec = { path = "..", features = ["serde", "derive"] }
Expand Down