Skip to content

Commit d0ac3b5

Browse files
committed
Add features.optional-dependencies to CI config
1 parent 0002363 commit d0ac3b5

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

ci.jsonnet

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ local getConfig(path, default) =
1717

1818
local backend = getConfig("backend", null);
1919
local features_own = getConfig("features.own", null);
20+
// features.optional_dependencies is a list of features which are
21+
// modelled by optional dependencies.
22+
local features_optional_dependencies = getConfig("features.optional-dependencies", null);
2023
local features_required = getConfig("features.required", null);
2124
local features =
2225
if features_own != null || features_required != null then

crates/deadpool-redis/ci.config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ features:
1212
- tls
1313
- async-std-tls-comp
1414
- aio
15+
optional-dependencies:
16+
- uuid
1517

1618
test:
1719
services:
1820
redis-sentinel:
19-
image: 'bitnami/redis-sentinel:latest'
21+
image: "bitnami/redis-sentinel:latest"
2022
env:
2123
ALLOW_EMPTY_PASSWORD: yes
2224
ports:

tools/check-reexported-features.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ REEXPORTED_FEATURES=$TEMP_DIR/reexported-features.json
1212

1313
BACKEND=$(yq ".backend // \"\"" ci.config.yml)
1414
FEATURES_OWN=$(yq --output-format=json ".features | .own // []" ci.config.yml)
15+
FEATURES_OPTIONAL_DEPENDENCIES=$(yq --output-format=json ".features | .optional-dependencies // []" ci.config.yml)
1516
FEATURES_EXCLUDE=$(yq --output-format=json ".features | .exclude // []" ci.config.yml)
1617

1718
if [ -z "$BACKEND" ]; then
@@ -23,7 +24,7 @@ fi
2324
# e.g. `tokio-postgres` becomes `tokio_postgres`.
2425
BACKEND_NORMALIZED=${BACKEND//-/_}
2526

26-
cargo metadata --format-version 1 > $METADATA
27+
cargo metadata --format-version 1 > "$METADATA"
2728

2829
CRATE_NAME=$(yq .package.name Cargo.toml)
2930

@@ -38,7 +39,7 @@ DEPENDENCY_ID=$(
3839
| select(.name == \"$BACKEND_NORMALIZED\")
3940
| .pkg
4041
" \
41-
$METADATA
42+
"$METADATA"
4243
)
4344

4445
if [ -z "$DEPENDENCY_ID" ]; then
@@ -48,17 +49,16 @@ fi
4849

4950
yq --output-format=json \
5051
"
51-
(
52-
.features
53-
| keys()
54-
- [\"default\"]
55-
)
56-
- $FEATURES_OWN
52+
.features
53+
| keys
54+
| . - [\"default\"]
55+
| . - $FEATURES_OWN
56+
| . - $FEATURES_OPTIONAL_DEPENDENCIES
5757
| sort
5858
" \
5959
Cargo.toml \
60-
| jq .[] --raw-output \
61-
> $REEXPORTED_FEATURES
60+
| jq --raw-output .[] \
61+
> "$REEXPORTED_FEATURES"
6262

6363
jq --raw-output \
6464
"
@@ -73,14 +73,14 @@ jq --raw-output \
7373
| .key
7474
]
7575
# Remove 'default' feature, we won't expose it
76-
- [ \"default\" ]
76+
| . - [ \"default\" ]
7777
# Remove all features that should be ignored
78-
- $FEATURES_EXCLUDE
78+
| . - $FEATURES_EXCLUDE
7979
| sort
8080
| .[]
8181
" \
82-
< $METADATA \
83-
> $DEPENDENCY_FEATURES
82+
< "$METADATA" \
83+
> "$DEPENDENCY_FEATURES"
8484

8585
# 'diff' returns 0 if no difference is found
8686
printf "%-63s %s\n" "$BACKEND features" "$CRATE_NAME features"

0 commit comments

Comments
 (0)