Merge branch 'main' into patch-1

This commit is contained in:
Chad Bentz
2024-04-12 09:09:43 -04:00
committed by GitHub
4795 changed files with 431941 additions and 192677 deletions

View File

@@ -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)]
@@ -68,10 +70,10 @@ def _cmake_aspect_impl(target, ctx):
is_macos = "darwin" in ctx.var["TARGET_CPU"]
is_binary = ctx.rule.kind == "cc_binary"
is_binary = ctx.rule.kind in ("cc_binary", "cc_test")
force_cxx_compilation = "force_cxx_compilation" in ctx.rule.attr.features
attr = ctx.rule.attr
srcs = attr.srcs + getattr(attr, "hdrs", []) + getattr(attr, "textual_hdrs", [])
srcs = getattr(attr, "srcs", []) + getattr(attr, "hdrs", []) + getattr(attr, "textual_hdrs", [])
srcs = [f for src in srcs for f in src.files.to_list()]
inputs = [f for f in srcs if not f.is_source or f.path.startswith("external/")]
by_kind = {}
@@ -90,10 +92,10 @@ def _cmake_aspect_impl(target, ctx):
cxx_compilation = force_cxx_compilation or any([not src.endswith(".c") for src in srcs])
copts = ctx.fragments.cpp.copts + (ctx.fragments.cpp.cxxopts if cxx_compilation else ctx.fragments.cpp.conlyopts)
copts += [ctx.expand_make_variables("copts", o, {}) for o in ctx.rule.attr.copts]
copts += [ctx.expand_make_variables("copts", o, {}) for o in getattr(ctx.rule.attr, "copts", [])]
linkopts = ctx.fragments.cpp.linkopts
linkopts += [ctx.expand_make_variables("linkopts", o, {}) for o in ctx.rule.attr.linkopts]
linkopts += [ctx.expand_make_variables("linkopts", o, {}) for o in getattr(ctx.rule.attr, "linkopts", [])]
compilation_ctx = target[CcInfo].compilation_context
system_includes = _get_includes(compilation_ctx.system_includes)
@@ -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

View File

