mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Bazel: reference (and locally stub) internal module
This commit is contained in:
4
.bazelrc
4
.bazelrc
@@ -1,5 +1,9 @@
|
||||
common --enable_platform_specific_config --experimental_enable_bzlmod
|
||||
|
||||
# when using repo standalone, we want still to unlock loading the internal repository module
|
||||
# actually using things from that module will obviously end up in an error
|
||||
common --override_module=codeql_internal=%workspace%/misc/bazel/codeql_internal_stub
|
||||
|
||||
build --repo_env=CC=clang --repo_env=CXX=clang++
|
||||
|
||||
build:linux --cxxopt=-std=c++20
|
||||
|
||||
@@ -3,6 +3,8 @@ module(
|
||||
version = "0.0",
|
||||
)
|
||||
|
||||
# this points to our internal repository when `codeql` is checked out as a submodule thereof
|
||||
# when building things from `codeql` independently this is stubbed out in `.bazelrc`
|
||||
bazel_dep(name = "codeql_internal", version = "0.0")
|
||||
local_path_override(
|
||||
module_name = "codeql_internal",
|
||||
|
||||
@@ -22,7 +22,9 @@ CmakeInfo = provider(
|
||||
)
|
||||
|
||||
def _cmake_name(label):
|
||||
ret = ("%s_%s_%s" % (label.workspace_name, label.package, label.name)).replace("/", "_")
|
||||
# strip away the bzlmod module version for now
|
||||
workspace_name, _, _ = label.workspace_name.partition("~")
|
||||
ret = ("%s_%s_%s" % (workspace_name, label.package, label.name)).replace("/", "_")
|
||||
internal_transition_suffix = "_INTERNAL_TRANSITION"
|
||||
if ret.endswith(internal_transition_suffix):
|
||||
ret = ret[:-len(internal_transition_suffix)]
|
||||
@@ -120,7 +122,6 @@ def _cmake_aspect_impl(target, ctx):
|
||||
prefix, # source
|
||||
"${BAZEL_EXEC_ROOT}/%s/%s" % (ctx.var["BINDIR"], prefix), # generated
|
||||
]
|
||||
|
||||
deps = [dep[CmakeInfo] for dep in deps if CmakeInfo in dep]
|
||||
|
||||
# by the book this should be done with depsets, but so far the performance implication is negligible
|
||||
|
||||
@@ -19,8 +19,7 @@ endmacro()
|
||||
bazel(info workspace OUTPUT_VARIABLE BAZEL_WORKSPACE)
|
||||
|
||||
bazel(info output_base OUTPUT_VARIABLE BAZEL_OUTPUT_BASE)
|
||||
string(REPLACE "-" "_" BAZEL_EXEC_ROOT ${PROJECT_NAME})
|
||||
set(BAZEL_EXEC_ROOT ${BAZEL_OUTPUT_BASE}/execroot/${BAZEL_EXEC_ROOT})
|
||||
set(BAZEL_EXEC_ROOT ${BAZEL_OUTPUT_BASE}/execroot/_main)
|
||||
|
||||
macro(include_generated BAZEL_TARGET)
|
||||
bazel(build ${BAZEL_TARGET})
|
||||
|
||||
4
misc/bazel/codeql_internal_stub/MODULE.bazel
Normal file
4
misc/bazel/codeql_internal_stub/MODULE.bazel
Normal file
@@ -0,0 +1,4 @@
|
||||
module(
|
||||
name = "codeql_internal",
|
||||
version = "0.0",
|
||||
)
|
||||
0
misc/bazel/codeql_internal_stub/WORKSPACE.bazel
Normal file
0
misc/bazel/codeql_internal_stub/WORKSPACE.bazel
Normal file
Reference in New Issue
Block a user