-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
121 lines (108 loc) · 3.38 KB
/
Makefile
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# influxive Makefile
.PHONY: all publish test static docs tools tool_rust tool_fmt tool_readme
SHELL = /usr/bin/env sh -eu
all: test
publish-all:
$(MAKE) publish crate=influxive-core
$(MAKE) publish crate=influxive-writer
$(MAKE) publish crate=influxive-downloader
$(MAKE) publish crate=influxive-child-svc
$(MAKE) publish crate=influxive-otel-atomic-obs
$(MAKE) publish crate=influxive-otel
$(MAKE) publish crate=influxive
publish:
@case "$(crate)" in \
influxive-core) \
export MANIFEST="./crates/influxive-core/Cargo.toml"; \
;; \
influxive-writer) \
export MANIFEST="./crates/influxive-writer/Cargo.toml"; \
;; \
influxive-downloader) \
export MANIFEST="./crates/influxive-downloader/Cargo.toml"; \
;; \
influxive-child-svc) \
export MANIFEST="./crates/influxive-child-svc/Cargo.toml"; \
;; \
influxive-otel-atomic-obs) \
export MANIFEST="./crates/influxive-otel-atomic-obs/Cargo.toml"; \
;; \
influxive-otel) \
export MANIFEST="./crates/influxive-otel/Cargo.toml"; \
;; \
influxive) \
export MANIFEST="./crates/influxive/Cargo.toml"; \
;; \
*) \
echo "USAGE: make publish crate=influxive-core"; \
echo "USAGE: make publish crate=influxive-writer"; \
echo "USAGE: make publish crate=influxive-downloader"; \
echo "USAGE: make publish crate=influxive-child-svc"; \
echo "USAGE: make publish crate=influxive-otel-atomic-obs"; \
echo "USAGE: make publish crate=influxive-otel"; \
echo "USAGE: make publish crate=influxive"; \
exit 1; \
;; \
esac; \
export VER="v$$(grep version $${MANIFEST} | head -1 | cut -d ' ' -f 3 | cut -d \" -f 2)"; \
echo "publish $(crate) $${MANIFEST} $${VER}"; \
git diff --exit-code; \
cargo publish --manifest-path $${MANIFEST}; \
git tag -a "$(crate)-$${VER}" -m "$(crate)-$${VER}"; \
git push --tags;
test: static tools
cargo build --all-targets
RUST_BACKTRACE=1 cargo test -- --nocapture
static: docs tools
cargo fmt -- --check
cargo clippy
@if [ "${CI}x" != "x" ]; then git diff --exit-code; fi
docs: tools
cargo rdme --force -w influxive-core
cargo rdme --force -w influxive-writer
cargo rdme --force -w influxive-downloader
cargo rdme --force -w influxive-child-svc
cargo rdme --force -w influxive-otel-atomic-obs
cargo rdme --force -w influxive-otel
cargo rdme --force -w influxive
tools: tool_rust tool_fmt tool_clippy tool_readme
tool_rust:
@if rustup --version >/dev/null 2>&1; then \
echo "# Makefile # found rustup, setting override stable"; \
rustup override set stable; \
else \
echo "# Makefile # rustup not found, hopefully we're on stable"; \
fi;
tool_fmt: tool_rust
@if ! (cargo fmt --version); \
then \
if rustup --version >/dev/null 2>&1; then \
echo "# Makefile # installing rustfmt with rustup"; \
rustup component add rustfmt; \
else \
echo "# Makefile # rustup not found, cannot install rustfmt"; \
exit 1; \
fi; \
else \
echo "# Makefile # rustfmt ok"; \
fi;
tool_clippy: tool_rust
@if ! (cargo clippy --version); \
then \
if rustup --version >/dev/null 2>&1; then \
echo "# Makefile # installing clippy with rustup"; \
rustup component add clippy; \
else \
echo "# Makefile # rustup not found, cannot install clippy"; \
exit 1; \
fi; \
else \
echo "# Makefile # clippy ok"; \
fi;
tool_readme: tool_rust
@if ! (cargo rdme --version); \
then \
cargo install cargo-rdme; \
else \
echo "# Makefile # readme ok"; \
fi;