.PHONY: help all check-clippy fmt fmt-check test vrl-test \
check-typos check-features check-licenses write-licenses check-msrv check-deny check-wasm32 \
check-docs check-lockfile generate-docs
CARGO_DENY_VERSION := 0.18.9
CARGO_HACK_VERSION := 0.5.29
CARGO_MSRV_VERSION := 0.17.1
DD_LICENSE_TOOL_VERSION := 1.0.6
TYPOS_CLI_VERSION := 1.33.1
define ensure-cargo-tool
@if ! cargo install --list | grep -q "^$(1) v$(2):"; then \
echo "Installing $(1) v$(2)"; \
cargo install $(1) --version $(2) --force --locked; \
fi
endef
help:
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*##/ {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
all: fmt-check test vrl-test check-clippy check-licenses check-wasm32
fmt:
cargo fmt --all
fmt-check:
cargo fmt --check --all
test:
cargo test --workspace
vrl-test:
cargo run --package vrl-tests --bin vrl-tests
check-clippy:
cargo clippy --workspace --all-targets --all-features -- -D warnings
check-typos:
$(call ensure-cargo-tool,typos-cli,$(TYPOS_CLI_VERSION))
typos
check-features:
$(call ensure-cargo-tool,cargo-hack,$(CARGO_HACK_VERSION))
cargo hack check --feature-powerset --depth 1
check-licenses:
$(call ensure-cargo-tool,dd-rust-license-tool,$(DD_LICENSE_TOOL_VERSION))
dd-rust-license-tool check
write-licenses:
$(call ensure-cargo-tool,dd-rust-license-tool,$(DD_LICENSE_TOOL_VERSION))
dd-rust-license-tool write
check-msrv:
$(call ensure-cargo-tool,cargo-msrv,$(CARGO_MSRV_VERSION))
cargo msrv verify
check-deny:
$(call ensure-cargo-tool,cargo-deny,$(CARGO_DENY_VERSION))
cargo deny --log-level error --all-features check all
check-wasm32:
rustup target add wasm32-unknown-unknown
cargo check --target wasm32-unknown-unknown --no-default-features --features stdlib
check-docs:
cargo doc --no-deps --workspace
check-lockfile:
cargo update --workspace --locked
generate-docs:
cargo run -p vrl-docs -- --output docs/generated/