forked from magma/magma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bazelrc
107 lines (87 loc) · 4.72 KB
/
.bazelrc
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
startup --output_base=/var/tmp/bazel
startup --host_jvm_args="-Xmx8g"
# STYLE CONFIGS
build --announce_rc
build --color=yes
build:production --config=lsan --copt=-O3
build:production --define=production=1
# C/C++ CONFIGS
build --cxxopt=-std=c++14
# Create debug information only for magma binaries (not for external dependencies).
# --compilation_mode=dbg would also create debug information of external dependencies
# and increase the size of artifacts drastically.
# Needs --strip=never so that debug information is not removed by the linker.
# See https://bazel.build/docs/user-manual#compilation-mode and
# https://bazel.build/docs/user-manual#strip
build --strip=never
build --per_file_copt=^lte/gateway/c/.*$@-g
# DEFAULT TEST CONFIGURATION
# Please read the GH issue #13073 before adding "test" options.
test --test_output=errors
# MAGMA VM CONFIGS
build:specify_vm_cc --action_env=CC=/usr/bin/gcc
build:vm --config=specify_vm_cc
# DISK CACHE CONFIGS
# The locations of the disk_cache/repository_cache are symlinks in the
# docker containers/magma-vm. They point to the correct cache locations
# $MAGMA/.bazel-cache and $MAGMA/.bazel-cache-repo inside the magma repository.
build:disk_cache --disk_cache=/var/cache/bazel-cache
common:disk_cache --repository_cache=/var/cache/bazel-cache-repo
# REMOTE CACHING READ AND WRITE CONFIGS
# The file bazel/bazelrcs/remote_caching_rw.bazelrc is templated in CI
# The full config is then written to bazel/bazelrcs/cache.bazelrc
# REMOTE CACHING READ-ONLY CONFIGS
# The file bazel/bazelrcs/remote_caching_ro.bazelrc is templated in CI
# The full config is then written to bazel/bazelrcs/cache.bazelrc
build:remote_caching_ro --remote_upload_local_results=false
# REMOTE DOWNLOAD OPTIMIZATION
build:remote_download_optimization --remote_download_minimal
# --remote_download_toplevel instead of --remote_download_minimal is
# needed for 'bazel run' due to https://github.com/bazelbuild/bazel/issues/11920
run:remote_download_optimization --remote_download_toplevel
# Import the bazel caching config, with default disk cache,
# which in CI gets overwritten by the remote caching config.
import %workspace%/bazel/bazelrcs/cache.bazelrc
# TEST CONFIGS
# Bazel test runtime default: PATH=/bin:/usr/bin:/usr/local/bin
# Some python tests require access to /usr/sbin binaries (e.g. route, ifconfig)
build --test_env=PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin
# Use MAGMA_ROOT from the host system in tests.
# Needed by python tests (e.g. freedomfi_one_tests in enodebd)
build --test_env=MAGMA_ROOT
build --test_env=S1AP_TESTER_ROOT
# Needed for go tests to generate the test result XML in the correct format
build --test_env=GO_TEST_WRAP_TESTV=1
# MME specific compile time defines
# Compile mme libraries with unit test flag
test --per_file_copt=^lte/gateway/c/core/.*$@-DMME_UNIT_TEST # See GH issue #13073
build:mme_unit_test --per_file_copt=^lte/gateway/c/core/.*$@-DMME_UNIT_TEST # See GH issue #13073
# TODO: deprecate these flags used for logging if possible
build --per_file_copt=^lte/gateway/c/core/.*$@-DPACKAGE_BUGREPORT=\"TBD\"
build --per_file_copt=^lte/gateway/c/core/.*$@-DPACKAGE_VERSION=\"0.1\"
build --per_file_copt=^lte/gateway/c/core/oai/tasks/amf/.*$@-DPACKAGE_NAME=\"AMF\"
build --per_file_copt=^lte/gateway/c/core/oai/tasks/mme_app/.*$@-DPACKAGE_NAME=\"MME\"
build --per_file_copt=^lte/gateway/c/core/oai/tasks/sgw/.*$@-DPACKAGE_NAME=\"S/P-GW\"
# CODE COVERAGE CONFIGS
build --javacopt="-source 8"
build --javacopt="-target 8"
build --java_runtime_version=remotejdk_11
coverage --config=coverage
build:coverage --combined_report=lcov
build:coverage --instrumentation_filter="//(orc8r|lte)/gateway/(c|python)[/:],-//(orc8r|lte)/protos[/:],-/*/test[/:]"
# ASAN
build:asan --linkopt=-fsanitize=address
build:asan --linkopt=-fsanitize=undefined
build:asan --action_env=ASAN_OPTIONS=detect_leaks=1:color=always
build:asan --per_file_copt=^.*/gateway/c/.*$@-fsanitize=address,-fsanitize=undefined,-O0,-fno-omit-frame-pointer
# LSAN
build:lsan --linkopt=-fsanitize=leak
build:lsan --per_file_copt=^.*/gateway/c/.*$@-fsanitize=leak,-fno-omit-frame-pointer
# Config for running Bazel with limited memory
# see https://bazel.build/docs/memory-saving-mode
# This is helpful for builds on the VM on github runners where only 14g are available.
build:limit_mem --discard_analysis_cache --nokeep_state_after_build --notrack_incremental_state
# Config for turning up more GCC warnings
build:max_gcc_warnings --per_file_copt=^.*/gateway/c/.*$@-Wextra,-Wshadow,-Wimplicit-fallthrough,-Wduplicated-cond,-Wduplicated-branches,-Wlogical-op,-Wnull-dereference,-Wformat=2,-Wstrict-overflow=4,-Wuninitialized,-Wshift-overflow=2
# system bazelrc should include config specific to different build envs (--config=vm, --config=devcontainer, etc.)
try-import /etc/bazelrc