mirror of https://github.com/mongodb/mongo
SERVER-80018 add bazel formatting requirement to commit queue (#18477)
GitOrigin-RevId: 93b769fba497837206bcd1045a5cead0ddb36d08
This commit is contained in:
parent
d8515d576f
commit
ebd80c333f
|
|
@ -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",
|
||||
])
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
setup_local_config_platform(name = "local_config_platform")
|
||||
|
||||
toolchain_download(name = "mongo_toolchain")
|
||||
|
||||
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
|
||||
|
|
@ -57,7 +59,7 @@ poetry(
|
|||
name = "poetry",
|
||||
lockfile = "//:poetry.lock",
|
||||
pyproject = "//:pyproject.toml",
|
||||
python_interpreter_target_default="@py_host//:bin/python3",
|
||||
python_interpreter_target_mac="@py_host//:bin/python3",
|
||||
python_interpreter_target_win="@py_host//:python.exe",
|
||||
python_interpreter_target_default = "@py_host//:bin/python3",
|
||||
python_interpreter_target_mac = "@py_host//:bin/python3",
|
||||
python_interpreter_target_win = "@py_host//:python.exe",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
@ -63,10 +61,10 @@ WINDOWS_RELEASE_COPTS = [
|
|||
# TODO SERVER-85340 fix this error message when libc++ is readded to the toolchain
|
||||
LIBCXX_ERROR_MESSAGE = (
|
||||
"\nError:\n" +
|
||||
" libc++ is not currently supported in the mongo toolchain.\n"+
|
||||
" Follow this ticket to see when support is being added SERVER-85340\n"+
|
||||
" We currently only support passing the libcxx config on macos for compatibility reasons.\n"+
|
||||
" libc++ requires these configuration:\n"+
|
||||
" libc++ is not currently supported in the mongo toolchain.\n" +
|
||||
" Follow this ticket to see when support is being added SERVER-85340\n" +
|
||||
" We currently only support passing the libcxx config on macos for compatibility reasons.\n" +
|
||||
" libc++ requires these configuration:\n" +
|
||||
" --//bazel/config:compiler_type=clang\n"
|
||||
)
|
||||
|
||||
|
|
@ -122,84 +120,98 @@ 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"+
|
||||
" any sanitizer requires these configurations:\n" +
|
||||
" --//bazel/config:compiler_type=clang\n" +
|
||||
" --//bazel/config:build_mode=opt_on [OR] --//bazel/config:build_mode=opt_debug"
|
||||
)
|
||||
|
||||
# -fno-omit-frame-pointer should be added if any sanitizer flag is used by user
|
||||
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)
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE = (
|
||||
"\nError:\n" +
|
||||
" address and memory sanitizers require these configurations:\n"+
|
||||
" address and memory sanitizers require these configurations:\n" +
|
||||
" --//bazel/config:allocator=system\n"
|
||||
)
|
||||
|
||||
ADDRESS_SANITIZER_COPTS = select({
|
||||
("//bazel/config:sanitize_address_required_settings"): ["-fsanitize=address"],
|
||||
"//bazel/config:asan_disabled": [],
|
||||
}
|
||||
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
|
||||
ADDRESS_SANITIZER_COPTS = select(
|
||||
{
|
||||
("//bazel/config:sanitize_address_required_settings"): ["-fsanitize=address"],
|
||||
"//bazel/config:asan_disabled": [],
|
||||
},
|
||||
no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE,
|
||||
)
|
||||
|
||||
ADDRESS_SANITIZER_LINKFLAGS = select({
|
||||
("//bazel/config:sanitize_address_required_settings"): ["-fsanitize=address"],
|
||||
"//bazel/config:asan_disabled": [],
|
||||
}
|
||||
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
|
||||
ADDRESS_SANITIZER_LINKFLAGS = select(
|
||||
{
|
||||
("//bazel/config:sanitize_address_required_settings"): ["-fsanitize=address"],
|
||||
"//bazel/config:asan_disabled": [],
|
||||
},
|
||||
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({
|
||||
("//bazel/config:sanitize_address_required_settings"): ["ADDRESS_SANITIZER"],
|
||||
"//bazel/config:asan_disabled": [],
|
||||
}
|
||||
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
|
||||
ADDRESS_SANITIZER_DEFINES = select(
|
||||
{
|
||||
("//bazel/config:sanitize_address_required_settings"): ["ADDRESS_SANITIZER"],
|
||||
"//bazel/config:asan_disabled": [],
|
||||
},
|
||||
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({
|
||||
("//bazel/config:sanitize_memory_required_settings"): ["-fsanitize=memory", "-fsanitize-memory-track-origins"],
|
||||
("//bazel/config:msan_disabled"): [],
|
||||
}
|
||||
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
|
||||
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,
|
||||
)
|
||||
|
||||
# Makes it easier to debug memory failures at the cost of some perf: -fsanitize-memory-track-origins
|
||||
MEMORY_SANITIZER_LINKFLAGS = select({
|
||||
("//bazel/config:sanitize_memory_required_settings"): ["-fsanitize=memory"],
|
||||
("//bazel/config:msan_disabled"): [],
|
||||
}
|
||||
, no_match_error = SYSTEM_ALLOCATOR_SANITIZER_ERROR_MESSAGE)
|
||||
|
||||
MEMORY_SANITIZER_LINKFLAGS = select(
|
||||
{
|
||||
("//bazel/config:sanitize_memory_required_settings"): ["-fsanitize=memory"],
|
||||
("//bazel/config:msan_disabled"): [],
|
||||
},
|
||||
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({
|
||||
("//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")
|
||||
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",
|
||||
)
|
||||
|
||||
# These flags are needed to generate a coverage report
|
||||
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")
|
||||
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",
|
||||
)
|
||||
|
||||
# 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"): [],
|
||||
|
|
@ -294,8 +305,8 @@ TCMALLOC_DEPS = select({
|
|||
#TODO SERVER-84714 add message about using the toolchain version of C++ libs
|
||||
GLIBCXX_DEBUG_ERROR_MESSAGE = (
|
||||
"\nError:\n" +
|
||||
" glibcxx_debug requires these configurations:\n"+
|
||||
" --//bazel/config:build_mode=dbg\n"+
|
||||
" glibcxx_debug requires these configurations:\n" +
|
||||
" --//bazel/config:build_mode=dbg\n" +
|
||||
" --//bazel/config:use_libcxx=False"
|
||||
)
|
||||
|
||||
|
|
@ -306,30 +317,28 @@ GLIBCXX_DEBUG_DEFINES = select({
|
|||
|
||||
DETECT_ODR_VIOLATIONS_ERROR_MESSAGE = (
|
||||
"\nError:\n" +
|
||||
" detect_odr_violations requires these configurations:\n"+
|
||||
" --//bazel/config:build_mode=opt_off\n"+
|
||||
" detect_odr_violations requires these configurations:\n" +
|
||||
" --//bazel/config:build_mode=opt_off\n" +
|
||||
" --//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,13 +450,13 @@ 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,
|
||||
"//bazel/config:linux_x86_64": linux_rpath_flags,
|
||||
"//bazel/config:linux_ppc64le":linux_rpath_flags,
|
||||
"//bazel/config:linux_ppc64le": linux_rpath_flags,
|
||||
"//bazel/config:linux_s390x": linux_rpath_flags,
|
||||
"//bazel/config:windows_x86_64": [],
|
||||
"//bazel/config:macos_x86_64": macos_rpath_flags,
|
||||
|
|
@ -519,16 +528,16 @@ def mongo_cc_library(
|
|||
)
|
||||
|
||||
extract_debuginfo(
|
||||
name=name,
|
||||
binary_with_debug=":" + name + WITH_DEBUG_SUFFIX,
|
||||
type="library",
|
||||
name = name,
|
||||
binary_with_debug = ":" + name + WITH_DEBUG_SUFFIX,
|
||||
type = "library",
|
||||
enabled = SEPARATE_DEBUG_ENABLED,
|
||||
cc_shared_library = select({
|
||||
"//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,13 +579,13 @@ 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,
|
||||
"//bazel/config:linux_x86_64": linux_rpath_flags,
|
||||
"//bazel/config:linux_ppc64le":linux_rpath_flags,
|
||||
"//bazel/config:linux_ppc64le": linux_rpath_flags,
|
||||
"//bazel/config:linux_s390x": linux_rpath_flags,
|
||||
"//bazel/config:windows_x86_64": [],
|
||||
"//bazel/config:macos_x86_64": macos_rpath_flags,
|
||||
|
|
@ -604,12 +613,12 @@ def mongo_cc_binary(
|
|||
)
|
||||
|
||||
extract_debuginfo(
|
||||
name=name,
|
||||
binary_with_debug=":" + name + WITH_DEBUG_SUFFIX,
|
||||
type="program",
|
||||
name = name,
|
||||
binary_with_debug = ":" + name + WITH_DEBUG_SUFFIX,
|
||||
type = "program",
|
||||
enabled = SEPARATE_DEBUG_ENABLED,
|
||||
deps = all_deps)
|
||||
|
||||
deps = all_deps,
|
||||
)
|
||||
|
||||
IdlInfo = provider(
|
||||
fields = {
|
||||
|
|
@ -631,30 +640,36 @@ def idl_generator_impl(ctx):
|
|||
python_path = []
|
||||
for py_dep in ctx.attr.py_deps:
|
||||
for dep in py_dep[PyInfo].transitive_sources.to_list():
|
||||
if dep.path not in python_path:
|
||||
if dep.path not in python_path:
|
||||
python_path.append(dep.path)
|
||||
py_depsets = [py_dep[PyInfo].transitive_sources for py_dep in ctx.attr.py_deps]
|
||||
|
||||
inputs = depset(transitive=[
|
||||
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(
|
||||
|
|
@ -671,23 +686,23 @@ idl_generator = rule(
|
|||
attrs = {
|
||||
"src": attr.label(
|
||||
doc = "The idl file to generate cpp/h files from.",
|
||||
allow_single_file=True,
|
||||
allow_single_file = True,
|
||||
),
|
||||
"idlc" : attr.label(
|
||||
"idlc": attr.label(
|
||||
doc = "The idlc generator to use.",
|
||||
default = "//buildscripts/idl:idlc",
|
||||
),
|
||||
"py_deps" : attr.label_list(
|
||||
"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(
|
||||
"deps": attr.label_list(
|
||||
doc = "Other idl files that need to be imported.",
|
||||
providers = [IdlInfo],
|
||||
),
|
||||
},
|
||||
doc = "Generates header/source files from IDL files.",
|
||||
toolchains = ["@bazel_tools//tools/python:toolchain_type"],
|
||||
fragments = ["py"]
|
||||
fragments = ["py"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
]
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ def _setup_local_config_platform(ctx):
|
|||
Generates our own local_config_platform, overriding bazel's built in generation.
|
||||
|
||||
This allows is to setup the exec_properties on this platform so a user can use remote execution
|
||||
without need to specify a specific platform.
|
||||
without need to specify a specific platform.
|
||||
"""
|
||||
|
||||
if "win" in ctx.os.name:
|
||||
|
|
@ -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 = ""
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ def _setup_local_config_platform(ctx):
|
|||
"{constraints}": constraints_str,
|
||||
"{exec_props}": exec_props,
|
||||
}
|
||||
|
||||
|
||||
ctx.template(
|
||||
"BUILD.bazel",
|
||||
ctx.attr.build_tpl,
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
REMOTE_EXECUTION_CONTAINERS = {
|
||||
"linux_amd64": {
|
||||
# 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",
|
||||
},
|
||||
# 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",
|
||||
},
|
||||
"linux_arm64": {
|
||||
# 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",
|
||||
}
|
||||
}
|
||||
# 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",
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ def propgate_static_lib(ctx, static_lib, static_ext, inputs):
|
|||
|
||||
return unstripped_static_lib
|
||||
|
||||
def create_new_ccinfo_library(ctx, cc_toolchain, shared_lib, static_lib, cc_shared_library=None):
|
||||
def create_new_ccinfo_library(ctx, cc_toolchain, shared_lib, static_lib, cc_shared_library = None):
|
||||
"""
|
||||
We need to create new CcInfo with the new target names, this will take in the newly
|
||||
named library files and construct a new CcInfo basically stripping out the "_with_debug"
|
||||
|
|
@ -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 = []
|
||||
|
|
@ -108,11 +108,11 @@ def create_new_ccinfo_library(ctx, cc_toolchain, shared_lib, static_lib, cc_shar
|
|||
linking_context = ctx.attr.binary_with_debug[CcInfo].linking_context
|
||||
|
||||
return CcInfo(
|
||||
compilation_context=ctx.attr.binary_with_debug[CcInfo].compilation_context,
|
||||
linking_context=linking_context,
|
||||
compilation_context = ctx.attr.binary_with_debug[CcInfo].compilation_context,
|
||||
linking_context = linking_context,
|
||||
)
|
||||
|
||||
def create_new_cc_shared_library_info(ctx, cc_toolchain, output_shared_lib, original_info, static_lib=None):
|
||||
def create_new_cc_shared_library_info(ctx, cc_toolchain, output_shared_lib, original_info, static_lib = None):
|
||||
"""
|
||||
We need to create a CcSharedLibraryInfo to pass to the cc_binary and cc_library that depend on it
|
||||
so they know to link the cc_shared_library instead of the associated cc_library.
|
||||
|
|
@ -159,16 +159,14 @@ 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]),
|
||||
files = depset(transitive = [ctx.attr.binary_with_debug.files]),
|
||||
),
|
||||
ctx.attr.binary_with_debug[CcInfo],
|
||||
]
|
||||
|
||||
def linux_extraction(ctx, cc_toolchain, inputs):
|
||||
|
||||
outputs = []
|
||||
input_bin, output_bin, debug_info, static_lib = get_inputs_and_outputs(ctx, ".so", ".a", ".debug")
|
||||
|
||||
|
|
@ -178,25 +176,26 @@ def linux_extraction(ctx, cc_toolchain, inputs):
|
|||
executable = cc_toolchain.objcopy_executable,
|
||||
outputs = [debug_info],
|
||||
inputs = inputs,
|
||||
arguments = [
|
||||
'--only-keep-debug',
|
||||
input_bin.path,
|
||||
debug_info.path
|
||||
arguments = [
|
||||
"--only-keep-debug",
|
||||
input_bin.path,
|
||||
debug_info.path,
|
||||
],
|
||||
mnemonic = "ExtractDebuginfo",
|
||||
mnemonic = "ExtractDebuginfo",
|
||||
)
|
||||
|
||||
ctx.actions.run(
|
||||
executable = cc_toolchain.objcopy_executable,
|
||||
outputs = [output_bin],
|
||||
inputs = depset([debug_info], transitive=[inputs]),
|
||||
arguments = [
|
||||
"--strip-debug",
|
||||
"--add-gnu-debuglink", debug_info.path,
|
||||
inputs = depset([debug_info], transitive = [inputs]),
|
||||
arguments = [
|
||||
"--strip-debug",
|
||||
"--add-gnu-debuglink",
|
||||
debug_info.path,
|
||||
input_bin.path,
|
||||
output_bin.path,
|
||||
],
|
||||
mnemonic = "StripDebuginfo",
|
||||
mnemonic = "StripDebuginfo",
|
||||
)
|
||||
outputs += [output_bin, debug_info]
|
||||
else:
|
||||
|
|
@ -220,40 +219,42 @@ 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")
|
||||
|
||||
|
||||
if input_bin:
|
||||
if ctx.attr.enabled:
|
||||
ctx.actions.run(
|
||||
executable = "dsymutil",
|
||||
outputs = [debug_info],
|
||||
inputs = inputs,
|
||||
arguments = [
|
||||
'-num-threads', '1',
|
||||
input_bin.path,
|
||||
'-o', debug_info.path
|
||||
arguments = [
|
||||
"-num-threads",
|
||||
"1",
|
||||
input_bin.path,
|
||||
"-o",
|
||||
debug_info.path,
|
||||
],
|
||||
mnemonic = "ExtractDebuginfo",
|
||||
mnemonic = "ExtractDebuginfo",
|
||||
)
|
||||
|
||||
ctx.actions.run(
|
||||
executable = cc_toolchain.strip_executable,
|
||||
outputs = [output_bin],
|
||||
inputs = depset([debug_info], transitive=[inputs]),
|
||||
arguments = [
|
||||
"-S",
|
||||
"-o", output_bin.path,
|
||||
input_bin.path
|
||||
inputs = depset([debug_info], transitive = [inputs]),
|
||||
arguments = [
|
||||
"-S",
|
||||
"-o",
|
||||
output_bin.path,
|
||||
input_bin.path,
|
||||
],
|
||||
mnemonic = "StripDebuginfo",
|
||||
mnemonic = "StripDebuginfo",
|
||||
)
|
||||
outputs += [output_bin, debug_info]
|
||||
else:
|
||||
|
|
@ -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,13 +298,12 @@ 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)
|
||||
outputs.append(output)
|
||||
|
||||
|
||||
if ext == ".lib":
|
||||
output_library = output
|
||||
if ext == ".dll":
|
||||
|
|
@ -324,23 +323,23 @@ 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():
|
||||
return noop_extraction(ctx)
|
||||
|
||||
cc_toolchain = find_cpp_toolchain(ctx)
|
||||
inputs = depset(transitive=[
|
||||
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]
|
||||
|
|
@ -358,24 +357,23 @@ extract_debuginfo = rule(
|
|||
attrs = {
|
||||
"binary_with_debug": attr.label(
|
||||
doc = "The the binary to extract debuginfo from.",
|
||||
allow_files=True,
|
||||
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."),
|
||||
"enabled": attr.bool(default = False, doc = "Flag to enable/disable separate debug generation."),
|
||||
"deps": attr.label_list(providers = [CcInfo]),
|
||||
"cc_shared_library": attr.label(
|
||||
"cc_shared_library": attr.label(
|
||||
doc = "If extracting from a shared library, the target of the cc_shared_library. Otherwise empty.",
|
||||
allow_files=True,
|
||||
allow_files = True,
|
||||
),
|
||||
"_cc_toolchain": attr.label(default = "@bazel_tools//tools/cpp:current_cc_toolchain"),
|
||||
"_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"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
]
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
_OS_MAP = {
|
||||
"macos": "@platforms//os:osx",
|
||||
"linux": "@platforms//os:linux",
|
||||
|
|
@ -18,18 +17,17 @@ _ARCH_NORMALIZE_MAP = {
|
|||
}
|
||||
|
||||
URLS_MAP = {
|
||||
"linux_x86_64":{
|
||||
"sha": "e2bf59dacb789bd3ed708bafb7bf4e432f611f19d6b888340e3b73eee6949b31",
|
||||
"url": "https://mciuploads.s3.amazonaws.com/toolchain-builder/amazon2/11bae3c145a48dd7be9ee8aa44e5591783f787aa/bazel_v4_toolchain_builder_amazon2_11bae3c145a48dd7be9ee8aa44e5591783f787aa_24_01_09_16_10_07.tar.gz",
|
||||
},
|
||||
"linux_aarch64":{
|
||||
"sha": "269e54f97d9049d24d934f549a8963c15c954a5cb6fc0d75bbbcfb78df3c3647",
|
||||
"url": "https://mciuploads.s3.amazonaws.com/toolchain-builder/amazon2-arm64/11bae3c145a48dd7be9ee8aa44e5591783f787aa/bazel_v4_toolchain_builder_amazon2_arm64_11bae3c145a48dd7be9ee8aa44e5591783f787aa_24_01_09_16_10_07.tar.gz",
|
||||
},
|
||||
}
|
||||
"linux_x86_64": {
|
||||
"sha": "e2bf59dacb789bd3ed708bafb7bf4e432f611f19d6b888340e3b73eee6949b31",
|
||||
"url": "https://mciuploads.s3.amazonaws.com/toolchain-builder/amazon2/11bae3c145a48dd7be9ee8aa44e5591783f787aa/bazel_v4_toolchain_builder_amazon2_11bae3c145a48dd7be9ee8aa44e5591783f787aa_24_01_09_16_10_07.tar.gz",
|
||||
},
|
||||
"linux_aarch64": {
|
||||
"sha": "269e54f97d9049d24d934f549a8963c15c954a5cb6fc0d75bbbcfb78df3c3647",
|
||||
"url": "https://mciuploads.s3.amazonaws.com/toolchain-builder/amazon2-arm64/11bae3c145a48dd7be9ee8aa44e5591783f787aa/bazel_v4_toolchain_builder_amazon2_arm64_11bae3c145a48dd7be9ee8aa44e5591783f787aa_24_01_09_16_10_07.tar.gz",
|
||||
},
|
||||
}
|
||||
|
||||
def _toolchain_download(ctx):
|
||||
|
||||
if ctx.attr.os:
|
||||
os = ctx.attr.os
|
||||
else:
|
||||
|
|
@ -54,13 +52,13 @@ def _toolchain_download(ctx):
|
|||
"{bazel_toolchain_cpu}": "k8",
|
||||
"{arch}": arch,
|
||||
}
|
||||
|
||||
os_arch = "{os}_{arch}".format(os=os, arch=arch)
|
||||
|
||||
os_arch = "{os}_{arch}".format(os = os, arch = arch)
|
||||
|
||||
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(
|
||||
|
|
@ -69,7 +67,7 @@ def _toolchain_download(ctx):
|
|||
)
|
||||
|
||||
ctx.report_progress("generating toolchain build file")
|
||||
|
||||
|
||||
ctx.template(
|
||||
"BUILD.bazel",
|
||||
ctx.attr.build_tpl,
|
||||
|
|
|
|||
|
|
@ -13,32 +13,32 @@ _ARCH_MAP = {
|
|||
}
|
||||
|
||||
URLS_MAP = {
|
||||
"linux_aarch64":{
|
||||
"sha": "3e26a672df17708c4dc928475a5974c3fb3a34a9b45c65fb4bd1e50504cc84ec",
|
||||
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-aarch64-unknown-linux-gnu-install_only.tar.gz",
|
||||
"interpreter_path": "bin/python3",
|
||||
},
|
||||
"linux_amd64":{
|
||||
"sha": "ee37a7eae6e80148c7e3abc56e48a397c1664f044920463ad0df0fc706eacea8",
|
||||
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz",
|
||||
"interpreter_path": "bin/python3",
|
||||
},
|
||||
"windows_amd64":{
|
||||
"sha": "35458ef3163a2705cd0952ba1df6012acb42b043349dcb31ab49afec341369cf",
|
||||
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-pc-windows-msvc-static-install_only.tar.gz",
|
||||
"interpreter_path": "python3.exe",
|
||||
},
|
||||
"macos_aarch64":{
|
||||
"sha": "916c35125b5d8323a21526d7a9154ca626453f63d0878e95b9f613a95006c990",
|
||||
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-aarch64-apple-darwin-install_only.tar.gz",
|
||||
"interpreter_path": "bin/python3",
|
||||
},
|
||||
"macos_x86_64":{
|
||||
"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",
|
||||
}
|
||||
}
|
||||
"linux_aarch64": {
|
||||
"sha": "3e26a672df17708c4dc928475a5974c3fb3a34a9b45c65fb4bd1e50504cc84ec",
|
||||
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-aarch64-unknown-linux-gnu-install_only.tar.gz",
|
||||
"interpreter_path": "bin/python3",
|
||||
},
|
||||
"linux_amd64": {
|
||||
"sha": "ee37a7eae6e80148c7e3abc56e48a397c1664f044920463ad0df0fc706eacea8",
|
||||
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz",
|
||||
"interpreter_path": "bin/python3",
|
||||
},
|
||||
"windows_amd64": {
|
||||
"sha": "35458ef3163a2705cd0952ba1df6012acb42b043349dcb31ab49afec341369cf",
|
||||
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-pc-windows-msvc-static-install_only.tar.gz",
|
||||
"interpreter_path": "python3.exe",
|
||||
},
|
||||
"macos_aarch64": {
|
||||
"sha": "916c35125b5d8323a21526d7a9154ca626453f63d0878e95b9f613a95006c990",
|
||||
"url": "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-aarch64-apple-darwin-install_only.tar.gz",
|
||||
"interpreter_path": "bin/python3",
|
||||
},
|
||||
"macos_x86_64": {
|
||||
"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,16 +48,14 @@ def _py_download(ctx):
|
|||
ctx: Repository context.
|
||||
"""
|
||||
|
||||
|
||||
if ctx.attr.os:
|
||||
os = ctx.attr.os
|
||||
elif "win" in ctx.os.name:
|
||||
os = "windows"
|
||||
elif "mac" in ctx.os.name:
|
||||
os = "macos"
|
||||
else:
|
||||
if "win" in ctx.os.name:
|
||||
os = "windows"
|
||||
elif "mac" in ctx.os.name:
|
||||
os = "macos"
|
||||
else:
|
||||
os = "linux"
|
||||
os = "linux"
|
||||
|
||||
if ctx.attr.arch:
|
||||
arch = ctx.attr.arch
|
||||
|
|
@ -69,10 +67,10 @@ def _py_download(ctx):
|
|||
sha = ctx.attr.sha256
|
||||
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']
|
||||
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"]
|
||||
|
||||
ctx.report_progress("downloading python")
|
||||
ctx.download_and_extract(
|
||||
|
|
@ -95,7 +93,7 @@ def _py_download(ctx):
|
|||
"{constraints}": constraints_str,
|
||||
"{interpreter_path}": interpreter_path,
|
||||
}
|
||||
|
||||
|
||||
ctx.template(
|
||||
"BUILD.bazel",
|
||||
ctx.attr.build_tpl,
|
||||
|
|
@ -133,10 +131,9 @@ 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
|
||||
# and will not be registered as a bazel toolchain by omitting from the return
|
||||
# value below.
|
||||
py_download(
|
||||
name = "py_host",
|
||||
|
|
@ -189,10 +186,9 @@ def setup_mongo_python_toolchains():
|
|||
)
|
||||
|
||||
return (
|
||||
"@py_linux_arm64//:python_toolchain",
|
||||
"@py_linux_arm64//:python_toolchain",
|
||||
"@py_linux_x86_64//:python_toolchain",
|
||||
"@py_windows_x86_64//:python_toolchain",
|
||||
"@py_macos_arm64//:python_toolchain",
|
||||
"@py_macos_arm64//:python_toolchain",
|
||||
"@py_macos_x86_64//:python_toolchain",
|
||||
)
|
||||
|
||||
|
|
@ -6,5 +6,5 @@ package(default_visibility = ["//visibility:public"])
|
|||
|
||||
mongo_cc_binary(
|
||||
name = "unit_test",
|
||||
srcs = ["unit_test.cpp"]
|
||||
srcs = ["unit_test.cpp"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
filegroup(
|
||||
name = "idlc",
|
||||
srcs = ["idlc.py", "__init__.py"] + glob(["**/idl/*.py"]),
|
||||
visibility=["//visibility:public"],
|
||||
srcs = [
|
||||
"__init__.py",
|
||||
"idlc.py",
|
||||
] + glob(["**/idl/*.py"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,13 +16,11 @@ core.workflow(
|
|||
push = "master",
|
||||
),
|
||||
# Change path to the folder you want to publish publicly
|
||||
origin_files = glob(["**"], exclude=["src/mongo/db/modules/**"]),
|
||||
|
||||
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 = [
|
||||
# core.move("path/to/folder/you/want/exported", ""),
|
||||
# ],
|
||||
# core.move("path/to/folder/you/want/exported", ""),
|
||||
# ],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,13 +16,11 @@ core.workflow(
|
|||
push = "master",
|
||||
),
|
||||
# Change path to the folder you want to publish publicly
|
||||
origin_files = glob(["**"], exclude=["src/mongo/db/modules/**"]),
|
||||
|
||||
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 = [
|
||||
# core.move("path/to/folder/you/want/exported", ""),
|
||||
# ],
|
||||
# core.move("path/to/folder/you/want/exported", ""),
|
||||
# ],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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"],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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=[
|
||||
name = "visibility_test_libcommon",
|
||||
srcs = [
|
||||
"visibility_test_libcommon.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
"visibility.h",
|
||||
"visibility_test_libcommon.h",
|
||||
],
|
||||
)
|
||||
|
||||
mongo_cc_library(
|
||||
name="visibility_test_lib1",
|
||||
deps=[
|
||||
":visibility_test_libcommon"
|
||||
],
|
||||
hdrs=[
|
||||
"visibility_test_lib1.h",
|
||||
],
|
||||
srcs=[
|
||||
name = "visibility_test_lib1",
|
||||
srcs = [
|
||||
"visibility_test_lib1.cpp",
|
||||
],
|
||||
hdrs = [
|
||||
"visibility_test_lib1.h",
|
||||
],
|
||||
deps = [
|
||||
":visibility_test_libcommon",
|
||||
],
|
||||
)
|
||||
|
||||
mongo_cc_library(
|
||||
name="visibility_test_lib2",
|
||||
deps=[
|
||||
":visibility_test_lib1"
|
||||
name = "visibility_test_lib2",
|
||||
srcs = [
|
||||
"visibility_test_lib2.cpp",
|
||||
],
|
||||
hdrs=[
|
||||
hdrs = [
|
||||
"visibility_test_lib2.h",
|
||||
],
|
||||
srcs=[
|
||||
"visibility_test_lib2.cpp",
|
||||
deps = [
|
||||
":visibility_test_lib1",
|
||||
],
|
||||
)
|
||||
|
||||
mongo_cc_binary(
|
||||
name="visibility_test1",
|
||||
deps=[
|
||||
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"
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ load("//bazel:mongo_src_rules.bzl", "mongo_cc_library")
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
filegroup(
|
||||
name="exit_code",
|
||||
srcs=[
|
||||
name = "exit_code",
|
||||
srcs = [
|
||||
"exit_code.h",
|
||||
]
|
||||
],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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,58 +55,62 @@ 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",
|
||||
],
|
||||
"@//bazel/config:linux_x86_64": [
|
||||
"-Isrc/third_party/gperftools/platform/linux_x86_64/internal/src",
|
||||
],
|
||||
"@//bazel/config:linux_ppc64le": [
|
||||
"-Isrc/third_party/gperftools/platform/linux_ppc64le/internal/src",
|
||||
],
|
||||
"@//bazel/config:linux_s390x": [
|
||||
"-Isrc/third_party/gperftools/platform/linux_s390x/internal/src",
|
||||
],
|
||||
"@//bazel/config:windows_x86_64": [
|
||||
"-Isrc/third_party/gperftools/platform/windows_x86_64/internal/src",
|
||||
],
|
||||
}) + select({
|
||||
"@platforms//os:windows": [
|
||||
"/wd4141",
|
||||
"/wd4305",
|
||||
"/wd4003",
|
||||
],
|
||||
"//conditions:default": ["-Wno-unused-result"]
|
||||
}) + select({
|
||||
":gcc_windows": ["-Wno-attribute-alias"],
|
||||
"//conditions:default": []
|
||||
}),
|
||||
"@//bazel/config:linux_aarch64": [
|
||||
"-Isrc/third_party/gperftools/platform/linux_aarch64/internal/src",
|
||||
],
|
||||
"@//bazel/config:linux_x86_64": [
|
||||
"-Isrc/third_party/gperftools/platform/linux_x86_64/internal/src",
|
||||
],
|
||||
"@//bazel/config:linux_ppc64le": [
|
||||
"-Isrc/third_party/gperftools/platform/linux_ppc64le/internal/src",
|
||||
],
|
||||
"@//bazel/config:linux_s390x": [
|
||||
"-Isrc/third_party/gperftools/platform/linux_s390x/internal/src",
|
||||
],
|
||||
"@//bazel/config:windows_x86_64": [
|
||||
"-Isrc/third_party/gperftools/platform/windows_x86_64/internal/src",
|
||||
],
|
||||
}) + select({
|
||||
"@platforms//os:windows": [
|
||||
"/wd4141",
|
||||
"/wd4305",
|
||||
"/wd4003",
|
||||
],
|
||||
"//conditions:default": ["-Wno-unused-result"],
|
||||
}) + select({
|
||||
":gcc_windows": ["-Wno-attribute-alias"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
local_defines = [
|
||||
"NO_HEAP_CHECK",
|
||||
] + select({
|
||||
"@//bazel/config:dbg": [],
|
||||
"//conditions:default": [
|
||||
# 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"
|
||||
]
|
||||
}) + select({
|
||||
# GCC on PowerPC under C++11 mode does not define __linux which gperftools depends on
|
||||
"@platforms//cpu:ppc": ["__linux"],
|
||||
"//conditions:default": []
|
||||
}) + select({
|
||||
"@//bazel/config:dbg": [],
|
||||
"//conditions:default": ["NDEBUG"]
|
||||
}),
|
||||
"NO_HEAP_CHECK",
|
||||
] + select({
|
||||
"@//bazel/config:dbg": [],
|
||||
"//conditions:default": [
|
||||
# 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",
|
||||
],
|
||||
}) + select({
|
||||
# GCC on PowerPC under C++11 mode does not define __linux which gperftools depends on
|
||||
"@platforms//cpu:ppc": ["__linux"],
|
||||
"//conditions:default": [],
|
||||
}) + select({
|
||||
"@//bazel/config:dbg": [],
|
||||
"//conditions:default": ["NDEBUG"],
|
||||
}),
|
||||
)
|
||||
|
||||
# TODO(SERVER-80619): conditionally inject gperftools/platform/$os_$arch/include to dependents.
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
|
|
|
|||
|
|
@ -14,127 +14,125 @@ 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".
|
||||
# - Gather .o dependencies of the libunwind.a target.
|
||||
# - Some .o are from prereq libraries, they have .lax paths.
|
||||
# Replace the `*.lax/$PREREQ/*.o` dependencies with the
|
||||
# corresponding .o from that $PREREQ library.
|
||||
# - Replace each .o with the source file (.c or .S) that generated it.
|
||||
# - Ensure the the ${CC} arguments are preserved by SCons.
|
||||
# Note you can skip NDEBUG defines as those should be inherited.
|
||||
"dist/src/dwarf/global.c",
|
||||
"dist/src/dwarf/Lexpr.c",
|
||||
"dist/src/dwarf/Lfde.c",
|
||||
"dist/src/dwarf/Lfind_proc_info-lsb.c",
|
||||
"dist/src/dwarf/Lfind_unwind_table.c",
|
||||
"dist/src/dwarf/Lparser.c",
|
||||
"dist/src/dwarf/Lpe.c",
|
||||
"dist/src/dl-iterate-phdr.c",
|
||||
"dist/src/elf64.c",
|
||||
"dist/src/mi/backtrace.c",
|
||||
"dist/src/mi/dyn-cancel.c",
|
||||
"dist/src/mi/dyn-info-list.c",
|
||||
"dist/src/mi/dyn-register.c",
|
||||
"dist/src/mi/flush_cache.c",
|
||||
"dist/src/mi/init.c",
|
||||
"dist/src/mi/Ldestroy_addr_space.c",
|
||||
"dist/src/mi/Ldyn-extract.c",
|
||||
"dist/src/mi/Lfind_dynamic_proc_info.c",
|
||||
"dist/src/mi/Lget_accessors.c",
|
||||
"dist/src/mi/Lget_fpreg.c",
|
||||
"dist/src/mi/Lget_proc_info_by_ip.c",
|
||||
"dist/src/mi/Lget_proc_name.c",
|
||||
"dist/src/mi/Lget_reg.c",
|
||||
"dist/src/mi/Lput_dynamic_unwind_info.c",
|
||||
"dist/src/mi/Lset_cache_size.c",
|
||||
"dist/src/mi/Lset_caching_policy.c",
|
||||
"dist/src/mi/Lset_fpreg.c",
|
||||
"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//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",
|
||||
"dist/src/aarch64/Lget_save_loc.c",
|
||||
"dist/src/aarch64/Lglobal.c",
|
||||
"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/Lstash_frame.c",
|
||||
"dist/src/aarch64/Ltrace.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",
|
||||
"dist/src/x86_64/Lget_save_loc.c",
|
||||
"dist/src/x86_64/Lglobal.c",
|
||||
"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',
|
||||
],
|
||||
"@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/ppc64/Lreg_states_iterate.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",
|
||||
],
|
||||
"@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",
|
||||
"dist/src/s390x/Lget_save_loc.c",
|
||||
"dist/src/s390x/Lglobal.c",
|
||||
"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/Lreg_states_iterate.c",
|
||||
"dist/src/s390x/Lresume.c",
|
||||
"dist/src/s390x/Lstep.c",
|
||||
"dist/src/s390x/regname.c",
|
||||
"dist/src/s390x/Lis_signal_frame.c",
|
||||
],
|
||||
}) + select({
|
||||
name = "unwind",
|
||||
srcs = [
|
||||
# Generated by a manual process:
|
||||
# - Run "scripts/host_config.sh |tee host_config.out".
|
||||
# - Gather .o dependencies of the libunwind.a target.
|
||||
# - Some .o are from prereq libraries, they have .lax paths.
|
||||
# Replace the `*.lax/$PREREQ/*.o` dependencies with the
|
||||
# corresponding .o from that $PREREQ library.
|
||||
# - Replace each .o with the source file (.c or .S) that generated it.
|
||||
# - Ensure the the ${CC} arguments are preserved by SCons.
|
||||
# Note you can skip NDEBUG defines as those should be inherited.
|
||||
"dist/src/dwarf/global.c",
|
||||
"dist/src/dwarf/Lexpr.c",
|
||||
"dist/src/dwarf/Lfde.c",
|
||||
"dist/src/dwarf/Lfind_proc_info-lsb.c",
|
||||
"dist/src/dwarf/Lfind_unwind_table.c",
|
||||
"dist/src/dwarf/Lparser.c",
|
||||
"dist/src/dwarf/Lpe.c",
|
||||
"dist/src/dl-iterate-phdr.c",
|
||||
"dist/src/elf64.c",
|
||||
"dist/src/mi/backtrace.c",
|
||||
"dist/src/mi/dyn-cancel.c",
|
||||
"dist/src/mi/dyn-info-list.c",
|
||||
"dist/src/mi/dyn-register.c",
|
||||
"dist/src/mi/flush_cache.c",
|
||||
"dist/src/mi/init.c",
|
||||
"dist/src/mi/Ldestroy_addr_space.c",
|
||||
"dist/src/mi/Ldyn-extract.c",
|
||||
"dist/src/mi/Lfind_dynamic_proc_info.c",
|
||||
"dist/src/mi/Lget_accessors.c",
|
||||
"dist/src/mi/Lget_fpreg.c",
|
||||
"dist/src/mi/Lget_proc_info_by_ip.c",
|
||||
"dist/src/mi/Lget_proc_name.c",
|
||||
"dist/src/mi/Lget_reg.c",
|
||||
"dist/src/mi/Lput_dynamic_unwind_info.c",
|
||||
"dist/src/mi/Lset_cache_size.c",
|
||||
"dist/src/mi/Lset_caching_policy.c",
|
||||
"dist/src/mi/Lset_fpreg.c",
|
||||
"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//cpu:aarch64": [
|
||||
"dist/src/aarch64/Lapply_reg_state.c",
|
||||
"dist/src/aarch64/Lcreate_addr_space.c",
|
||||
"dist/src/aarch64/Lget_proc_info.c",
|
||||
"dist/src/aarch64/Lget_save_loc.c",
|
||||
"dist/src/aarch64/Lglobal.c",
|
||||
"dist/src/aarch64/Linit.c",
|
||||
"dist/src/aarch64/Linit_local.c",
|
||||
"dist/src/aarch64/Linit_remote.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/Lapply_reg_state.c",
|
||||
"dist/src/x86_64/Lcreate_addr_space.c",
|
||||
"dist/src/x86_64/Lget_proc_info.c",
|
||||
"dist/src/x86_64/Lget_save_loc.c",
|
||||
"dist/src/x86_64/Lglobal.c",
|
||||
"dist/src/x86_64/Linit.c",
|
||||
"dist/src/x86_64/Linit_local.c",
|
||||
"dist/src/x86_64/Linit_remote.c",
|
||||
"dist/src/x86_64/Los-linux.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/ppc/Lget_proc_info.c",
|
||||
"dist/src/ppc/Lget_save_loc.c",
|
||||
"dist/src/ppc/Linit_local.c",
|
||||
"dist/src/ppc/Linit_remote.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/get_func_addr.c",
|
||||
"dist/src/ppc64/is_fpreg.c",
|
||||
"dist/src/ppc64/regname.c",
|
||||
],
|
||||
"@platforms//cpu:s390x": [
|
||||
"dist/src/s390x/Lapply_reg_state.c",
|
||||
"dist/src/s390x/Lcreate_addr_space.c",
|
||||
"dist/src/s390x/Lget_proc_info.c",
|
||||
"dist/src/s390x/Lget_save_loc.c",
|
||||
"dist/src/s390x/Lglobal.c",
|
||||
"dist/src/s390x/Linit.c",
|
||||
"dist/src/s390x/Linit_local.c",
|
||||
"dist/src/s390x/Linit_remote.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",
|
||||
],
|
||||
}) + select({
|
||||
"@platforms//cpu:aarch64": [
|
||||
"dist/src/aarch64/getcontext.S",
|
||||
],
|
||||
|
|
@ -148,7 +146,11 @@ mongo_cc_library(
|
|||
"dist/src/s390x/setcontext.S",
|
||||
],
|
||||
}),
|
||||
copts=[
|
||||
hdrs = glob([
|
||||
"**/*.h",
|
||||
"**/*.c",
|
||||
]),
|
||||
copts = [
|
||||
"-Isrc/third_party/unwind/dist/src",
|
||||
"-Isrc/third_party/unwind/dist/include",
|
||||
"-fexceptions",
|
||||
|
|
@ -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": [],
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue