This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
67 lines (44 loc) · 1.46 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
## Setup all variables
RUSTUP = rustup
TOOLCHAIN = $(shell cat rust-toolchain)
CARGO = $(RUSTUP) run --install $(TOOLCHAIN) cargo --color always
GIT_HOOKS_PATH = ".githooks"
GIT_HOOKS = $(wildcard $(GIT_HOOKS_PATH)/*)
INSTALLED_TOOLCHAINS = $(shell $(RUSTUP) toolchain list)
INSTALLED_COMPONENTS = $(shell $(RUSTUP) component list --installed --toolchain $(TOOLCHAIN))
## Only recipe targets from here
# All our targets go into .PHONY because none of them actually create files
.PHONY: init_git_hooks default install_rust install_clippy install clean all ci build clippy test doc e2e check_format format lint ts_lint
default: init_git_hooks build format
init_git_hooks:
git config core.hooksPath $(GIT_HOOKS_PATH)
## Dev environment
install_rust:
ifeq (,$(findstring $(TOOLCHAIN),$(INSTALLED_TOOLCHAINS)))
$(RUSTUP) install $(TOOLCHAIN)
endif
install_clippy: install_rust
ifeq (,$(findstring clippy,$(INSTALLED_COMPONENTS)))
$(RUSTUP) component add clippy --toolchain $(TOOLCHAIN)
endif
## User install
install:
$(CARGO) install --force --path cnd
clean:
$(CARGO) clean
## Development tasks
all: format build clippy test doc e2e
build:
$(CARGO) build --workspace --all-targets $(BUILD_ARGS)
lint: clippy ts_lint
ts_lint:
(cd ./tests; yarn install; yarn check)
clippy: install_clippy
$(CARGO) clippy --all-targets -- -D warnings
e2e:
$(CARGO) build -p cnd -p nectar $(BUILD_ARGS)
(cd ./tests; yarn install; yarn test)
check_format:
dprint check
format:
dprint fmt