-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
69 lines (52 loc) · 2.33 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
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: fix vet fmt formula docs license license-check lint bazel-build-gen tidy build test clean jsonschema
GOBIN := $(shell go env GOPATH)/bin
PKG := github.com/GoogleCloudPlatform/marketplace-tools/mpdev
build:
bazel build --stamp --workspace_status_command="./scripts/workspace-status.sh" //...:all
all: fix vet fmt formula docs license license-check lint bazel-build-gen tidy build test jsonschema
clean:
bazel clean
docs:
docker run -v $(shell bazel info output_base)/external/deploymentmanager-autogen:/protos -v $(shell pwd)/docs:/out pseudomuto/protoc-gen-doc \
--doc_opt=markdown,autogen-reference.md java/com/google/cloud/deploymentmanager/autogen/deployment_package_autogen_spec.proto; \
sed -i 's|java/com/google/cloud/deploymentmanager/autogen/deployment_package_autogen_spec.proto|DeploymentPackageAutogenSpec|g' docs/autogen-reference.md; \
sed -i 's/Protocol Documentation/Autogen Reference/' docs/autogen-reference.md;
fix:
go fix ./...
fmt:
go fmt ./...
formula:
./Formula/update.sh
tidy:
go mod tidy
jsonschema:
./scripts/generate-jsonschema.sh
lint:
( [ -f $(GOBIN)/golangci-lint ] || go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62)
$(GOBIN)/golangci-lint run ./...
license:
( [ -f $(GOBIN)/addlicense ] || go install github.com/google/addlicense@v1.1.1)
$(GOBIN)/addlicense -y 2024 -l apache *
license-check:
( [ -f $(GOBIN)/go-licenses ] || go install github.com/google/go-licenses@v1.2.0)
$(GOBIN)/go-licenses check $(PKG)
test:
bazel test //... --test_output=errors --stamp --workspace_status_command="./scripts/workspace-status.sh"
bazel-build-gen:
bazel run :gazelle -- update-repos -from_file=go.mod -build_file_proto_mode disable --to_macro=repos.bzl%go_repositories --prune
bazel run :gazelle
vet:
go vet ./...