SERVER-91631 make bazel generated headers included instead of copied (#23880)
GitOrigin-RevId: efbf263b049e11ae0bd624621d108d8da6921802
This commit is contained in:
parent
4fa91dc098
commit
4a0e8b1a9f
@ -151,7 +151,7 @@ Checks: '-*,
|
||||
-readability-uniqueptr-delete-release
|
||||
'
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: '(mongo/.*|@MONGO_BUILD_DIR@/.*)'
|
||||
HeaderFilterRegex: '(mongo/.*|@MONGO_BUILD_DIR@)'
|
||||
CheckOptions:
|
||||
- key: bugprone-assert-side-effect.AssertMacros
|
||||
value: assert
|
||||
@ -170,4 +170,4 @@ CheckOptions:
|
||||
- key: mongo-collection-sharding-runtime-check.exceptionDirs
|
||||
value: 'src/mongo/db/s'
|
||||
- key: mongo-header-bracket-check.mongoSourceDirs
|
||||
value: 'src/mongo;@MONGO_BUILD_DIR@'
|
||||
value: 'src/mongo;@MONGO_BRACKET_BUILD_DIR@'
|
||||
|
||||
31
SConstruct
31
SConstruct
@ -6671,13 +6671,6 @@ Export(
|
||||
)
|
||||
|
||||
|
||||
def injectMongoIncludePaths(thisEnv):
|
||||
thisEnv.AppendUnique(CPPPATH=["$BUILD_DIR"])
|
||||
|
||||
|
||||
env.AddMethod(injectMongoIncludePaths, "InjectMongoIncludePaths")
|
||||
|
||||
|
||||
def injectModule(env, module, **kwargs):
|
||||
injector = env["MODULE_INJECTORS"].get(module)
|
||||
if injector:
|
||||
@ -6893,15 +6886,23 @@ else:
|
||||
env.AddMethod(noop, "WaitForBazel")
|
||||
env.AddMethod(noop, "BazelAutoInstall")
|
||||
|
||||
|
||||
def injectMongoIncludePaths(thisEnv):
|
||||
thisEnv.AppendUnique(CPPPATH=["$BUILD_DIR"])
|
||||
if thisEnv.get("BAZEL_OUT_DIR"):
|
||||
thisEnv.AppendUnique(CPPPATH=["#$BAZEL_OUT_DIR/src"])
|
||||
|
||||
|
||||
env.AddMethod(injectMongoIncludePaths, "InjectMongoIncludePaths")
|
||||
|
||||
gen_header_paths = [
|
||||
(pathlib.Path(env.Dir("$BUILD_DIR").path) / "mongo").as_posix(),
|
||||
(pathlib.Path(env.Dir("$BAZEL_OUT_DIR").path) / "src" / "mongo").as_posix(),
|
||||
]
|
||||
|
||||
replacements = {
|
||||
"@MONGO_BUILD_DIR@": (
|
||||
";".join(
|
||||
[
|
||||
(pathlib.Path(env.Dir("$BUILD_DIR").path) / "mongo").as_posix(),
|
||||
(pathlib.Path(env.Dir("$BAZEL_OUT_DIR").path) / "src" / "mongo").as_posix(),
|
||||
]
|
||||
)
|
||||
),
|
||||
"@MONGO_BUILD_DIR@": ("|".join([path + "/.*" for path in gen_header_paths])),
|
||||
"@MONGO_BRACKET_BUILD_DIR@": (";".join(gen_header_paths)),
|
||||
}
|
||||
|
||||
clang_tidy_config = env.Substfile(
|
||||
|
||||
@ -1004,14 +1004,6 @@ def generate(env: SCons.Environment.Environment) -> None:
|
||||
|
||||
env.AddMethod(wait_for_bazel, "WaitForBazel")
|
||||
|
||||
# need to force generated headers as targets as something may include the header, but its never listed explcitly,
|
||||
# so this forces scons to always copy headers to its build tree for use includes
|
||||
SCons.Script.BUILD_TARGETS += [
|
||||
thintarget
|
||||
for thintarget in Globals.scons2bazel_targets.keys()
|
||||
if thintarget.strip().endswith(".h")
|
||||
]
|
||||
|
||||
env.AddMethod(add_libdeps_time, "AddLibdepsTime")
|
||||
env.AddMethod(generate_bazel_info_for_ninja, "GenerateBazelInfoForNinja")
|
||||
env.AddMethod(bazel_deps_check_query_cache, "CheckBazelDepsCache")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user