SERVER-80018 add bazel formatting requirement to commit queue (#18477)

GitOrigin-RevId: 93b769fba497837206bcd1045a5cead0ddb36d08
This commit is contained in:
Trevor 2024-01-30 02:31:05 -06:00 committed by MongoDB Bot
parent d8515d576f
commit ebd80c333f
24 changed files with 660 additions and 540 deletions

View File

@ -1,3 +1,7 @@
package(default_visibility = ["//visibility:public"])
exports_files(["buildscripts/idl", "pyproject.toml", "poetry.lock"])
exports_files([
"buildscripts/idl",
"pyproject.toml",
"poetry.lock",
])

View File

@ -1,14 +1,15 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//bazel/platforms:local_config_platform.bzl", "setup_local_config_platform")
load("//bazel/toolchains:mongo_toolchain.bzl", "toolchain_download")
setup_local_config_platform(name = "local_config_platform")
toolchain_download(name = "mongo_toolchain")
register_toolchains("@mongo_toolchain//:mongo_toolchain")
load("//bazel/toolchains:python_toolchain.bzl", "setup_mongo_python_toolchains")
[register_toolchains(toolchain) for toolchain in setup_mongo_python_toolchains()]
http_archive(
@ -19,13 +20,14 @@ http_archive(
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "platforms",
sha256 = "8150406605389ececb6da07cbcb509d5637a3ab9a24bc69b1101531367d89d74",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.8/platforms-0.0.8.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.8/platforms-0.0.8.tar.gz",
],
sha256 = "8150406605389ececb6da07cbcb509d5637a3ab9a24bc69b1101531367d89d74",
)
# We need skylib to be able to use config_setting_group in rule_poetry below

View File

@ -1,36 +1,35 @@
load(
"//bazel/config:configs.bzl",
"allocator",
"asan",
"build_enterprise",
"build_grpc",
"build_mode",
"compiler_type",
"libunwind",
"use_gdbserver",
"spider_monkey_dbg",
"allocator",
"use_lldbserver",
"use_wait_for_debugger",
"use_disable_ref_track",
"use_ocsp_stapling",
"asan",
"detect_odr_violations",
"fsan",
"http_client",
"libunwind",
"linker",
"linkstatic",
"lsan",
"msan",
"separate_debug",
"shared_archive",
"spider_monkey_dbg",
"streams_release_build",
"tsan",
"ubsan",
"use_wiredtiger",
"use_diagnostic_latches",
"use_disable_ref_track",
"use_gdbserver",
"use_glibcxx_debug",
"use_libcxx",
"build_grpc",
"separate_debug",
"http_client",
"linkstatic",
"use_diagnostic_latches",
"shared_archive",
"linker",
"detect_odr_violations",
"build_enterprise",
"streams_release_build",
"use_lldbserver",
"use_ocsp_stapling",
"use_wait_for_debugger",
"use_wiredtiger",
)
load("@bazel_skylib//lib:selects.bzl", "selects")
package(default_visibility = ["//visibility:public"])
@ -127,7 +126,10 @@ config_setting(
selects.config_setting_group(
name = "not_windows",
match_any = ["@platforms//os:macos", "@platforms//os:linux"],
match_any = [
"@platforms//os:macos",
"@platforms//os:linux",
],
)
# ==========
@ -326,19 +328,28 @@ config_setting(
selects.config_setting_group(
name = "_libunwind_enabled_by_auto",
match_all = [":_libunwind_auto", "@platforms//os:linux"],
match_all = [
":_libunwind_auto",
"@platforms//os:linux",
],
)
selects.config_setting_group(
name = "_libunwind_enabled_by_on",
match_all = [":_libunwind_on", "@platforms//os:linux"],
match_all = [
":_libunwind_on",
"@platforms//os:linux",
],
)
# Final setting intended for external use.
# (libunwind == on && os == linux) || (libunwind == auto && os == linux)
selects.config_setting_group(
name = "libunwind_enabled",
match_any = [":_libunwind_enabled_by_on", ":_libunwind_enabled_by_auto"],
match_any = [
":_libunwind_enabled_by_on",
":_libunwind_enabled_by_auto",
],
)
# --------------------------------------
@ -354,7 +365,7 @@ config_setting(
name = "use_gdbserver_enabled",
flag_values = {
"//bazel/config:use_gdbserver": "True",
}
},
)
# --------------------------------------
@ -372,7 +383,7 @@ config_setting(
name = "spider_monkey_dbg_enabled",
flag_values = {
"//bazel/config:spider_monkey_dbg": "True",
}
},
)
# --------------------------------------
@ -438,7 +449,7 @@ config_setting(
name = "use_lldbserver_enabled",
flag_values = {
"//bazel/config:use_lldbserver": "True",
}
},
)
# --------------------------------------
@ -454,10 +465,9 @@ config_setting(
name = "use_wait_for_debugger_enabled",
flag_values = {
"//bazel/config:use_wait_for_debugger": "True",
}
},
)
# --------------------------------------
# ocsp-stapling options
# --------------------------------------
@ -471,7 +481,7 @@ config_setting(
name = "use_ocsp_stapling_enabled",
flag_values = {
"//bazel/config:use_ocsp_stapling": "True",
}
},
)
# --------------------------------------
@ -537,10 +547,13 @@ config_setting(
selects.config_setting_group(
name = "use_glibcxx_debug_required_settings",
#TODO SERVER-84714 add check to ensure we are using the toolchain version of C++ libs
match_all = [":use_glibcxx_debug_enabled", ":dbg", ":use_libcxx_disabled"],
match_all = [
":use_glibcxx_debug_enabled",
":dbg",
":use_libcxx_disabled",
],
)
# --------------------------------------
# libc++ options
# --------------------------------------
@ -553,12 +566,12 @@ use_libcxx(
# TODO SERVER-85340 when libc++ is readded remove the macos constraint
config_setting(
name = "use_libcxx_enabled",
flag_values = {
"//bazel/config:use_libcxx": "True",
},
constraint_values = [
"@platforms//os:macos",
],
flag_values = {
"//bazel/config:use_libcxx": "True",
},
)
config_setting(
@ -572,7 +585,10 @@ config_setting(
# ----------- computed libc++ flags ----------
selects.config_setting_group(
name = "use_libcxx_required_settings",
match_all = [":use_libcxx_enabled", ":compiler_type_clang"],
match_all = [
":use_libcxx_enabled",
":compiler_type_clang",
],
)
# --------------------------------------
@ -619,7 +635,10 @@ config_setting(
selects.config_setting_group(
name = "linkdynamic_required_settings",
match_all = [":linkstatic_disabled", ":not_windows"],
match_all = [
":linkstatic_disabled",
":not_windows",
],
)
# --------------------------------------
@ -757,37 +776,66 @@ config_setting(
selects.config_setting_group(
name = "sanitize_build_mode",
match_any = [":opt_on", ":opt_debug"],
match_any = [
":opt_on",
":opt_debug",
],
)
selects.config_setting_group(
name = "all_sanitizer_required_settings",
match_all = [":sanitize_build_mode", ":compiler_type_clang"]
match_all = [
":sanitize_build_mode",
":compiler_type_clang",
],
)
selects.config_setting_group(
name = "any_enabled_sanitizer",
match_any = [":asan_enabled", ":fsan_enabled", ":msan_enabled", ":lsan_enabled", ":tsan_enabled", ":ubsan_enabled"],
match_any = [
":asan_enabled",
":fsan_enabled",
":msan_enabled",
":lsan_enabled",
":tsan_enabled",
":ubsan_enabled",
],
)
selects.config_setting_group(
name = "no_enabled_sanitizer",
match_all = [":asan_disabled", ":fsan_disabled", ":msan_disabled", ":lsan_disabled", ":tsan_disabled", ":ubsan_disabled"],
match_all = [
":asan_disabled",
":fsan_disabled",
":msan_disabled",
":lsan_disabled",
":tsan_disabled",
":ubsan_disabled",
],
)
selects.config_setting_group(
name = "any_sanitizer_required_setting",
match_all = [":any_enabled_sanitizer", ":all_sanitizer_required_settings"],
match_all = [
":any_enabled_sanitizer",
":all_sanitizer_required_settings",
],
)
selects.config_setting_group(
name = "sanitize_address_required_settings",
match_all = [":asan_enabled", ":system_allocator"],
match_all = [
":asan_enabled",
":system_allocator",
],
)
selects.config_setting_group(
name = "sanitize_memory_required_settings",
match_all = [":msan_enabled", ":system_allocator"],
match_all = [
":msan_enabled",
":system_allocator",
],
)
selects.config_setting_group(
@ -797,17 +845,27 @@ selects.config_setting_group(
selects.config_setting_group(
name = "sanitize_thread_required_settings",
match_all = [":tsan_enabled", ":use_libunwind_disabled", ":linkdynamic_required_settings"],
match_all = [
":tsan_enabled",
":use_libunwind_disabled",
":linkdynamic_required_settings",
],
)
selects.config_setting_group(
name = "sanitize_undefined_without_fuzzer_settings",
match_all = [":ubsan_enabled", ":fsan_disabled"],
match_all = [
":ubsan_enabled",
":fsan_disabled",
],
)
selects.config_setting_group(
name = "sanitize_undefined_dynamic_link_settings",
match_all = [":ubsan_enabled", ":linkdynamic_required_settings"],
match_all = [
":ubsan_enabled",
":linkdynamic_required_settings",
],
)
# --------------------------------------
@ -832,14 +890,14 @@ config_setting(
http_client(
name = "http_client",
build_setting_default = True
build_setting_default = True,
)
config_setting(
name = "http_client_enabled",
flag_values = {
"//bazel/config:http_client": "True",
}
},
)
config_setting(
@ -855,14 +913,14 @@ config_setting(
use_diagnostic_latches(
name = "use_diagnostic_latches",
build_setting_default = True
build_setting_default = True,
)
config_setting(
name = "use_diagnostic_latches_enabled",
flag_values = {
"//bazel/config:use_diagnostic_latches": "True",
}
},
)
config_setting(
@ -913,7 +971,11 @@ config_setting(
selects.config_setting_group(
name = "detect_odr_violations_required_settings",
match_all = [":opt_off", ":detect_odr_violations_enabled", ":linker_gold"],
match_all = [
":opt_off",
":detect_odr_violations_enabled",
":linker_gold",
],
)
# --------------------------------------
@ -964,7 +1026,10 @@ config_setting(
selects.config_setting_group(
name = "platform_for_streaming_build",
match_any = [":linux_aarch64", ":linux_x86_64"],
match_any = [
":linux_aarch64",
":linux_x86_64",
],
)
# TODO: another conditional check for openssl is required to be ported from -
@ -972,5 +1037,9 @@ selects.config_setting_group(
# Depends on: https://jira.mongodb.org/browse/SERVER-80599
selects.config_setting_group(
name = "streams_release_build_required_setting",
match_all = [":release", ":streams_release_build_enabled", ":platform_for_streaming_build"],
match_all = [
":release",
":streams_release_build_enabled",
":platform_for_streaming_build",
],
)

View File

@ -3,10 +3,8 @@ load("@poetry//:dependencies.bzl", "dependency")
# config selection
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("//bazel:separate_debug.bzl", "extract_debuginfo", "WITH_DEBUG_SUFFIX", "CC_SHARED_LIBRARY_SUFFIX")
load("//bazel:separate_debug.bzl", "CC_SHARED_LIBRARY_SUFFIX", "WITH_DEBUG_SUFFIX", "extract_debuginfo")
# === Windows-specific compilation settings ===
# /RTC1 Enable Stack Frame Run-Time Error Checking; Reports when a variable is used without having been initialized (implies /Od: no optimizations)
@ -27,7 +25,7 @@ WINDOWS_DBG_COPTS = [
"/MDd",
"/RTC1",
"/Od",
"/pdbpagesize:16384"
"/pdbpagesize:16384",
]
WINDOWS_OPT_ON_COPTS = [
@ -38,7 +36,7 @@ WINDOWS_OPT_ON_COPTS = [
WINDOWS_OPT_OFF_COPTS = [
"/Od",
"/pdbpagesize:16384"
"/pdbpagesize:16384",
]
WINDOWS_OPT_DBG_COPTS = [
@ -122,7 +120,6 @@ LIBUNWIND_DEFINES = select({
"//bazel/config:_libunwind_auto": [],
}, no_match_error = REQUIRED_SETTINGS_LIBUNWIND_ERROR_MESSAGE)
REQUIRED_SETTINGS_SANITIZER_ERROR_MESSAGE = (
"\nError:\n" +
" any sanitizer requires these configurations:\n" +
@ -131,12 +128,13 @@ REQUIRED_SETTINGS_SANITIZER_ERROR_MESSAGE = (
)
# -fno-omit-frame-pointer should be added if any sanitizer flag is used by user
ANY_SANITIZER_AVAILABLE_COPTS = select({
ANY_SANITIZER_AVAILABLE_COPTS = select(
{
"//bazel/config:no_enabled_sanitizer": [],
"//bazel/config:any_sanitizer_required_setting": ["-fno-omit-frame-pointer"],
},
no_match_error = REQUIRED_SETTINGS_SANITIZER_ERROR_MESSAGE)
no_match_error = REQUIRED_SETTINGS_SANITIZER_ERROR_MESSAGE,
)
SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE = (
"\nError:\n" +
@ -144,62 +142,76 @@ SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE = (
" --//bazel/config:allocator=system\n"
)
ADDRESS_SANITIZER_COPTS = select({
ADDRESS_SANITIZER_COPTS = select(
{
("//bazel/config:sanitize_address_required_settings"): ["-fsanitize=address"],
"//bazel/config:asan_disabled": [],
}
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
},
no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE,
)
ADDRESS_SANITIZER_LINKFLAGS = select({
ADDRESS_SANITIZER_LINKFLAGS = select(
{
("//bazel/config:sanitize_address_required_settings"): ["-fsanitize=address"],
"//bazel/config:asan_disabled": [],
}
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
},
no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE,
)
# Unfortunately, abseil requires that we make these macros
# (this, and THREAD_ and UNDEFINED_BEHAVIOR_ below) set,
# because apparently it is too hard to query the running
# compiler. We do this unconditionally because abseil is
# basically pervasive via the 'base' library.
ADDRESS_SANITIZER_DEFINES = select({
ADDRESS_SANITIZER_DEFINES = select(
{
("//bazel/config:sanitize_address_required_settings"): ["ADDRESS_SANITIZER"],
"//bazel/config:asan_disabled": [],
}
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
},
no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE,
)
# Makes it easier to debug memory failures at the cost of some perf: -fsanitize-memory-track-origins
MEMORY_SANITIZER_COPTS = select({
MEMORY_SANITIZER_COPTS = select(
{
("//bazel/config:sanitize_memory_required_settings"): ["-fsanitize=memory", "-fsanitize-memory-track-origins"],
("//bazel/config:msan_disabled"): [],
}
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
},
no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE,
)
# Makes it easier to debug memory failures at the cost of some perf: -fsanitize-memory-track-origins
MEMORY_SANITIZER_LINKFLAGS = select({
MEMORY_SANITIZER_LINKFLAGS = select(
{
("//bazel/config:sanitize_memory_required_settings"): ["-fsanitize=memory"],
("//bazel/config:msan_disabled"): [],
}
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
},
no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE,
)
GENERIC_SANITIZER_ERROR_MESSAGE = (
"Failed to enable sanitizers with flag: "
)
# We can't include the fuzzer flag with the other sanitize flags
# The libfuzzer library already has a main function, which will cause the dependencies check
# to fail
FUZZER_SANITIZER_COPTS = select({
FUZZER_SANITIZER_COPTS = select(
{
("//bazel/config:sanitize_fuzzer_required_settings"): ["-fsanitize=fuzzer-no-link", "-fprofile-instr-generate", "-fcoverage-mapping"],
("//bazel/config:fsan_disabled"): [],
}
, no_match_error = GENERIC_SANITIZER_ERROR_MESSAGE + "fuzzer")
},
no_match_error = GENERIC_SANITIZER_ERROR_MESSAGE + "fuzzer",
)
# These flags are needed to generate a coverage report
FUZZER_SANITIZER_LINKFLAGS = select({
FUZZER_SANITIZER_LINKFLAGS = select(
{
("//bazel/config:sanitize_fuzzer_required_settings"): ["-fsanitize=fuzzer-no-link", "-fprofile-instr-generate", "-fcoverage-mapping"],
("//bazel/config:fsan_disabled"): [],
}
, no_match_error = GENERIC_SANITIZER_ERROR_MESSAGE + "fuzzer")
},
no_match_error = GENERIC_SANITIZER_ERROR_MESSAGE + "fuzzer",
)
# Combines following two conditions -
# 1.
@ -239,7 +251,6 @@ THREAD_SANITIZER_DEFINES = select({
("//bazel/config:tsan_disabled"): [],
}, no_match_error = THREAD_SANITIZER_ERROR_MESSAGE)
UNDEFINED_SANITIZER_DEFINES = select({
("//bazel/config:ubsan_enabled"): ["UNDEFINED_BEHAVIOR_SANITIZER"],
("//bazel/config:ubsan_disabled"): [],
@ -311,25 +322,23 @@ DETECT_ODR_VIOLATIONS_ERROR_MESSAGE = (
" --//bazel/config:linker=gold\n"
)
DETECT_ODR_VIOLATIONS_LINKFLAGS = select({
("//bazel/config:detect_odr_violations_required_settings"): ["-Wl,--detect-odr-violations"],
("//bazel/config:detect_odr_violations_disabled"): [],
}, no_match_error = DETECT_ODR_VIOLATIONS_ERROR_MESSAGE)
MONGO_GLOBAL_DEFINES = DEBUG_DEFINES + LIBCXX_DEFINES + ADDRESS_SANITIZER_DEFINES \
+ THREAD_SANITIZER_DEFINES + UNDEFINED_SANITIZER_DEFINES + GLIBCXX_DEBUG_DEFINES
MONGO_GLOBAL_DEFINES = DEBUG_DEFINES + LIBCXX_DEFINES + ADDRESS_SANITIZER_DEFINES + \
THREAD_SANITIZER_DEFINES + UNDEFINED_SANITIZER_DEFINES + GLIBCXX_DEBUG_DEFINES
MONGO_GLOBAL_COPTS = ["-Isrc"] + WINDOWS_COPTS + LIBCXX_COPTS + ADDRESS_SANITIZER_COPTS \
+ MEMORY_SANITIZER_COPTS + FUZZER_SANITIZER_COPTS + UNDEFINED_SANITIZER_COPTS \
+ THREAD_SANITIZER_COPTS + ANY_SANITIZER_AVAILABLE_COPTS
MONGO_GLOBAL_COPTS = ["-Isrc"] + WINDOWS_COPTS + LIBCXX_COPTS + ADDRESS_SANITIZER_COPTS + \
MEMORY_SANITIZER_COPTS + FUZZER_SANITIZER_COPTS + UNDEFINED_SANITIZER_COPTS + \
THREAD_SANITIZER_COPTS + ANY_SANITIZER_AVAILABLE_COPTS
MONGO_GLOBAL_LINKFLAGS = MEMORY_SANITIZER_LINKFLAGS + ADDRESS_SANITIZER_LINKFLAGS + FUZZER_SANITIZER_LINKFLAGS \
+ UNDEFINED_SANITIZER_LINKFLAGS + THREAD_SANITIZER_LINKFLAGS \
+ LIBCXX_LINKFLAGS + LINKER_LINKFLAGS + DETECT_ODR_VIOLATIONS_LINKFLAGS
MONGO_GLOBAL_LINKFLAGS = MEMORY_SANITIZER_LINKFLAGS + ADDRESS_SANITIZER_LINKFLAGS + FUZZER_SANITIZER_LINKFLAGS + \
UNDEFINED_SANITIZER_LINKFLAGS + THREAD_SANITIZER_LINKFLAGS + \
LIBCXX_LINKFLAGS + LINKER_LINKFLAGS + DETECT_ODR_VIOLATIONS_LINKFLAGS
def force_includes_copt(package_name, name):
if package_name.startswith("src/mongo"):
basic_h = "mongo/platform/basic.h"
return select({
@ -348,7 +357,7 @@ def force_includes_copt(package_name, name):
"//bazel/config:macos_aarch64": ["-include", "third_party/mozjs/platform/aarch64/macOS/build/js-confdefs.h"],
})
if name in ['scripting', 'scripting_mozjs_test', 'encrypted_dbclient']:
if name in ["scripting", "scripting_mozjs_test", "encrypted_dbclient"]:
return select({
"//bazel/config:linux_aarch64": ["-include", "third_party/mozjs/platform/aarch64/linux/build/js-config.h"],
"//bazel/config:linux_x86_64": ["-include", "third_party/mozjs/platform/x86_64/linux/build/js-config.h"],
@ -380,7 +389,7 @@ def force_includes_hdr(package_name, name):
"//bazel/config:macos_aarch64": ["//src/third_party/mozjs:platform/aarch64/macOS/build/js-confdefs.h"],
})
if name in ['scripting', 'scripting_mozjs_test', 'encrypted_dbclient']:
if name in ["scripting", "scripting_mozjs_test", "encrypted_dbclient"]:
return select({
"//bazel/config:linux_aarch64": ["//src/third_party/mozjs:platform/aarch64/linux/build/js-config.h"],
"//bazel/config:linux_x86_64": ["//src/third_party/mozjs:platform/x86_64/linux/build/js-config.h"],
@ -441,8 +450,8 @@ def mongo_cc_library(
if name != "tcmalloc_minimal":
deps += TCMALLOC_DEPS
linux_rpath_flags = ['-Wl,-z,origin', '-Wl,--enable-new-dtags', '-Wl,-rpath,\\$$ORIGIN/../lib', "-Wl,-h,lib" + name + ".so"]
macos_rpath_flags = ['-Wl,-rpath,\\$$ORIGIN/../lib', "-Wl,-install_name,@rpath/lib" + name + ".so"]
linux_rpath_flags = ["-Wl,-z,origin", "-Wl,--enable-new-dtags", "-Wl,-rpath,\\$$ORIGIN/../lib", "-Wl,-h,lib" + name + ".so"]
macos_rpath_flags = ["-Wl,-rpath,\\$$ORIGIN/../lib", "-Wl,-install_name,@rpath/lib" + name + ".so"]
rpath_flags = select({
"//bazel/config:linux_aarch64": linux_rpath_flags,
@ -527,8 +536,8 @@ def mongo_cc_library(
"//bazel/config:linkstatic_disabled": ":" + name + CC_SHARED_LIBRARY_SUFFIX + WITH_DEBUG_SUFFIX,
"//conditions:default": None,
}),
deps = deps)
deps = deps,
)
def mongo_cc_binary(
name,
@ -570,8 +579,8 @@ def mongo_cc_binary(
all_deps = deps + LIBUNWIND_DEPS + TCMALLOC_DEPS
linux_rpath_flags = ['-Wl,-z,origin', '-Wl,--enable-new-dtags', '-Wl,-rpath,\\$$ORIGIN/../lib']
macos_rpath_flags = ['-Wl,-rpath,\\$$ORIGIN/../lib']
linux_rpath_flags = ["-Wl,-z,origin", "-Wl,--enable-new-dtags", "-Wl,-rpath,\\$$ORIGIN/../lib"]
macos_rpath_flags = ["-Wl,-rpath,\\$$ORIGIN/../lib"]
rpath_flags = select({
"//bazel/config:linux_aarch64": linux_rpath_flags,
@ -608,8 +617,8 @@ def mongo_cc_binary(
binary_with_debug = ":" + name + WITH_DEBUG_SUFFIX,
type = "program",
enabled = SEPARATE_DEBUG_ENABLED,
deps = all_deps)
deps = all_deps,
)
IdlInfo = provider(
fields = {
@ -638,23 +647,29 @@ def idl_generator_impl(ctx):
inputs = depset(transitive = [
ctx.attr.src.files,
ctx.attr.idlc.files,
python.files] + dep_depsets + py_depsets)
python.files,
] + dep_depsets + py_depsets)
ctx.actions.run(
executable = python.interpreter.path,
outputs = [gen_source, gen_header],
inputs = inputs,
arguments = [
'buildscripts/idl/idlc.py',
'--include', 'src',
'--base_dir', ctx.bin_dir.path + '/src',
'--target_arch', ctx.var['TARGET_CPU'],
'--header', gen_header.path,
'--output', gen_source.path,
ctx.attr.src.files.to_list()[0].path
"buildscripts/idl/idlc.py",
"--include",
"src",
"--base_dir",
ctx.bin_dir.path + "/src",
"--target_arch",
ctx.var["TARGET_CPU"],
"--header",
gen_header.path,
"--output",
gen_source.path,
ctx.attr.src.files.to_list()[0].path,
],
mnemonic = "IdlcGenerator",
env={"PYTHONPATH":ctx.configuration.host_path_separator.join(python_path)}
env = {"PYTHONPATH": ctx.configuration.host_path_separator.join(python_path)},
)
return [
@ -662,8 +677,8 @@ def idl_generator_impl(ctx):
files = depset([gen_source, gen_header]),
),
IdlInfo(
idl_deps = depset(ctx.attr.src.files.to_list(), transitive=[dep[IdlInfo].idl_deps for dep in ctx.attr.deps])
)
idl_deps = depset(ctx.attr.src.files.to_list(), transitive = [dep[IdlInfo].idl_deps for dep in ctx.attr.deps]),
),
]
idl_generator = rule(
@ -680,7 +695,7 @@ idl_generator = rule(
"py_deps": attr.label_list(
doc = "Python modules that should be imported.",
providers = [PyInfo],
default=[dependency("pyyaml", group="core"), dependency("pymongo", group="core")]
default = [dependency("pyyaml", group = "core"), dependency("pymongo", group = "core")],
),
"deps": attr.label_list(
doc = "Other idl files that need to be imported.",
@ -689,5 +704,5 @@ idl_generator = rule(
},
doc = "Generates header/source files from IDL files.",
toolchains = ["@bazel_tools//tools/python:toolchain_type"],
fragments = ["py"]
fragments = ["py"],
)

View File

@ -1,5 +1,6 @@
# Define supported build platforms.
load("//bazel/platforms:remote_execution_containers.bzl", "REMOTE_EXECUTION_CONTAINERS")
package(default_visibility = ["//visibility:public"])
[
@ -11,11 +12,14 @@ package(default_visibility = ["//visibility:public"])
"@bazel_tools//tools/cpp:" + compiler,
],
exec_properties = {
"container-image": REMOTE_EXECUTION_CONTAINERS["linux_arm64"]['container-image'],
"dockerNetwork": "standard"
}
"container-image": REMOTE_EXECUTION_CONTAINERS["linux_arm64"]["container-image"],
"dockerNetwork": "standard",
},
)
for compiler in ["clang", "gcc"]
for compiler in [
"clang",
"gcc",
]
]
[
@ -27,11 +31,14 @@ package(default_visibility = ["//visibility:public"])
"@bazel_tools//tools/cpp:" + compiler,
],
exec_properties = {
"container-image": REMOTE_EXECUTION_CONTAINERS["linux_amd64"]['container-image'],
"dockerNetwork": "standard"
}
"container-image": REMOTE_EXECUTION_CONTAINERS["linux_amd64"]["container-image"],
"dockerNetwork": "standard",
},
)
for compiler in ["clang", "gcc"]
for compiler in [
"clang",
"gcc",
]
]
platform(
@ -40,7 +47,7 @@ platform(
"@platforms//cpu:x86_64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:msvc",
]
],
)
platform(
@ -49,7 +56,7 @@ platform(
"@platforms//cpu:arm64",
"@platforms//os:macos",
"@bazel_tools//tools/cpp:clang",
]
],
)
platform(
@ -58,5 +65,5 @@ platform(
"@platforms//cpu:x86_64",
"@platforms//os:macos",
"@bazel_tools//tools/cpp:clang",
]
],
)

View File

@ -37,20 +37,20 @@ def _setup_local_config_platform(ctx):
# So Starlark doesn't throw an indentation error when this gets injected.
constraints_str = ",\n ".join(['"%s"' % c for c in constraints])
if os == "linux" and arch in ['aarch64']:
if os == "linux" and arch in ["aarch64"]:
exec_props = """
exec_properties = {
"container-image": "%s",
"dockerNetwork": "standard"
},
""" % REMOTE_EXECUTION_CONTAINERS["linux_arm64"]['container-image']
elif os == "linux" and arch in ['amd64', 'x86_64']:
""" % REMOTE_EXECUTION_CONTAINERS["linux_arm64"]["container-image"]
elif os == "linux" and arch in ["amd64", "x86_64"]:
exec_props = """
exec_properties = {
"container-image": "%s",
"dockerNetwork": "standard"
},
""" % REMOTE_EXECUTION_CONTAINERS["linux_amd64"]['container-image']
""" % REMOTE_EXECUTION_CONTAINERS["linux_amd64"]["container-image"]
else:
exec_props = ""

View File

@ -1,4 +1,3 @@
REMOTE_EXECUTION_CONTAINERS = {
"linux_amd64": {
# debian gcc based image contains the base our toolchain needs (glibc version and build-essentials)
@ -9,5 +8,5 @@ REMOTE_EXECUTION_CONTAINERS = {
# debian gcc based image contains the base our toolchain needs (glibc version and build-essentials)
# https://hub.docker.com/layers/library/gcc/12.3-bookworm/images/sha256-6a3a5694d10299dbfb8747b98621abf4593bb54a5396999caa013cba0e17dd4f?context=explore
"container-image": "docker://docker.io/library/gcc@sha256:6a3a5694d10299dbfb8747b98621abf4593bb54a5396999caa013cba0e17dd4f",
}
},
}

View File

@ -92,10 +92,10 @@ def create_new_ccinfo_library(ctx, cc_toolchain, shared_lib, static_lib, cc_shar
feature_configuration = feature_configuration,
cc_toolchain = cc_toolchain,
dynamic_library = shared_lib,
static_library = static_lib
static_library = static_lib,
),
]),
user_link_flags = ctx.attr.binary_with_debug[CcInfo].linking_context.linker_inputs.to_list()[0].user_link_flags
user_link_flags = ctx.attr.binary_with_debug[CcInfo].linking_context.linker_inputs.to_list()[0].user_link_flags,
)
linker_input_deps = []
@ -159,7 +159,6 @@ def create_new_cc_shared_library_info(ctx, cc_toolchain, output_shared_lib, orig
)
def noop_extraction(ctx):
return [
DefaultInfo(
files = depset(transitive = [ctx.attr.binary_with_debug.files]),
@ -168,7 +167,6 @@ def noop_extraction(ctx):
]
def linux_extraction(ctx, cc_toolchain, inputs):
outputs = []
input_bin, output_bin, debug_info, static_lib = get_inputs_and_outputs(ctx, ".so", ".a", ".debug")
@ -179,9 +177,9 @@ def linux_extraction(ctx, cc_toolchain, inputs):
outputs = [debug_info],
inputs = inputs,
arguments = [
'--only-keep-debug',
"--only-keep-debug",
input_bin.path,
debug_info.path
debug_info.path,
],
mnemonic = "ExtractDebuginfo",
)
@ -192,7 +190,8 @@ def linux_extraction(ctx, cc_toolchain, inputs):
inputs = depset([debug_info], transitive = [inputs]),
arguments = [
"--strip-debug",
"--add-gnu-debuglink", debug_info.path,
"--add-gnu-debuglink",
debug_info.path,
input_bin.path,
output_bin.path,
],
@ -220,13 +219,12 @@ def linux_extraction(ctx, cc_toolchain, inputs):
if ctx.attr.cc_shared_library != None:
provided_info.append(
create_new_cc_shared_library_info(ctx, cc_toolchain, output_bin, ctx.attr.cc_shared_library[CcSharedLibraryInfo], static_lib)
create_new_cc_shared_library_info(ctx, cc_toolchain, output_bin, ctx.attr.cc_shared_library[CcSharedLibraryInfo], static_lib),
)
return provided_info
def macos_extraction(ctx, cc_toolchain, inputs):
outputs = []
input_bin, output_bin, debug_info, static_lib = get_inputs_and_outputs(ctx, ".dylib", ".a", ".dSYM")
@ -237,9 +235,11 @@ def macos_extraction(ctx, cc_toolchain, inputs):
outputs = [debug_info],
inputs = inputs,
arguments = [
'-num-threads', '1',
"-num-threads",
"1",
input_bin.path,
'-o', debug_info.path
"-o",
debug_info.path,
],
mnemonic = "ExtractDebuginfo",
)
@ -250,8 +250,9 @@ def macos_extraction(ctx, cc_toolchain, inputs):
inputs = depset([debug_info], transitive = [inputs]),
arguments = [
"-S",
"-o", output_bin.path,
input_bin.path
"-o",
output_bin.path,
input_bin.path,
],
mnemonic = "StripDebuginfo",
)
@ -277,13 +278,12 @@ def macos_extraction(ctx, cc_toolchain, inputs):
if ctx.attr.cc_shared_library != None:
provided_info.append(
create_new_cc_shared_library_info(ctx, cc_toolchain, output_bin, ctx.attr.cc_shared_library[CcSharedLibraryInfo])
create_new_cc_shared_library_info(ctx, cc_toolchain, output_bin, ctx.attr.cc_shared_library[CcSharedLibraryInfo]),
)
return provided_info
def windows_extraction(ctx, cc_toolchain, inputs):
if ctx.attr.type == "library":
ext = ".lib"
elif ctx.attr.type == "program":
@ -298,8 +298,7 @@ def windows_extraction(ctx, cc_toolchain, inputs):
output_library = None
output_dynamic_library = None
for input in ctx.attr.binary_with_debug.files.to_list():
ext = '.' + input.extension
ext = "." + input.extension
basename = input.basename[:-len(WITH_DEBUG_SUFFIX + ext)]
output = ctx.actions.declare_file(basename + ext)
@ -324,13 +323,12 @@ def windows_extraction(ctx, cc_toolchain, inputs):
if ctx.attr.cc_shared_library != None:
provided_info.append(
create_new_cc_shared_library_info(ctx, cc_toolchain, output_dynamic_library, ctx.attr.cc_shared_library[CcSharedLibraryInfo])
create_new_cc_shared_library_info(ctx, cc_toolchain, output_dynamic_library, ctx.attr.cc_shared_library[CcSharedLibraryInfo]),
)
return provided_info
def extract_debuginfo_impl(ctx):
# some cases (header file groups) there is no input files to do
# anything with, besides forward things along.
if not ctx.attr.binary_with_debug.files.to_list():
@ -340,7 +338,8 @@ def extract_debuginfo_impl(ctx):
inputs = depset(transitive = [
ctx.attr.binary_with_debug.files,
ctx.attr.cc_shared_library.files if ctx.attr.cc_shared_library != None else depset([]),
cc_toolchain.all_files])
cc_toolchain.all_files,
])
linux_constraint = ctx.attr._linux_constraint[platform_common.ConstraintValueInfo]
macos_constraint = ctx.attr._macos_constraint[platform_common.ConstraintValueInfo]
@ -361,7 +360,7 @@ extract_debuginfo = rule(
allow_files = True,
),
"type": attr.string(
doc = "Set to either 'library' or 'program' to discern how to extract the info."
doc = "Set to either 'library' or 'program' to discern how to extract the info.",
),
"enabled": attr.bool(default = False, doc = "Flag to enable/disable separate debug generation."),
"deps": attr.label_list(providers = [CcInfo]),
@ -373,9 +372,8 @@ extract_debuginfo = rule(
"_linux_constraint": attr.label(default = "@platforms//os:linux"),
"_macos_constraint": attr.label(default = "@platforms//os:macos"),
"_windows_constraint": attr.label(default = "@platforms//os:windows"),
},
doc = "Extract debuginfo into a separate file",
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
fragments = ["cpp"]
fragments = ["cpp"],
)

View File

@ -64,9 +64,9 @@ lto_index_actions = [
def _impl(ctx):
action_configs = [
action_config(action_name = "objcopy_embed_data", tools = [tool(path = ctx.attr.tool_paths["objcopy"])])
action_config(action_name = "objcopy_embed_data", tools = [tool(path = ctx.attr.tool_paths["objcopy"])]),
] + [
action_config(action_name = ACTION_NAMES.llvm_cov, tools = [tool(path = ctx.attr.tool_paths["llvm-cov"])])
action_config(action_name = ACTION_NAMES.llvm_cov, tools = [tool(path = ctx.attr.tool_paths["llvm-cov"])]),
] + [
action_config(action_name = name, enabled = True, tools = [tool(path = ctx.attr.tool_paths["gcc"])])
for name in all_c_compile_actions
@ -147,7 +147,7 @@ def _impl(ctx):
flag_group(
flags = [
"-std=c11",
]
],
),
],
),
@ -158,7 +158,7 @@ def _impl(ctx):
flags = [
"-std=c++20",
"-nostdinc++",
]
],
),
],
),
@ -510,7 +510,7 @@ def _impl(ctx):
tool_paths = [
tool_path(name = name, path = path)
for name, path in ctx.attr.tool_paths.items()
]
],
),
]

View File

@ -1,4 +1,3 @@
_OS_MAP = {
"macos": "@platforms//os:osx",
"linux": "@platforms//os:linux",
@ -29,7 +28,6 @@ URLS_MAP = {
}
def _toolchain_download(ctx):
if ctx.attr.os:
os = ctx.attr.os
else:
@ -59,8 +57,8 @@ def _toolchain_download(ctx):
if os_arch in URLS_MAP:
platform_info = URLS_MAP[os_arch]
urls = platform_info['url']
sha = platform_info['sha']
urls = platform_info["url"]
sha = platform_info["sha"]
ctx.report_progress("downloading mongo toolchain")
ctx.download_and_extract(

View File

@ -37,7 +37,7 @@ URLS_MAP = {
"sha": "178cb1716c2abc25cb56ae915096c1a083e60abeba57af001996e8bc6ce1a371",
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-apple-darwin-install_only.tar.gz",
"interpreter_path": "bin/python3",
}
},
}
def _py_download(ctx):
@ -48,11 +48,9 @@ def _py_download(ctx):
ctx: Repository context.
"""
if ctx.attr.os:
os = ctx.attr.os
else:
if "win" in ctx.os.name:
elif "win" in ctx.os.name:
os = "windows"
elif "mac" in ctx.os.name:
os = "macos"
@ -70,9 +68,9 @@ def _py_download(ctx):
interpreter_path = ctx.attr.interpreter_path
else:
platform_info = URLS_MAP["{os}_{arch}".format(os = os, arch = arch)]
urls = platform_info['url']
sha = platform_info['sha']
interpreter_path = platform_info['interpreter_path']
urls = platform_info["url"]
sha = platform_info["sha"]
interpreter_path = platform_info["interpreter_path"]
ctx.report_progress("downloading python")
ctx.download_and_extract(
@ -133,7 +131,6 @@ py_download = repository_rule(
)
def setup_mongo_python_toolchains():
# This will autoselect a toolchain that matches the host environment
# this toolchain is intended be used only for local repository exectutions,
# and will not be registered as a bazel toolchain by omitting from the return
@ -195,4 +192,3 @@ def setup_mongo_python_toolchains():
"@py_macos_arm64//:python_toolchain",
"@py_macos_x86_64//:python_toolchain",
)

View File

@ -6,5 +6,5 @@ package(default_visibility = ["//visibility:public"])
mongo_cc_binary(
name = "unit_test",
srcs = ["unit_test.cpp"]
srcs = ["unit_test.cpp"],
)

View File

@ -5,7 +5,7 @@ import stat
import urllib.request
BUILDIFIER_VERSION = "v6.4.0"
RELEASE_URL = f"https://mdb-build-public.s3.amazonaws.com/bazel-buildifier-binaries/v6.4.0/{BUILDIFIER_VERSION}/"
RELEASE_URL = f"https://mdb-build-public.s3.amazonaws.com/bazel-buildifier-binaries/{BUILDIFIER_VERSION}/"
def determine_platform():

View File

@ -1,5 +1,8 @@
filegroup(
name = "idlc",
srcs = ["idlc.py", "__init__.py"] + glob(["**/idl/*.py"]),
srcs = [
"__init__.py",
"idlc.py",
] + glob(["**/idl/*.py"]),
visibility = ["//visibility:public"],
)

View File

@ -17,9 +17,7 @@ core.workflow(
),
# Change path to the folder you want to publish publicly
origin_files = glob(["**"], exclude = ["src/mongo/db/modules/**"]),
authoring = authoring.pass_thru("MongoDB <mongodb@mongodb.com>"),
mode = "ITERATIVE",
# Change the path here to the folder you want to publish publicly
# transformations = [

View File

@ -17,9 +17,7 @@ core.workflow(
),
# Change path to the folder you want to publish publicly
origin_files = glob(["**"], exclude = ["src/mongo/db/modules/**"]),
authoring = authoring.pass_thru("MongoDB <mongodb@mongodb.com>"),
mode = "ITERATIVE",
# Change the path here to the folder you want to publish publicly
# transformations = [

View File

@ -679,6 +679,39 @@ tasks:
- "src/evergreen/run_python_script.sh"
- "evergreen/functions/poetry_lock_check.py"
- name: lint_bazel
tags: ["assigned_to_jira_team_devprod_build", "lint"]
commands:
- command: timeout.update
params:
# 40 minutes
exec_timeout_secs: 2400
- func: "f_expansions_write"
- command: manifest.load
- func: "git get project and add git tag"
- func: "f_expansions_write"
- func: "kill processes"
- func: "cleanup environment"
- func: "set up venv"
- func: "upload pip requirements"
- command: subprocess.exec
params:
binary: bash
add_expansions_to_env: true
args:
- "src/evergreen/run_python_script.sh"
- "buildscripts/download_buildifier.py"
- command: subprocess.exec
params:
binary: bash
add_expansions_to_env: true
args:
- "src/evergreen/run_python_script.sh"
- "buildscripts/buildifier.py"
- "--generate-report"
- "--binary-dir=./"
- "lint-all"
- name: lint_pylinters
tags: ["assigned_to_jira_team_devprod_build", "lint"]
commands:

View File

@ -1,8 +1,8 @@
load("//bazel:mongo_src_rules.bzl", "mongo_cc_library", "idl_generator")
load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_library")
package(default_visibility = ["//visibility:public"])
idl_generator(
name = "basic_types_gen",
src = "basic_types.idl"
src = "basic_types.idl",
)

View File

@ -1,4 +1,4 @@
load("//bazel:mongo_src_rules.bzl", "mongo_cc_library", "idl_generator")
load("//bazel:mongo_src_rules.bzl", "idl_generator", "mongo_cc_library")
package(default_visibility = ["//visibility:public"])
@ -8,14 +8,13 @@ mongo_cc_library(
hdrs = ["fsync_locked.h"],
)
idl_generator(
name = "test_commands_enabled_gen",
src = "test_commands_enabled.idl"
src = "test_commands_enabled.idl",
)
idl_generator(
name = "generic_gen",
src = "generic.idl",
deps = ['//src/mongo/db:basic_types_gen']
deps = ["//src/mongo/db:basic_types_gen"],
)

View File

@ -1,51 +1,51 @@
load("//bazel:mongo_src_rules.bzl", "mongo_cc_library", "mongo_cc_binary")
load("//bazel:mongo_src_rules.bzl", "mongo_cc_binary", "mongo_cc_library")
package(default_visibility = ["//visibility:public"])
mongo_cc_library(
name = "visibility_test_libcommon",
hdrs=[
"visibility_test_libcommon.h",
"visibility.h",
],
srcs = [
"visibility_test_libcommon.cpp",
],
hdrs = [
"visibility.h",
"visibility_test_libcommon.h",
],
)
mongo_cc_library(
name = "visibility_test_lib1",
deps=[
":visibility_test_libcommon"
srcs = [
"visibility_test_lib1.cpp",
],
hdrs = [
"visibility_test_lib1.h",
],
srcs=[
"visibility_test_lib1.cpp",
deps = [
":visibility_test_libcommon",
],
)
mongo_cc_library(
name = "visibility_test_lib2",
deps=[
":visibility_test_lib1"
srcs = [
"visibility_test_lib2.cpp",
],
hdrs = [
"visibility_test_lib2.h",
],
srcs=[
"visibility_test_lib2.cpp",
deps = [
":visibility_test_lib1",
],
)
mongo_cc_binary(
name = "visibility_test1",
srcs = [
"visibility_test1.cpp",
"//src/mongo/util:exit_code",
],
deps = [
":visibility_test_lib1",
],
srcs=[
"visibility_test1.cpp",
"//src/mongo/util:exit_code"
],
)

View File

@ -6,5 +6,5 @@ filegroup(
name = "exit_code",
srcs = [
"exit_code.h",
]
],
)

View File

@ -17,10 +17,6 @@ config_setting(
mongo_cc_library(
name = "tcmalloc_minimal",
hdrs = glob(["**/*.h"]) + [
# debugallocation.cc sources this as an include.
"dist/src/tcmalloc.cc"
],
srcs = [
"dist/src/base/dynamic_annotations.c",
"dist/src/base/elf_mem_image.cc",
@ -45,9 +41,9 @@ mongo_cc_library(
"dist/src/thread_cache.cc",
] + select({
"@platforms//os:windows": [
"dist/src/fake_stacktrace_scope.cc",
"dist/src/windows/port.cc",
"dist/src/windows/system-alloc.cc",
"dist/src/fake_stacktrace_scope.cc",
],
"//conditions:default": [
"dist/src/emergency_malloc_for_stacktrace.cc",
@ -59,6 +55,10 @@ mongo_cc_library(
"@platforms//os:linux": ["dist/src/tcmalloc.cc"],
"//conditions:default": [],
}),
hdrs = glob(["**/*.h"]) + [
# debugallocation.cc sources this as an include.
"dist/src/tcmalloc.cc",
],
copts = ["-Isrc/third_party/gperftools/dist/src"] + select({
"@//bazel/config:linux_aarch64": [
"-Isrc/third_party/gperftools/platform/linux_aarch64/internal/src",
@ -81,10 +81,10 @@ mongo_cc_library(
"/wd4305",
"/wd4003",
],
"//conditions:default": ["-Wno-unused-result"]
"//conditions:default": ["-Wno-unused-result"],
}) + select({
":gcc_windows": ["-Wno-attribute-alias"],
"//conditions:default": []
"//conditions:default": [],
}),
local_defines = [
"NO_HEAP_CHECK",
@ -94,22 +94,22 @@ mongo_cc_library(
# For debug builds we want to capture stacks during (de)allocations,
# but we don't want to pay that cost for release builds.
"NO_TCMALLOC_SAMPLES",
]
],
}) + select({
"@platforms//cpu:x86_64": [],
"//conditions:default": [
# For debug builds we enable stack capture, but only on
# intel targets, since tcmalloc's unwinder is very slow on other
# platforms (see SERVER-28502).
"NO_TCMALLOC_SAMPLES"
]
"NO_TCMALLOC_SAMPLES",
],
}) + select({
# GCC on PowerPC under C++11 mode does not define __linux which gperftools depends on
"@platforms//cpu:ppc": ["__linux"],
"//conditions:default": []
"//conditions:default": [],
}) + select({
"@//bazel/config:dbg": [],
"//conditions:default": ["NDEBUG"]
"//conditions:default": ["NDEBUG"],
}),
)

View File

@ -1,2 +1 @@
package(default_visibility = ["//visibility:public"])

View File

@ -15,7 +15,6 @@ config_setting(
mongo_cc_library(
name = "unwind",
hdrs=glob(["**/*.h", "**/*.c"]),
srcs = [
# Generated by a manual process:
# - Run "scripts/host_config.sh |tee host_config.out".
@ -56,13 +55,11 @@ mongo_cc_library(
"dist/src/mi/Lset_reg.c",
"dist/src/mi/mempool.c",
"dist/src/mi/strerror.c",
] +
select({
"@platforms//os:linux": ["dist/src/os-linux.c"]
] + select({
"@platforms//os:linux": ["dist/src/os-linux.c"],
}) +
select({
"@platforms//cpu:aarch64": [
"dist/src/aarch64/is_fpreg.c",
"dist/src/aarch64/Lapply_reg_state.c",
"dist/src/aarch64/Lcreate_addr_space.c",
"dist/src/aarch64/Lget_proc_info.c",
@ -71,17 +68,17 @@ mongo_cc_library(
"dist/src/aarch64/Linit.c",
"dist/src/aarch64/Linit_local.c",
"dist/src/aarch64/Linit_remote.c",
"dist/src/aarch64/Lregs.c",
"dist/src/aarch64/Lreg_states_iterate.c",
"dist/src/aarch64/Lresume.c",
"dist/src/aarch64/Lstep.c",
"dist/src/aarch64/regname.c",
"dist/src/aarch64/Lis_signal_frame.c",
"dist/src/aarch64/Lreg_states_iterate.c",
"dist/src/aarch64/Lregs.c",
"dist/src/aarch64/Lresume.c",
"dist/src/aarch64/Lstash_frame.c",
"dist/src/aarch64/Lstep.c",
"dist/src/aarch64/Ltrace.c",
"dist/src/aarch64/is_fpreg.c",
"dist/src/aarch64/regname.c",
],
"@platforms//cpu:x86_64": [
"dist/src/x86_64/is_fpreg.c",
"dist/src/x86_64/Lapply_reg_state.c",
"dist/src/x86_64/Lcreate_addr_space.c",
"dist/src/x86_64/Lget_proc_info.c",
@ -90,35 +87,35 @@ mongo_cc_library(
"dist/src/x86_64/Linit.c",
"dist/src/x86_64/Linit_local.c",
"dist/src/x86_64/Linit_remote.c",
"dist/src/x86_64/Lregs.c",
"dist/src/x86_64/Lreg_states_iterate.c",
"dist/src/x86_64/Lresume.c",
"dist/src/x86_64/Lstep.c",
"dist/src/x86_64/regname.c",
"dist/src/x86_64/Los-linux.c",
'dist/src/x86_64/Lstash_frame.c',
'dist/src/x86_64/Ltrace.c',
"dist/src/x86_64/Lreg_states_iterate.c",
"dist/src/x86_64/Lregs.c",
"dist/src/x86_64/Lresume.c",
"dist/src/x86_64/Lstash_frame.c",
"dist/src/x86_64/Lstep.c",
"dist/src/x86_64/Ltrace.c",
"dist/src/x86_64/is_fpreg.c",
"dist/src/x86_64/regname.c",
],
"@platforms//cpu:ppc": [
"dist/src/ppc64/is_fpreg.c",
"dist/src/ppc64/Lapply_reg_state.c",
"dist/src/ppc64/Lcreate_addr_space.c",
"dist/src/ppc/Lget_proc_info.c",
"dist/src/ppc/Lget_save_loc.c",
"dist/src/ppc64/Lglobal.c",
"dist/src/ppc64/Linit.c",
"dist/src/ppc/Linit_local.c",
"dist/src/ppc/Linit_remote.c",
"dist/src/ppc64/Lregs.c",
"dist/src/ppc/Lis_signal_frame.c",
"dist/src/ppc64/Lapply_reg_state.c",
"dist/src/ppc64/Lcreate_addr_space.c",
"dist/src/ppc64/Lglobal.c",
"dist/src/ppc64/Linit.c",
"dist/src/ppc64/Lreg_states_iterate.c",
"dist/src/ppc64/Lregs.c",
"dist/src/ppc64/Lresume.c",
"dist/src/ppc64/Lstep.c",
"dist/src/ppc64/regname.c",
"dist/src/ppc64/get_func_addr.c",
"dist/src/ppc/Lis_signal_frame.c",
"dist/src/ppc64/is_fpreg.c",
"dist/src/ppc64/regname.c",
],
"@platforms//cpu:s390x": [
"dist/src/s390x/is_fpreg.c",
"dist/src/s390x/Lapply_reg_state.c",
"dist/src/s390x/Lcreate_addr_space.c",
"dist/src/s390x/Lget_proc_info.c",
@ -127,12 +124,13 @@ mongo_cc_library(
"dist/src/s390x/Linit.c",
"dist/src/s390x/Linit_local.c",
"dist/src/s390x/Linit_remote.c",
"dist/src/s390x/Lregs.c",
"dist/src/s390x/Lis_signal_frame.c",
"dist/src/s390x/Lreg_states_iterate.c",
"dist/src/s390x/Lregs.c",
"dist/src/s390x/Lresume.c",
"dist/src/s390x/Lstep.c",
"dist/src/s390x/is_fpreg.c",
"dist/src/s390x/regname.c",
"dist/src/s390x/Lis_signal_frame.c",
],
}) + select({
"@platforms//cpu:aarch64": [
@ -148,6 +146,10 @@ mongo_cc_library(
"dist/src/s390x/setcontext.S",
],
}),
hdrs = glob([
"**/*.h",
"**/*.c",
]),
copts = [
"-Isrc/third_party/unwind/dist/src",
"-Isrc/third_party/unwind/dist/include",
@ -178,10 +180,10 @@ mongo_cc_library(
"@//bazel/config:compiler_type_clang": [
"-Wno-header-guard",
],
"@//bazel/config:compiler_type_gcc": ["-Wno-uninitialized"]
"@//bazel/config:compiler_type_gcc": ["-Wno-uninitialized"],
}) + select({
":clang_arm64": [
"-Wno-absolute-value"
"-Wno-absolute-value",
],
"//conditions:default": [],
}),