Do not depend on android-tzdata if the clock feature is not enabled

All usages of `android-tzdata` types are within the `offset::local`
module, but such module is not built if the `clock` feature is not
enabled. Therefore, `android-tzdata` is effectively an unused dependency
when the `clock` feature is disabled.

To avoid downloading unnecessary crates on build time, let's make the
dependency on `android-tzdata` conditional on enabling the `clock`
feature, as it was done with e.g. `iana-time-zone`.
This commit is contained in:
Alejandro González 2023-08-21 15:03:32 +02:00 committed by Dirkjan Ochtman
parent 0be4e7c1d6
commit 972b4ded75

View File

@ -21,7 +21,7 @@ default = ["clock", "std", "oldtime", "wasmbind"]
alloc = []
libc = []
std = []
clock = ["std", "winapi", "iana-time-zone"]
clock = ["std", "winapi", "iana-time-zone", "android-tzdata"]
oldtime = ["time"]
wasmbind = ["wasm-bindgen", "js-sys"]
unstable-locales = ["pure-rust-locales", "alloc"]
@ -50,7 +50,7 @@ winapi = { version = "0.3.0", features = ["std", "minwinbase", "minwindef", "tim
iana-time-zone = { version = "0.1.45", optional = true, features = ["fallback"] }
[target.'cfg(target_os = "android")'.dependencies]
android-tzdata = "0.1.1"
android-tzdata = { version = "0.1.1", optional = true }
[dev-dependencies]
serde_json = { version = "1" }