-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bazelrc
More file actions
147 lines (120 loc) 路 5.89 KB
/
Copy path.bazelrc
File metadata and controls
147 lines (120 loc) 路 5.89 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 馃尯馃挏 Violet.Networking: C++20 library that provides networking primitives
# Copyright (c) 2026 Noelware, LLC. <team@noelware.org>, et al.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# TODO(@auguwu/Noel): Use `https://bcr.noelware.cloud` once available
common --registry=https://raw.githubusercontent.com/Noelware/bazel-registry/master/
common --registry=https://bcr.bazel.build
# For `--config=dbg`, we set `--compilation_mode` to `dbg`
build:dbg --compilation_mode=dbg
# For `--config=opt`, we set `--compilation_mode` to `opt`
build:opt --compilation_mode=opt
build:opt --copt=-DNDEBUG
build:opt --host_copt=-DNDEBUG
# For `.bazelrc`, we can specify platform-specific Bazel flags with this.
common --enable_platform_specific_config
# Requires for Windows usage
startup --windows_enable_symlinks
build:windows --enable_runfiles
# macOS: Set Apple SDK to 15.5
build:macos --macos_minimum_os=15.5
# macOS (C++): Disable modules as Noelware.Violet doesn't support it (yet) on macOS.
build:macos --cxxopt=-fno-modules
# macOS (C++): Disable layering and header checks. At some point, I'll see why
# this doesn't work so we can have enable C++20 modules soon:tm:
build:macos --features=-layering_check --features=-parse_headers
# C++: Disable annoying warnings
build:linux --copt=-Wno-unused-command-line-argument
build:linux --host_copt=-Wno-unused-command-line-argument
build:macos --copt=-Wno-unused-command-line-argument
build:macos --host_copt=-Wno-unused-command-line-argument
# `--config=libcxx`: Enables compilation and linking with libc++
build:libcxx --cxxopt=-stdlib=libc++
build:libcxx --linkopt=-stdlib=libc++
build:libcxx --linkopt=-lc++
build:libcxx --linkopt=-lc++abi
# `--config=host-libcxx`: Enables compilation and linking with libc++
build:host-libcxx --host_cxxopt=-stdlib=libc++
build:host-libcxx --host_linkopt=-stdlib=libc++
build:host-libcxx --host_linkopt=-lc++
build:host-libcxx --host_linkopt=-lc++abi
# --config=cxx20: Test with C++20 (Linux, macOS)
build:cxx20 --cxxopt=-std=c++20
build:cxx20 --host_cxxopt=-std=c++20
# --config=cxx23: Test with C++23 (Linux, macOS)
build:cxx23 --cxxopt=-std=c++23
build:cxx23 --host_cxxopt=-std=c++23
# --config=cxx26: Test with C++26 (Linux, macOS)
build:cxx26 --cxxopt=-std=c++26
build:cxx26 --host_cxxopt=-std=c++26
# Only show errors in test output
test --test_output=errors
# CI-based configuration
common:ci --color=no
common:ci --curses=no
build:ci --disk_cache=/tmp/bazel/violet
build:ci --spawn_strategy=local
test:ci --test_output=all
common:ci --noshow_progress
common:ci --verbose_failures
common:ci --experimental_ui_max_stdouterr_bytes=-1
## Rust
build --@rules_rust//rust/toolchain/channel=nightly
# Use Bazel's C++ toolchain as the linker for Rust targets instead of relying
# on a system linker being available in the sandbox (fixes macOS linker errors).
build --@rules_rust//rust/settings:experimental_use_cc_common_link=True
# related: https://github.com/bazelbuild/rules_rust/issues/3459
build --@rules_rust//rust/settings:experimental_use_allocator_libraries_with_mangled_symbols=true
build --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
build --output_groups=+clippy_checks
build --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect
build --output_groups=+rustfmt_checks
build --@rules_rust//rust/settings:rustfmt.toml=//:rustfmt.toml
## ~ common configuration for sanitizers
common:san --config=dbg
common:san --strip=never
common:san --copt=-O0
common:san --copt=-fno-omit-frame-pointer
## ~ `--config=asan` enables Address Sanitizer (ASan)
common:asan --config=san
common:asan --@violet//buildsystem/bazel/flags:asan=True
common:asan --//bazel/flags:asan=True
common:asan --@rules_rust//rust/settings:extra_rustc_flags=-Zsanitizer=address
common:asan --@rules_rust//rust/settings:extra_exec_rustc_flags=-Zsanitizer=address
common:asan --@rules_rust//rust/settings:extra_rustc_flags=-Clink-arg=-fsanitize=address
common:asan --@rules_rust//rust/settings:extra_exec_rustc_flags=-Clink-arg=-fsanitize=address
## ~ `--config=msan` enables Memory Sanitizer (MSan)
common:msan --config=san
common:msan --@violet//buildsystem/bazel/flags:msan=True
common:msan --//bazel/flags:msan=True
common:msan --@rules_rust//rust/settings:extra_rustc_flags=-Zsanitizer=memory
common:msan --@rules_rust//rust/settings:extra_exec_rustc_flags=-Zsanitizer=memory
common:msan --@rules_rust//rust/settings:extra_rustc_flags=-Clink-arg=-fsanitize=memory
common:msan --@rules_rust//rust/settings:extra_exec_rustc_flags=-Clink-arg=-fsanitize=memory
## ~ `--config=ubsan` enables Undefined Behaviour Sanitizer (UBSan)
common:ubsan --config=san
common:ubsan --linkopt=-lubsan
common:ubsan --@violet//buildsystem/bazel/flags:ubsan=True
common:ubsan --//bazel/flags:ubsan=True
## ~ `--config=tsan` enables Thread Sanitizer (TSan)
common:tsan --config=san
common:tsan --@violet//buildsystem/bazel/flags:tsan=True
common:tsan --//bazel/flags:tsan=True
# Import .usr.bazelrc if it exists
try-import %workspace%/.usr.bazelrc