forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-component-features.sh
executable file
·29 lines (24 loc) · 1.06 KB
/
check-component-features.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
set -euo pipefail
# check-component-features.sh
#
# SUMMARY
#
# Ensures that all components have corresponding features in `Cargo.toml` and
# that each of these features declares declares all dependencies
# necessary to build it without having other features enabled.
cd $(dirname $0)/..
echo "Checking that Vector and tests can be built without default features..."
cargo check --tests --no-default-features
echo "Checking that all components have corresponding features in Cargo.toml..."
components=$(cargo run --no-default-features -- list)
if (echo "$components" | egrep -v "^(Sources:|Transforms:|Sinks:|)$" >/dev/null); then
echo "Some of the components do not have a corresponding feature flag in Cargo.toml:"
echo "$components" | sed "s/^/ /"
exit 1
fi
echo "Checking that each component feature can be built without other features..."
cat Cargo.toml |
remarshal --if toml --of json |
jq -r ".features.sources,.features.transforms,.features.sinks|.[]" |
xargs -I{} sh -cx "cargo check --tests --no-default-features --features {} || exit 255"