forked from DataDog/datadog-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMODULE.bazel
More file actions
192 lines (157 loc) · 7.02 KB
/
MODULE.bazel
File metadata and controls
192 lines (157 loc) · 7.02 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Foundational packages
http_archive = use_repo_rule("//third_party/bazel/tools/build_defs/repo:http.bzl", "http_archive")
visual_studio = use_repo_rule("//bazel/rules:visual_studio.bzl", "visual_studio")
# package_metadata and rules_license are dependencies of every module in the
# Bazel ecosystem. We pin those first to get the versions we require.
bazel_dep(name = "package_metadata", version = "0.0.7")
# Instead of the canonical rules_license, we use the version from supply-chain.
# This allows mixing both old and new license rules during the multi-year
# migration between the two styles. The rules_license overlay will never be
# available in the BCR, for obvious name confusion reasons, so we have to
# use an archive_override to pull the alternate reality from supply-chain.
bazel_dep(name = "rules_license", version = "1.0.0")
# We are temporarily using a development fork which is ahead of the release.
archive_override(
module_name = "rules_license",
# sha256 = TBD,
strip_prefix = "supply-chain-dd_test/rules_license",
urls = ["https://github.com/aiuto/supply-chain/archive/refs/tags/dd_test.tar.gz"],
)
bazel_dep(name = "supply_chain_tools", version = "0.0.1")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "bazel_features", version = "1.34.0")
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "bazel_lib", version = "3.0.0")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "rules_shell", version = "0.6.1")
# Temporary until rules_pkg 1.2.0 is in BCR
archive_override(
module_name = "rules_pkg",
sha256 = "b5c9184a23bb0bcff241981fd9d9e2a97638a1374c9953bb1808836ce711f990",
urls = ["https://github.com/bazelbuild/rules_pkg/releases/download/1.2.0/rules_pkg-1.2.0.tar.gz"],
)
#########################
## Prebuilt binaries ##
#########################
http_archive(
name = "com_github_bazelbuild_buildtools",
patch_strip = 1,
patches = [
"//bazel/patches:buildifier-build.patch", # bazelbuild/buildtools#1398
"//bazel/patches:buildifier-internal-factory.patch", # bazelbuild/buildtools#1399
"//bazel/patches:buildifier-runner-bat-template.patch", # bazelbuild/buildtools#1400 bazelbuild/buildtools#1404
],
sha256 = "53119397bbce1cd7e4c590e117dcda343c2086199de62932106c80733526c261",
strip_prefix = "buildtools-8.2.1",
urls = [
"https://dd-agent-omnibus.s3.amazonaws.com/bazel/buildtools-8.2.1.tar.gz",
"https://github.com/bazelbuild/buildtools/archive/refs/tags/v8.2.1.tar.gz",
],
)
bazel_dep(name = "rules_multitool", version = "1.9.0")
multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
multitool.hub(lockfile = "//bazel:prebuilt_buildtools.json")
multitool.hub(lockfile = "//bazel:prebuilt_jq.json")
use_repo(multitool, "multitool")
######################################
## Compilers and toolchains ##
####################################
bazel_dep(name = "rules_cc", version = "0.2.8")
bazel_dep(name = "rules_flex", version = "0.4")
bazel_dep(name = "rules_m4", version = "0.3")
bazel_dep(name = "gawk", version = "5.3.2.bcr.3")
bazel_dep(name = "gcc_toolchain", version = "0.9.0")
git_override(
module_name = "gcc_toolchain",
commit = "e736410ced16744922c11762783b7c1fdddf620c",
patch_args = ["-p1"],
patches = [
"//bazel/patches:gcc-toolchain/0000-fix-no-repository-visible-as-@.patch",
"//bazel/patches:gcc-toolchain/0001-Remove-fortran-related-actions-adapt-to-our-ctng-too.patch",
"//bazel/patches:gcc-toolchain/0002-fix-c-x86_64-header-locations-with-our-ctng-toolchai.patch",
"//bazel/patches:gcc-toolchain/0003-add-nostdinc-to-asmflags.patch",
],
remote = "https://github.com/f0rmiga/gcc-toolchain.git",
)
gcc_toolchains = use_extension("@gcc_toolchain//toolchain:module_extensions.bzl", "gcc_toolchains", dev_dependency = True)
gcc_toolchains.toolchain(
name = "gcc_toolchain_x86_64",
binary_prefix = "x86_64-unknown-linux-gnu-",
gcc_version = "11.4.0",
target_arch = "x86_64",
)
gcc_toolchains.toolchain(
name = "gcc_toolchain_aarch64",
binary_prefix = "aarch64-unknown-linux-gnu-",
gcc_version = "12.3.0",
target_arch = "aarch64",
)
use_repo(gcc_toolchains, "gcc_toolchain_x86_64")
use_repo(gcc_toolchains, "gcc_toolchain_aarch64")
# TODO{agent-build}: Find a way to register platform-specific toolchains dynamically
register_toolchains(
"@gcc_toolchain_x86_64//:cc_toolchain",
"@gcc_toolchain_aarch64//:cc_toolchain",
"//bazel/toolchains/mingw:mingw_cc_toolchain",
)
# Visual Studio / MSBuild tooling, taken from the local installation
visual_studio(
name = "visual_studio",
path_variable = "VSTUDIO_ROOT",
version = "17.14.36717.8",
)
# =========================================
# Python dependencies
# =========================================
# Keep in sync with .python-version
PYTHON_VERSION = "3.12"
bazel_dep(name = "rules_python", version = "1.6.3")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.defaults(python_version = PYTHON_VERSION)
python.toolchain(
configure_coverage_tool = True,
is_default = True,
python_version = PYTHON_VERSION,
)
use_repo(python, "python_" + PYTHON_VERSION.replace(".", "_"), "pythons_hub")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
# Development requirements. These are the tools needed to build the agent.
# TODO: Make a distinct set for modules we redistribute with the agent.
pip.parse(
hub_name = "py_dev_requirements",
python_version = PYTHON_VERSION,
requirements_lock = "//deps:py_dev_requirements.txt",
)
use_repo(pip, "py_dev_requirements")
register_toolchains("@pythons_hub//:all")
#########################
## Native dependencies ##
#########################
# Make our 3rd parties depencency repositories known
# bazel mod tidy command adds a new line between includes.
# buildifier eliminates them. If we treat mod tidy as a code formatter
# for MODULE.bazel, we need to leave-alone the includes so that buildifier
# doesn't fail nor re-format them.
# buildifier: leave-alone
include("//deps:repos.MODULE.bazel")
# buildifier: leave-alone
include("//deps/acl:acl.MODULE.bazel")
# buildifier: leave-alone
include("//deps/compile_policy:compile_policy.MODULE.bazel")
# buildifier: leave-alone
include("//deps/cpython:cpython.MODULE.bazel")
# buildifier: leave-alone
include("//deps/gstatus:gstatus.MODULE.bazel")
# buildifier: leave-alone
include("//deps/openssl3:openssl3.MODULE.bazel")
# buildifier: leave-alone
include("//deps/libpcap:libpcap.MODULE.bazel")
# buildifier: leave-alone
include("//deps/secret_connector:secret_connector.MODULE.bazel")
# buildifier: leave-alone
include("//deps/snmp_traps:snmp_traps.MODULE.bazel")
# This enables cross-compilation for macOS x86_64 on Apple Silicon.
# Simply add --platforms=@apple_support//platforms:macos_x86_64
# to the build command to enable it.
bazel_dep(name = "apple_support", version = "1.23.1")
use_repo_rule("//bazel/tools:check_bazel_version.bzl", "check_bazel_version")(name = "check_bazel_version")