Skip to content

Commit

Permalink
build: remove service-* from default features (#4311)
Browse files Browse the repository at this point in the history
* build: remove `service-*` from default features

#4310

* fix clippy

* fix compile for tests

* fix

* fix

* fix

* fix

* fix

* fix doctest

* add default features to C binding

* remove #![deny(unused_qualifications)]
  • Loading branch information
xxchan authored Mar 5, 2024
1 parent 7f46293 commit f914dc3
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,6 @@ jobs:

- name: Test
working-directory: core
run: cargo nextest run --no-fail-fast --features layers-all && cargo test --doc
run: cargo nextest run --no-fail-fast --features layers-all,tests && cargo test --doc --features tests
env:
LD_LIBRARY_PATH: ${{ env.JAVA_HOME }}/lib/server:${{ env.LD_LIBRARY_PATH }}
19 changes: 18 additions & 1 deletion bin/oli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,24 @@ dirs = "5.0.1"
env_logger = "0.11"
futures = "0.3"
log = "0.4"
opendal = { version = "0.45.1", path = "../../core" }
opendal = { version = "0.45.1", path = "../../core", features = [
# These are default features before v0.46. TODO: change to optional features
"services-azblob",
"services-azdls",
"services-cos",
"services-fs",
"services-gcs",
"services-ghac",
"services-http",
"services-ipmfs",
"services-memory",
"services-obs",
"services-oss",
"services-s3",
"services-webdav",
"services-webhdfs",
"services-azfile",
] }
serde = { version = "1", features = ["derive"] }
tokio = { version = "1.34", features = [
"fs",
Expand Down
16 changes: 16 additions & 0 deletions bindings/c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,21 @@ bytes = "1.4.0"
once_cell = "1.17.1"
opendal = { version = "0.45.1", path = "../../core", features = [
"layers-blocking",
# These are default features before v0.46. TODO: change to optional features #4313
"services-azblob",
"services-azdls",
"services-cos",
"services-fs",
"services-gcs",
"services-ghac",
"services-http",
"services-ipmfs",
"services-memory",
"services-obs",
"services-oss",
"services-s3",
"services-webdav",
"services-webhdfs",
"services-azfile",
] }
tokio = { version = "1.27", features = ["fs", "macros", "rt-multi-thread"] }
31 changes: 12 additions & 19 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,25 @@ default-members = ["."]
members = [".", "fuzz", "edge/*", "benches/vs_*"]

[features]
default = [
"rustls",
"services-azblob",
"services-azdls",
"services-cos",
"services-fs",
"services-gcs",
"services-ghac",
"services-http",
"services-ipmfs",
"services-memory",
"services-obs",
"services-oss",
"services-s3",
"services-webdav",
"services-webhdfs",
"services-azfile",
]
default = ["rustls"]

# Build test utils or not.
#
# These features are used to control whether to build opendal's test utils.
# And doesn't have any other effects.
#
# You should never enable this feature unless you are developing opendal.
tests = ["dep:rand", "dep:sha2", "dep:dotenvy", "layers-blocking"]
tests = [
"dep:rand",
"dep:sha2",
"dep:dotenvy",
"layers-blocking",
"services-azblob",
"services-fs",
"services-http",
"services-memory",
"services-s3",
]

# Enable trust-dns for pure rust dns cache.
trust-dns = ["reqwest/trust-dns"]
Expand Down
2 changes: 1 addition & 1 deletion core/edge/file_write_on_full_disk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ version = "0.0.0"

[dependencies]
futures = "0.3"
opendal = { path = "../../" }
opendal = { path = "../../", features = ["services-memory", "services-fs"] }
rand = "0.8"
tokio = { version = "1", features = ["full"] }
6 changes: 6 additions & 0 deletions core/src/docs/upgrade.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Upgrade to v0.46

## Services Feature Flag

Starting from v0.46, OpenDAL does not include any services in default features to avoid compiling unneeded services' code. Please enable each service's feature flag to use it.

# Upgrade to v0.45

## Public API
Expand Down
2 changes: 0 additions & 2 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@
// Make sure all our public APIs have docs.
#![warn(missing_docs)]
// Deny unused qualifications.
#![deny(unused_qualifications)]

// Private module with public types, they will be accessed via `opendal::Xxxx`
mod types;
Expand Down
1 change: 1 addition & 0 deletions core/src/raw/http_util/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl IncomingAsyncBody {
}

/// Create an empty IncomingAsyncBody.
#[allow(dead_code)]
pub(crate) fn empty() -> Self {
Self {
inner: Box::new(()),
Expand Down
1 change: 1 addition & 0 deletions core/src/types/mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ impl EntryMode {
}

/// Create entry mode from given path.
#[allow(dead_code)]
pub(crate) fn from_path(path: &str) -> Self {
if path.ends_with('/') {
EntryMode::DIR
Expand Down
1 change: 1 addition & 0 deletions core/src/types/operator/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ impl Operator {
/// Ok(())
/// }
/// ```
#[allow(unused_variables, unreachable_code)]
pub fn via_map(scheme: Scheme, map: HashMap<String, String>) -> Result<Operator> {
let op = match scheme {
#[cfg(feature = "services-atomicserver")]
Expand Down
2 changes: 1 addition & 1 deletion integrations/dav-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dav-server = { version = "0.5.8" }
dirs = "5.0.0"
futures = "0.3"
futures-util = { version = "0.3.16" }
opendal = { version = "0.45.1", path = "../../core" }
opendal = { version = "0.45.1", path = "../../core", features = ["services-fs"] }
quick-xml = { version = "0.31", features = ["serialize", "overlapped-lists"] }
serde = { version = "1", features = ["derive"] }
tokio = { version = "1.27", features = [
Expand Down
1 change: 1 addition & 0 deletions integrations/object_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ tokio = { version = "1", default-features = false }

[dev-dependencies]
tokio = { version = "1", features = ["fs", "macros", "rt-multi-thread"] }
opendal = { version = "0.45.1", path = "../../core", features = ["services-memory"] }

0 comments on commit f914dc3

Please sign in to comment.