From c05600d749b2ef56d40bed7e41a6a94e02046fb6 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 10 Mar 2021 22:32:14 +0100 Subject: [PATCH] make basalt optionnal during compilation --- .drone.yml | 38 ++++++++++++++++++++++++++++++++------ Cargo.toml | 10 ++++++++-- src/peering/mod.rs | 2 ++ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index aa99d4c..b9777d0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,21 @@ kind: pipeline name: default +workspace: + base: /drone + +clone: + disable: true + steps: + - name: clone + image: alpine/git + commands: + - mkdir -p cargo + - git clone $DRONE_GIT_HTTP_URL + - cd netapp + - git checkout $DRONE_COMMIT + - name: restore-cache image: meltwater/drone-cache:dev environment: @@ -14,21 +28,29 @@ steps: restore: true archive_format: "gzip" bucket: drone-cache - cache_key: '{{ .Repo.Name }}_{{ checksum "Cargo.lock" }}_{{ arch }}_{{ os }}_gzip' + cache_key: '{{ .Repo.Name }}_{{ checksum "netapp/Cargo.lock" }}_{{ arch }}_{{ os }}_gzip' region: garage mount: - - 'target' + - 'netapp/target' + - 'cargo/registry/index' + - 'cargo/registry/cache' + - 'cargo/bin' + - 'cargo/git/db' path_style: true endpoint: https://garage.deuxfleurs.fr - name: build image: rustlang/rust:nightly + environment: + CARGO_HOME: /drone/cargo commands: - apt-get update - apt-get install --yes libsodium-dev - - cargo build + - cargo install cargo-all-features + - cd netapp + - cargo build-all-features - cargo build --example fullmesh - - cargo build --example basalt + - cargo build --example basalt --features "basalt" - name: rebuild-cache image: meltwater/drone-cache:dev @@ -42,9 +64,13 @@ steps: rebuild: true archive_format: "gzip" bucket: drone-cache - cache_key: '{{ .Repo.Name }}_{{ checksum "Cargo.lock" }}_{{ arch }}_{{ os }}_gzip' + cache_key: '{{ .Repo.Name }}_{{ checksum "netapp/Cargo.lock" }}_{{ arch }}_{{ os }}_gzip' region: garage mount: - - 'target' + - 'netapp/target' + - 'cargo/registry/index' + - 'cargo/registry/cache' + - 'cargo/bin' + - 'cargo/git/db' path_style: true endpoint: https://garage.deuxfleurs.fr diff --git a/Cargo.toml b/Cargo.toml index 166c790..05634b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,10 @@ categories = ["asynchronous", "network-programming"] [lib] name = "netapp" +[features] +default = [] +basalt = ["lru", "rand"] + [dependencies] async-std = { version = "1.5.0", default-features = false } tokio = { version = "0.2", default-features = false, features = ["net", "tcp", "rt-core", "rt-threaded", "sync", "time", "macros"] } @@ -24,7 +28,7 @@ hex = "0.4.2" base64 = "0.12.1" structopt = { version = "0.3", default-features = false } -rand = "0.5.5" +rand = { version = "0.5.5", optional = true } chrono = "0.4" log = "0.4.8" @@ -33,8 +37,10 @@ arc-swap = "1.1" async-trait = "0.1.7" err-derive = "0.2.3" bytes = "0.6.0" -lru = "0.6" +lru = { version = "0.6", optional = true } sodiumoxide = { version = "0.2.5-0", package = "kuska-sodiumoxide" } kuska-handshake = { version = "0.1.2", features = ["default", "tokio_compat"] } +[package.metadata.cargo-all-features] +skip_optional_dependencies = true diff --git a/src/peering/mod.rs b/src/peering/mod.rs index 15b870a..96a4302 100644 --- a/src/peering/mod.rs +++ b/src/peering/mod.rs @@ -1,2 +1,4 @@ pub mod fullmesh; + +#[cfg(feature = "basalt")] pub mod basalt;