-
Notifications
You must be signed in to change notification settings - Fork 54
/
Makefile.dev
61 lines (49 loc) · 2.92 KB
/
Makefile.dev
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
# Copyright 2017-2021 Authors of Cilium
#
# 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.
CHECK_FORMAT ?= ./bazel-bin/check_format.py
BAZEL_CACHE ?= ~/.cache/bazel
BAZEL_ARCHIVE ?= ~/bazel-cache.tar.bz2
# @envoy_api//:v3_protos must be built before invoking Makefile.api
API_DEPS = @envoy_api//:v3_protos
PROTOC_TARGET = @com_google_protobuf//:protoc
api: force-non-root Makefile.api install-bazelisk
PROTOC=`$(BAZEL) cquery --output=starlark --starlark:expr=target.files_to_run.executable.path $(PROTOC_TARGET) | grep fastbuild/bin/external`; \
$(BAZEL) build $(PROTOC_TARGET) $(API_DEPS); \
file $${PROTOC} && PROTOC=$${PROTOC} $(MAKE) -f Makefile.api all
api-clean:
find go -name *.pb.go -delete
find go -name *.pb.validate.go -delete
find go -empty -type d -delete
mkdir -p go/contrib/envoy
mkdir go/envoy
$(CHECK_FORMAT): force-non-root SOURCE_VERSION install-bazelisk clang.bazelrc
$(BAZEL) $(BAZEL_OPTS) build $(BAZEL_BUILD_OPTS) //:check_format.py
veryclean: force-non-root clean
-sudo $(BAZEL) $(BAZEL_OPTS) clean
-sudo rm -Rf $(BAZEL_CACHE)
precheck: force-non-root
tools/check_repositories.sh
FORMAT_EXCLUDED_PREFIXES = "./linux/" "./proxylib/" "./starter/" "./vendor/" "./go/" "./envoy_build_config/"
check: force-non-root
bazel $(BAZEL_OPTS) run @envoy//tools/code_format:check_format -- --path "$(PWD)" --skip_envoy_build_rule_check --add-excluded-prefixes $(FORMAT_EXCLUDED_PREFIXES) --bazel_tools_check_excluded_paths="./" --build_fixer_check_excluded_paths="./" check || echo "Format check failed, run 'make fix' locally to fix formatting errors."
fix: force-non-root
bazel $(BAZEL_OPTS) run @envoy//tools/code_format:check_format -- --path "$(PWD)" --skip_envoy_build_rule_check --add-excluded-prefixes $(FORMAT_EXCLUDED_PREFIXES) --bazel_tools_check_excluded_paths="." --build_fixer_check_excluded_paths="./" fix
# Run tests without debug by default.
tests: $(COMPILER_DEP) force-non-root SOURCE_VERSION proxylib/libcilium.so install-bazelisk
$(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) //:envoy_binary_test $(BAZEL_FILTER)
$(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) $(BAZEL_TEST_OPTS) //tests/... $(BAZEL_FILTER)
$(MAKE) -C proxylib test
debug-tests: $(COMPILER_DEP) force-non-root SOURCE_VERSION install-bazelisk
$(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) -c dbg $(BAZEL_TEST_OPTS) //:envoy_binary_test $(BAZEL_FILTER)
$(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) -c dbg $(BAZEL_TEST_OPTS) //tests/... $(BAZEL_FILTER)