-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 1.4 KB
/
Copy pathMakefile
File metadata and controls
44 lines (34 loc) · 1.4 KB
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
BAZEL ?= bazelisk
UNIVERSE = //repos/...
.PHONY: bootstrap sync gazelle graph graph-repos graph-architecture deps rdeps clean
bootstrap: sync gazelle
sync:
./scripts/sync-repos.sh
gazelle:
find repos -name BUILD.bazel -delete 2>/dev/null || true
./scripts/gen-gowork.sh
$(BAZEL) mod tidy
GOPROXY=off $(BAZEL) run //:gazelle
graph:
$(BAZEL) query --keep_going --noimplicit_deps --output=graph \
'kind("go_library|go_binary", $(UNIVERSE))' > graph.dot
@echo "wrote graph.dot ($$(grep -c ' -> ' graph.dot) edges)"
graph-repos:
./scripts/graph-repos.sh > graph-repos.dot
@echo "wrote graph-repos.dot"
graph-architecture:
./scripts/graph-repos.sh | tred > graph-architecture.dot
dot -Tsvg graph-architecture.dot -o graph-architecture.svg
@echo "wrote graph-architecture.{dot,svg} ($$(gc graph-architecture.dot | awk '{print $$2}') edges after transitive reduction)"
deps:
@test -n "$(TARGET)" || { echo "usage: make deps TARGET=//repos/purl:purl"; exit 1; }
$(BAZEL) query --keep_going \
'filter("^//repos/", kind("go_library|go_binary", deps($(TARGET))))'
rdeps:
@test -n "$(TARGET)" || { echo "usage: make rdeps TARGET=//repos/purl:purl"; exit 1; }
$(BAZEL) query --keep_going \
'kind("go_library|go_binary", rdeps($(UNIVERSE), $(TARGET)))'
clean:
find repos -name BUILD.bazel -delete 2>/dev/null || true
rm -f go.work go.work.sum graph.dot graph-repos.dot graph-architecture.dot
$(BAZEL) clean