@@ -9,27 +9,61 @@ if (NOT DEFINED BAZEL_BIN)
set(BAZEL_BIN "bazelisk")
endif ()
if (NOT DEFINED CODEQL_BAZEL_WORKSPACE)
set(CODEQL_BAZEL_WORKSPACE "codeql")
endif ()
macro(bazel)
execute_process(COMMAND ${BAZEL_BIN} ${ARGN}
execute_process(COMMAND ${BAZEL_BIN} ${BAZEL_STARTUP_OPTIONS} ${ARGN}
COMMAND_ERROR_IS_FATAL ANY
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endmacro()
bazel(info workspace OUTPUT_VARIABLE BAZEL_WORKSPACE)
macro(bazel_even_if_failing)
execute_process(COMMAND ${BAZEL_BIN} ${BAZEL_STARTUP_OPTIONS} ${ARGN}
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
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)
set(BAZEL_BUILD_OPTIONS --nocheck_visibility --keep_going)
macro(include_generated BAZEL_TARGET)
bazel(build ${BAZEL_TARGET})
bazel(build ${BAZEL_TARGET} ${BAZEL_BUILD_OPTIONS})
string(REPLACE "@" "/external/" BAZEL_TARGET_PATH ${BAZEL_TARGET})
string(REPLACE "//" "/" BAZEL_TARGET_PATH ${BAZEL_TARGET_PATH})
string(REPLACE ":" "/" BAZEL_TARGET_PATH ${BAZEL_TARGET_PATH})
include(${BAZEL_WORKSPACE}/bazel-bin${BAZEL_TARGET_PATH}.cmake)
endmacro()
macro(generate_and_include)
file(REMOVE "${BAZEL_WORKSPACE}/.bazel-cmake/BUILD.bazel")
# use aquery to only get targets compatible with the current platform
bazel_even_if_failing(aquery "kind(\"cc_test|cc_binary\", ${ARGN})" ${BAZEL_BUILD_OPTIONS} --output=jsonproto OUTPUT_VARIABLE BAZEL_AQUERY_RESULT)
string(JSON BAZEL_JSON_TARGETS GET "${BAZEL_AQUERY_RESULT}" targets)
string(JSON LAST_IDX LENGTH "${BAZEL_JSON_TARGETS}")
math(EXPR LAST_IDX "${LAST_IDX} - 1")
foreach(IDX RANGE ${LAST_IDX})
string(JSON CUR_BAZEL_TARGET GET "${BAZEL_JSON_TARGETS}" ${IDX} label)
string(APPEND BAZEL_TARGETS " '${CUR_BAZEL_TARGET}',\n")
endforeach ()
file(WRITE "${BAZEL_WORKSPACE}/.bazel-cmake/BUILD.bazel" "\
# this file was generated by cmake
load('@${CODEQL_BAZEL_WORKSPACE}//misc/bazel/cmake:cmake.bzl', 'generate_cmake')\n\
\n\
generate_cmake(\n\
name = 'cmake',\n\
testonly = True,\n\
targets = [\n\
${BAZEL_TARGETS}\
],\n\
)\n")
include_generated(//.bazel-cmake:cmake)
endmacro()
if (CREATE_COMPILATION_DATABASE_LINK)
file(CREATE_LINK ${PROJECT_BINARY_DIR}/compile_commands.json ${PROJECT_SOURCE_DIR}/compile_commands.json SYMBOLIC)
endif ()

View File

@@ -0,0 +1,4 @@
module(
name = "semmle_code",
version = "0.0",
)

View File

@@ -3,7 +3,7 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//swift/third_party:load.bzl", load_swift_dependencies = "load_dependencies")
def codeql_workspace(repository_name = "codeql"):
load_swift_dependencies(repository_name)
load_swift_dependencies(repository_name = repository_name)
maybe(
repo_rule = http_archive,
name = "rules_pkg",

View File

@@ -5,7 +5,7 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
def codeql_workspace_deps(repository_name = "codeql"):
pip_install(
name = "codegen_deps",
requirements = "@%s//misc/codegen:requirements.txt" % repository_name,
requirements = "@%s//misc/codegen:requirements_lock.txt" % repository_name,
)
bazel_skylib_workspace()
rules_pkg_dependencies()

View File

@@ -0,0 +1,22 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=misc/codegen/requirements_lock.txt misc/codegen/requirements_in.txt
#
inflection==0.5.1
# via -r misc/codegen/requirements_in.txt
iniconfig==2.0.0
# via pytest
packaging==23.2
# via pytest
pluggy==1.4.0
# via pytest
pystache==0.6.5
# via -r misc/codegen/requirements_in.txt
pytest==8.0.0
# via -r misc/codegen/requirements_in.txt
pyyaml==6.0.1
# via -r misc/codegen/requirements_in.txt
toposort==1.10
# via -r misc/codegen/requirements_in.txt

View File

@@ -1,3 +1,31 @@
## 0.7.13
No user-facing changes.
## 0.7.12
No user-facing changes.
## 0.7.11
No user-facing changes.
## 0.7.10
No user-facing changes.
## 0.7.9
No user-facing changes.
## 0.7.8
No user-facing changes.
## 0.7.7
No user-facing changes.
## 0.7.6
No user-facing changes.

View File

@@ -0,0 +1,3 @@
## 0.7.10
No user-facing changes.

View File

@@ -0,0 +1,3 @@
## 0.7.11
No user-facing changes.

View File

@@ -0,0 +1,3 @@
## 0.7.12
No user-facing changes.

View File

@@ -0,0 +1,3 @@
## 0.7.13
No user-facing changes.

View File

@@ -0,0 +1,3 @@
## 0.7.7
No user-facing changes.

View File

@@ -0,0 +1,3 @@
## 0.7.8
No user-facing changes.

View File

@@ -0,0 +1,3 @@
## 0.7.9
No user-facing changes.

View File

@@ -1,2 +1,2 @@
---
lastReleaseVersion: 0.7.6
lastReleaseVersion: 0.7.13

View File

@@ -1,4 +1,4 @@
name: codeql/suite-helpers
version: 0.7.7-dev
version: 0.7.14-dev
groups: shared
warnOnImplicitThis: true