-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.godeps
50 lines (40 loc) · 2.36 KB
/
Makefile.godeps
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
#
# Copyright 2020 Brightgate Inc.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# This makefile contains convenience targets for Go dependency management and
# is meant for inclusion by the main Makefile. You can retarget at the tools
# directory by setting GOSRC=build/tools.
# Remove records of modules and versions no longer in use. Run after making
# changes to the source which add or remove references to a dependency.
.PHONY: godeps-tidy
godeps-tidy:
cd $(or $(GOSRC),$(GOSRCBG)) && $(GO) mod tidy -v
# Update $(DEPNAME) to the version specified.
.PHONY: godeps-update
godeps-update:
cd $(or $(GOSRC),$(GOSRCBG)) && $(GO) get -v $(DEPNAME) && $(GO) mod tidy -v
# Update $(DEPNAME) to the version specified, and its dependencies. If
# $(UPDATE_MINOR) is non-empty, allow upgrades to newer minor versions.
.PHONY: godeps-update-all
godeps-update-all:
cd $(or $(GOSRC),$(GOSRCBG)) && $(GO) get -u$(if $(UPDATE_MINOR),,=patch)$(if $(UPDATE_TEST), -t) -v $(DEPNAME) && $(GO) mod tidy -v
# List the versions of all the direct dependencies.
.PHONY: godeps-status
godeps-status:
cd $(or $(GOSRC),$(GOSRCBG)) && $(GO) list $(GO_MOD_FLAG) -f '{{if (not (or .Main .Indirect))}}{{.Path}}: {{.Version}}{{end}}' -m $(or $(DEPNAME),all) 2> /dev/null
# List the versions of all dependencies (direct, indirect, alternate targets).
.PHONY: godeps-status-all
godeps-status-all:
cd $(or $(GOSRC),$(GOSRCBG)) && $(GO) list $(GO_MOD_FLAG) -f '{{.Path}}: {{.Version}}' -m $(or $(DEPNAME),all) 2> /dev/null
# Lists the direct dependencies that can be updated.
.PHONY: godeps-updatable
godeps-updatable:
(printf ".TS\nnowarn tab(@);\nlblblb\n---\nlll.\nModule@Current Version@Upgradable To\n"; cd $(or $(GOSRC),$(GOSRCBG)) && $(GO) list $(GO_MOD_FLAG) -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}@{{.Version}}@{{.Update.Version}}{{end}}' -m $(or $(DEPNAME),all) 2> /dev/null; printf ".TE\n") | groff -t -Tascii | sed -e '/^$$/d'
# Lists all dependencies (direct, indirect, alternate targets) that can be updated.
.PHONY: godeps-updatable-all
godeps-updatable-all:
cd $(or $(GOSRC),$(GOSRCBG)) && $(GO) list $(GO_MOD_FLAG) -u -f '{{if (.Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m $(or $(DEPNAME),all) 2> /dev/null