mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Bazel: use bzlmod
This commit is contained in:
2
.bazelrc
2
.bazelrc
@@ -1,4 +1,4 @@
|
|||||||
common --enable_platform_specific_config
|
common --enable_platform_specific_config --experimental_enable_bzlmod
|
||||||
|
|
||||||
build --repo_env=CC=clang --repo_env=CXX=clang++
|
build --repo_env=CC=clang --repo_env=CXX=clang++
|
||||||
|
|
||||||
|
|||||||
33
MODULE.bazel
Normal file
33
MODULE.bazel
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
module(
|
||||||
|
name = "codeql",
|
||||||
|
version = "0.0",
|
||||||
|
)
|
||||||
|
|
||||||
|
# see https://registry.bazel.build/ for a list of available packages
|
||||||
|
|
||||||
|
bazel_dep(name = "platforms", version = "0.0.8")
|
||||||
|
bazel_dep(name = "rules_pkg", version = "0.9.1")
|
||||||
|
bazel_dep(name = "rules_python", version = "0.29.0")
|
||||||
|
bazel_dep(name = "bazel_skylib", version = "1.5.0")
|
||||||
|
bazel_dep(name = "abseil-cpp", version = "20240116.0", repo_name = "absl")
|
||||||
|
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
|
||||||
|
bazel_dep(name = "fmt", version = "10.0.0")
|
||||||
|
|
||||||
|
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
|
||||||
|
pip.parse(
|
||||||
|
hub_name = "codegen_deps",
|
||||||
|
python_version = "3.11",
|
||||||
|
requirements_lock = "//misc/codegen:requirements_lock.txt",
|
||||||
|
)
|
||||||
|
use_repo(pip, "codegen_deps")
|
||||||
|
|
||||||
|
swift_deps = use_extension("//swift/third_party:load.bzl", "swift_deps")
|
||||||
|
use_repo(
|
||||||
|
swift_deps,
|
||||||
|
"binlog",
|
||||||
|
"picosha2",
|
||||||
|
"swift_prebuilt_darwin_x86_64",
|
||||||
|
"swift_prebuilt_linux",
|
||||||
|
"swift_toolchain_linux",
|
||||||
|
"swift_toolchain_macos",
|
||||||
|
)
|
||||||
@@ -2,11 +2,3 @@
|
|||||||
# and for internal use only.
|
# and for internal use only.
|
||||||
|
|
||||||
workspace(name = "codeql")
|
workspace(name = "codeql")
|
||||||
|
|
||||||
load("//misc/bazel:workspace.bzl", "codeql_workspace")
|
|
||||||
|
|
||||||
codeql_workspace()
|
|
||||||
|
|
||||||
load("//misc/bazel:workspace_deps.bzl", "codeql_workspace_deps")
|
|
||||||
|
|
||||||
codeql_workspace_deps()
|
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
||||||
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)
|
|
||||||
maybe(
|
|
||||||
repo_rule = http_archive,
|
|
||||||
name = "rules_pkg",
|
|
||||||
sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
|
|
||||||
urls = [
|
|
||||||
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
|
|
||||||
"https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
maybe(
|
|
||||||
repo_rule = http_archive,
|
|
||||||
name = "platforms",
|
|
||||||
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",
|
|
||||||
)
|
|
||||||
|
|
||||||
maybe(
|
|
||||||
repo_rule = http_archive,
|
|
||||||
name = "rules_python",
|
|
||||||
sha256 = "cdf6b84084aad8f10bf20b46b77cb48d83c319ebe6458a18e9d2cebf57807cdd",
|
|
||||||
strip_prefix = "rules_python-0.8.1",
|
|
||||||
urls = [
|
|
||||||
"https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.1.tar.gz",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
maybe(
|
|
||||||
repo_rule = http_archive,
|
|
||||||
name = "bazel_skylib",
|
|
||||||
sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7",
|
|
||||||
urls = [
|
|
||||||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
|
|
||||||
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
|
|
||||||
load("@rules_python//python:pip.bzl", "pip_install")
|
|
||||||
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,
|
|
||||||
)
|
|
||||||
bazel_skylib_workspace()
|
|
||||||
rules_pkg_dependencies()
|
|
||||||
22
misc/codegen/requirements_lock.txt
Normal file
22
misc/codegen/requirements_lock.txt
Normal 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
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstdarg>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <picosha2.h>
|
#include <picosha2.h>
|
||||||
|
|||||||
41
swift/third_party/load.bzl
vendored
41
swift/third_party/load.bzl
vendored
@@ -40,7 +40,7 @@ def _get_toolchain_url(info):
|
|||||||
info.extension,
|
info.extension,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _toolchains(workspace_name):
|
def _toolchains():
|
||||||
rules = {
|
rules = {
|
||||||
"tar.gz": http_archive,
|
"tar.gz": http_archive,
|
||||||
"pkg": _pkg_archive,
|
"pkg": _pkg_archive,
|
||||||
@@ -51,7 +51,7 @@ def _toolchains(workspace_name):
|
|||||||
name = "swift_toolchain_%s" % arch,
|
name = "swift_toolchain_%s" % arch,
|
||||||
url = _get_toolchain_url(info),
|
url = _get_toolchain_url(info),
|
||||||
sha256 = info.sha,
|
sha256 = info.sha,
|
||||||
build_file = _build(workspace_name, "swift-toolchain-%s" % arch),
|
build_file = _build % ("swift-toolchain-%s" % arch),
|
||||||
strip_prefix = "%s-%s" % (_swift_version, info.suffix),
|
strip_prefix = "%s-%s" % (_swift_version, info.suffix),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -109,10 +109,9 @@ def _github_archive(*, name, repository, commit, build_file = None, sha256 = Non
|
|||||||
sha256 = sha256,
|
sha256 = sha256,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _build(workspace_name, package):
|
_build = "@codeql//swift/third_party:BUILD.%s.bazel"
|
||||||
return "@%s//swift/third_party:BUILD.%s.bazel" % (workspace_name, package)
|
|
||||||
|
|
||||||
def load_dependencies(workspace_name):
|
def _load_dependencies(_):
|
||||||
for repo_arch, arch in _swift_arch_map.items():
|
for repo_arch, arch in _swift_arch_map.items():
|
||||||
sha256 = _swift_sha_map[repo_arch]
|
sha256 = _swift_sha_map[repo_arch]
|
||||||
|
|
||||||
@@ -122,11 +121,11 @@ def load_dependencies(workspace_name):
|
|||||||
_swift_prebuilt_version,
|
_swift_prebuilt_version,
|
||||||
repo_arch,
|
repo_arch,
|
||||||
),
|
),
|
||||||
build_file = _build(workspace_name, "swift-llvm-support"),
|
build_file = _build % "swift-llvm-support",
|
||||||
sha256 = sha256,
|
sha256 = sha256,
|
||||||
patch_args = ["-p1"],
|
patch_args = ["-p1"],
|
||||||
patches = [
|
patches = [
|
||||||
"@%s//swift/third_party/swift-llvm-support:patches/%s.patch" % (workspace_name, patch_name)
|
"@codeql//swift/third_party/swift-llvm-support:patches/%s.patch" % patch_name
|
||||||
for patch_name in (
|
for patch_name in (
|
||||||
"remove-redundant-operators",
|
"remove-redundant-operators",
|
||||||
"add-constructor-to-Compilation",
|
"add-constructor-to-Compilation",
|
||||||
@@ -134,11 +133,11 @@ def load_dependencies(workspace_name):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
_toolchains(workspace_name)
|
_toolchains()
|
||||||
|
|
||||||
_github_archive(
|
_github_archive(
|
||||||
name = "picosha2",
|
name = "picosha2",
|
||||||
build_file = _build(workspace_name, "picosha2"),
|
build_file = _build % "picosha2",
|
||||||
repository = "okdshin/PicoSHA2",
|
repository = "okdshin/PicoSHA2",
|
||||||
commit = "27fcf6979298949e8a462e16d09a0351c18fcaf2",
|
commit = "27fcf6979298949e8a462e16d09a0351c18fcaf2",
|
||||||
sha256 = "d6647ca45a8b7bdaf027ecb68d041b22a899a0218b7206dee755c558a2725abb",
|
sha256 = "d6647ca45a8b7bdaf027ecb68d041b22a899a0218b7206dee755c558a2725abb",
|
||||||
@@ -146,30 +145,10 @@ def load_dependencies(workspace_name):
|
|||||||
|
|
||||||
_github_archive(
|
_github_archive(
|
||||||
name = "binlog",
|
name = "binlog",
|
||||||
build_file = _build(workspace_name, "binlog"),
|
build_file = _build % "binlog",
|
||||||
repository = "morganstanley/binlog",
|
repository = "morganstanley/binlog",
|
||||||
commit = "3fef8846f5ef98e64211e7982c2ead67e0b185a6",
|
commit = "3fef8846f5ef98e64211e7982c2ead67e0b185a6",
|
||||||
sha256 = "f5c61d90a6eff341bf91771f2f465be391fd85397023e1b391c17214f9cbd045",
|
sha256 = "f5c61d90a6eff341bf91771f2f465be391fd85397023e1b391c17214f9cbd045",
|
||||||
)
|
)
|
||||||
|
|
||||||
_github_archive(
|
swift_deps = module_extension(_load_dependencies)
|
||||||
name = "absl",
|
|
||||||
repository = "abseil/abseil-cpp",
|
|
||||||
commit = "d2c5297a3c3948de765100cb7e5cccca1210d23c",
|
|
||||||
sha256 = "735a9efc673f30b3212bfd57f38d5deb152b543e35cd58b412d1363b15242049",
|
|
||||||
)
|
|
||||||
|
|
||||||
_github_archive(
|
|
||||||
name = "json",
|
|
||||||
repository = "nlohmann/json",
|
|
||||||
commit = "6af826d0bdb55e4b69e3ad817576745335f243ca",
|
|
||||||
sha256 = "702bb0231a5e21c0374230fed86c8ae3d07ee50f34ffd420e7f8249854b7d85b",
|
|
||||||
)
|
|
||||||
|
|
||||||
_github_archive(
|
|
||||||
name = "fmt",
|
|
||||||
repository = "fmtlib/fmt",
|
|
||||||
build_file = _build(workspace_name, "fmt"),
|
|
||||||
commit = "a0b8a92e3d1532361c2f7feb63babc5c18d00ef2",
|
|
||||||
sha256 = "ccf872fd4aa9ab3d030d62cffcb258ca27f021b2023a0244b2cf476f984be955",
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user