Split dependencies with feature flags

This commit is contained in:
Folyd 2020-02-27 17:12:21 +08:00
parent 2f449ff599
commit ba523999d5
4 changed files with 19 additions and 10 deletions

1
rust/Cargo.lock generated
View file

@ -963,7 +963,6 @@ version = "0.1.0"
dependencies = [
"csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libflate 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"minifier 0.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -4,18 +4,24 @@ version = "0.1.0"
authors = ["Folyd <lyshuhow@gmail.com>"]
edition = "2018"
[features]
crates-index = ["csv","semver","tar","libflate"]
books-index = ["futures","tokio","reqwest","select"]
default = ["crates-index"]
[dependencies]
serde = "1.0.102"
tokio = { version="0.2", features=["macros", "time"] }
reqwest = { version="0.10" , features=["json"] }
serde_json = "1.0.41"
serde_derive = "1.0.102"
futures = "0.3.1"
minifier = "0.0.33"
lazy_static = "1.4.0"
unicode-segmentation = "1.6.0"
select = "0.4.3"
csv = "1.1.3"
semver = { version="0.9.0", features=["ci"] }
tar = "0.4.26"
libflate = "0.1.27"
# books-index
futures = { version = "0.3.1", optional=true }
tokio = { version="0.2", features=["macros", "time"], optional=true }
reqwest = { version="0.10" , features=["json"], optional=true }
select = { version= "0.4.3", optional=true }
# crates-index
csv = { version = "1.1.3", optional=true }
semver = { version="0.9.0", features=["ci"], optional=true }
tar = { version = "0.4.26", optional=true }
libflate = { version="0.1.27", optional=true }

View file

@ -1,3 +1,5 @@
#![cfg(feature = "books-index")]
use std::fs;
use std::path::Path;

View file

@ -1,3 +1,5 @@
#![cfg(feature = "crates-index")]
use std::collections::HashMap;
use std::collections::HashSet;
use std::env;