mongo/bazel/wrapper_hook/post_bazel_hook.py
Daniel Moody 7fbd72d6f0 SERVER-117726 move compiledb generation into the bazel graph (#49797)
GitOrigin-RevId: ed2b1096fd0a6b1eea8405df897756feda930f5d
2026-03-17 19:33:55 +00:00

34 lines
1005 B
Python

# Hook to be called around bazel invocation time. Does not run on Windows.
import os
import pathlib
import sys
REPO_ROOT = pathlib.Path(__file__).parent.parent.parent
sys.path.append(str(REPO_ROOT))
from bazel.wrapper_hook.install_modules import install_modules
BAZEL_USER_NAMESPACE = "user-prod"
BAZEL_CI_NAMESPACE = "ci-prod"
def main():
install_modules(sys.argv[1], sys.argv[1:])
from bazel.wrapper_hook.compiledb import finalize_compiledb_posthook
from bazel.wrapper_hook.flag_sync import sync_flags
if os.environ.get("NO_FLAG_SYNC") is None:
if os.environ.get("CI") is None:
sync_flags(BAZEL_USER_NAMESPACE)
else:
sync_flags(BAZEL_CI_NAMESPACE)
enterprise = (REPO_ROOT / "src" / "mongo" / "db" / "modules" / "enterprise").exists()
atlas = (REPO_ROOT / "src" / "mongo" / "db" / "modules" / "atlas").exists()
finalize_compiledb_posthook(sys.argv[1], enterprise=enterprise, atlas=atlas)
if __name__ == "__main__":
main()