mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
Also: * remove new warnings raised by the rust toolchain * run new formatting and linting * update the rust toolchain used by `cargo` While we keep `bazel` builds using the same toolchain as internally (now a nightly one), I opted for using a stable toolchain for `cargo`. The nightly toolchain is only required internally for build reasons, we should keep not using any unstable rust features in our sources.
295 lines
12 KiB
Python
295 lines
12 KiB
Python
module(
|
|
name = "ql",
|
|
version = "0.0",
|
|
repo_name = "codeql",
|
|
)
|
|
|
|
# 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 = "semmle_code", version = "0.0")
|
|
local_path_override(
|
|
module_name = "semmle_code",
|
|
path = "..",
|
|
)
|
|
|
|
# see https://registry.bazel.build/ for a list of available packages
|
|
|
|
bazel_dep(name = "platforms", version = "0.0.11")
|
|
bazel_dep(name = "rules_go", version = "0.50.1")
|
|
bazel_dep(name = "rules_pkg", version = "1.0.1")
|
|
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
|
|
bazel_dep(name = "rules_python", version = "0.40.0")
|
|
bazel_dep(name = "rules_shell", version = "0.3.0")
|
|
bazel_dep(name = "bazel_skylib", version = "1.7.1")
|
|
bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "absl")
|
|
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
|
|
bazel_dep(name = "fmt", version = "10.0.0")
|
|
bazel_dep(name = "rules_kotlin", version = "2.1.3-codeql.1")
|
|
bazel_dep(name = "gazelle", version = "0.40.0")
|
|
bazel_dep(name = "rules_dotnet", version = "0.17.4")
|
|
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
|
|
bazel_dep(name = "rules_rust", version = "0.63.0")
|
|
bazel_dep(name = "zstd", version = "1.5.5.bcr.1")
|
|
|
|
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
|
|
|
|
# Keep edition and version approximately in sync with internal repo.
|
|
# the versions there are canonical, the versions here are used for CI in github/codeql, as well as for the vendoring of dependencies.
|
|
RUST_EDITION = "2024"
|
|
|
|
# run buildutils-internal/scripts/fill-rust-sha256s.py when updating (internal repo)
|
|
# a nightly toolchain is required to enable experimental_use_cc_common_link, which we require internally
|
|
# we prefer to run the same version as internally, even if experimental_use_cc_common_link is not really
|
|
# required in this repo
|
|
RUST_VERSION = "nightly/2025-08-01"
|
|
|
|
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
|
|
rust.toolchain(
|
|
edition = RUST_EDITION,
|
|
# We need those extra target triples so that we can build universal binaries on macos
|
|
extra_target_triples = [
|
|
"x86_64-apple-darwin",
|
|
"aarch64-apple-darwin",
|
|
],
|
|
# generated by buildutils-internal/scripts/fill-rust-sha256s.py (internal repo)
|
|
sha256s = {
|
|
"2025-08-01/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz": "9bbeaf5d3fc7247d31463a9083aa251c995cc50662c8219e7a2254d76a72a9a4",
|
|
"2025-08-01/rustc-nightly-x86_64-apple-darwin.tar.xz": "c9ea539a8eff0d5d162701f99f9e1aabe14dd0dfb420d62362817a5d09219de7",
|
|
"2025-08-01/rustc-nightly-aarch64-apple-darwin.tar.xz": "ae83feebbc39cfd982e4ecc8297731fe79c185173aee138467b334c5404b3773",
|
|
"2025-08-01/rustc-nightly-x86_64-pc-windows-msvc.tar.xz": "9f170c30d802a349be60cf52ec46260802093cb1013ad667fc0d528b7b10152f",
|
|
"2025-08-01/clippy-nightly-x86_64-unknown-linux-gnu.tar.xz": "9ae5f3cd8f557c4f6df522597c69d14398cf604cfaed2b83e767c4b77a7eaaf6",
|
|
"2025-08-01/clippy-nightly-x86_64-apple-darwin.tar.xz": "983cb9ee0b6b968188e04ab2d33743d54764b2681ce565e1b3f2b9135c696a3e",
|
|
"2025-08-01/clippy-nightly-aarch64-apple-darwin.tar.xz": "ed2219dbc49d088225e1b7c5c4390fa295066e071fddaa2714018f6bb39ddbf0",
|
|
"2025-08-01/clippy-nightly-x86_64-pc-windows-msvc.tar.xz": "911f40ab5cbdd686f40e00965271fe47c4805513a308ed01f30eafb25b448a50",
|
|
"2025-08-01/cargo-nightly-x86_64-unknown-linux-gnu.tar.xz": "106463c284e48e4904c717471eeec2be5cc83a9d2cae8d6e948b52438cad2e69",
|
|
"2025-08-01/cargo-nightly-x86_64-apple-darwin.tar.xz": "6ad35c40efc41a8c531ea43235058347b6902d98a9693bf0aed7fc16d5590cef",
|
|
"2025-08-01/cargo-nightly-aarch64-apple-darwin.tar.xz": "dd28c365e9d298abc3154c797720ad36a0058f131265c9978b4c8e4e37012c8a",
|
|
"2025-08-01/cargo-nightly-x86_64-pc-windows-msvc.tar.xz": "7b431286e12d6b3834b038f078389a00cac73f351e8c3152b2504a3c06420b3b",
|
|
"2025-08-01/llvm-tools-nightly-x86_64-unknown-linux-gnu.tar.xz": "e342e305d7927cc288d386983b2bc253cfad3776b113386e903d0b302648ef47",
|
|
"2025-08-01/llvm-tools-nightly-x86_64-apple-darwin.tar.xz": "e44dd3506524d85c37b3a54bcc91d01378fd2c590b2db5c5974d12f05c1b84d1",
|
|
"2025-08-01/llvm-tools-nightly-aarch64-apple-darwin.tar.xz": "0c1b5f46dd81be4a9227b10283a0fcaa39c14fea7e81aea6fd6d9887ff6cdc41",
|
|
"2025-08-01/llvm-tools-nightly-x86_64-pc-windows-msvc.tar.xz": "423e5fd11406adccbc31b8456ceb7375ce055cdf45e90d2c3babeb2d7f58383f",
|
|
"2025-08-01/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz": "3c0ceb46a252647a1d4c7116d9ccae684fa5e42aaf3296419febd2c962c3b41d",
|
|
"2025-08-01/rust-std-nightly-x86_64-apple-darwin.tar.xz": "3be416003cab10f767390a753d1d16ae4d26c7421c03c98992cf1943e5b0efe8",
|
|
"2025-08-01/rust-std-nightly-aarch64-apple-darwin.tar.xz": "4046ac0ef951cb056b5028a399124f60999fa37792eab69d008d8d7965f389b4",
|
|
"2025-08-01/rust-std-nightly-x86_64-pc-windows-msvc.tar.xz": "191ed9d8603c3a4fe5a7bbbc2feb72049078dae2df3d3b7d5dedf3abbf823e6e",
|
|
},
|
|
versions = [RUST_VERSION],
|
|
)
|
|
use_repo(rust, "rust_toolchains")
|
|
|
|
register_toolchains("@rust_toolchains//:all")
|
|
|
|
# deps for python extractor
|
|
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
|
|
py_deps = use_extension("//misc/bazel/3rdparty:py_deps_extension.bzl", "p")
|
|
use_repo(
|
|
py_deps,
|
|
"vendor_py__anyhow-1.0.95",
|
|
"vendor_py__cc-1.2.14",
|
|
"vendor_py__clap-4.5.30",
|
|
"vendor_py__regex-1.11.1",
|
|
"vendor_py__tree-sitter-0.20.4",
|
|
"vendor_py__tree-sitter-graph-0.7.0",
|
|
)
|
|
|
|
# deps for ruby+rust
|
|
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
|
|
tree_sitter_extractors_deps = use_extension("//misc/bazel/3rdparty:tree_sitter_extractors_extension.bzl", "r")
|
|
use_repo(
|
|
tree_sitter_extractors_deps,
|
|
"vendor_ts__anyhow-1.0.98",
|
|
"vendor_ts__argfile-0.2.1",
|
|
"vendor_ts__chalk-ir-0.103.0",
|
|
"vendor_ts__chrono-0.4.41",
|
|
"vendor_ts__clap-4.5.40",
|
|
"vendor_ts__dunce-1.0.5",
|
|
"vendor_ts__either-1.15.0",
|
|
"vendor_ts__encoding-0.2.33",
|
|
"vendor_ts__figment-0.10.19",
|
|
"vendor_ts__flate2-1.1.0",
|
|
"vendor_ts__glob-0.3.2",
|
|
"vendor_ts__globset-0.4.15",
|
|
"vendor_ts__itertools-0.14.0",
|
|
"vendor_ts__lazy_static-1.5.0",
|
|
"vendor_ts__mustache-0.9.0",
|
|
"vendor_ts__num-traits-0.2.19",
|
|
"vendor_ts__num_cpus-1.17.0",
|
|
"vendor_ts__proc-macro2-1.0.95",
|
|
"vendor_ts__quote-1.0.40",
|
|
"vendor_ts__ra_ap_base_db-0.0.288",
|
|
"vendor_ts__ra_ap_cfg-0.0.288",
|
|
"vendor_ts__ra_ap_hir-0.0.288",
|
|
"vendor_ts__ra_ap_hir_def-0.0.288",
|
|
"vendor_ts__ra_ap_hir_expand-0.0.288",
|
|
"vendor_ts__ra_ap_hir_ty-0.0.288",
|
|
"vendor_ts__ra_ap_ide_db-0.0.288",
|
|
"vendor_ts__ra_ap_intern-0.0.288",
|
|
"vendor_ts__ra_ap_load-cargo-0.0.288",
|
|
"vendor_ts__ra_ap_parser-0.0.288",
|
|
"vendor_ts__ra_ap_paths-0.0.288",
|
|
"vendor_ts__ra_ap_project_model-0.0.288",
|
|
"vendor_ts__ra_ap_span-0.0.288",
|
|
"vendor_ts__ra_ap_stdx-0.0.288",
|
|
"vendor_ts__ra_ap_syntax-0.0.288",
|
|
"vendor_ts__ra_ap_vfs-0.0.288",
|
|
"vendor_ts__rand-0.9.1",
|
|
"vendor_ts__rayon-1.10.0",
|
|
"vendor_ts__regex-1.11.1",
|
|
"vendor_ts__serde-1.0.219",
|
|
"vendor_ts__serde_json-1.0.140",
|
|
"vendor_ts__serde_with-3.13.0",
|
|
"vendor_ts__syn-2.0.103",
|
|
"vendor_ts__toml-0.8.23",
|
|
"vendor_ts__tracing-0.1.41",
|
|
"vendor_ts__tracing-flame-0.2.0",
|
|
"vendor_ts__tracing-subscriber-0.3.19",
|
|
"vendor_ts__tree-sitter-0.24.6",
|
|
"vendor_ts__tree-sitter-embedded-template-0.23.2",
|
|
"vendor_ts__tree-sitter-json-0.24.8",
|
|
"vendor_ts__tree-sitter-ql-0.23.1",
|
|
"vendor_ts__tree-sitter-ruby-0.23.1",
|
|
"vendor_ts__triomphe-0.1.14",
|
|
"vendor_ts__ungrammar-1.16.1",
|
|
"vendor_ts__zstd-0.13.3",
|
|
)
|
|
|
|
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
# rust-analyzer sources needed by the rust ast-generator (see `rust/ast-generator/README.md`)
|
|
RUST_ANALYZER_SRC_TAG = "2025-01-07"
|
|
|
|
http_archive(
|
|
name = "rust-analyzer-src",
|
|
build_file = "//rust/ast-generator:BUILD.rust-analyzer-src.bazel",
|
|
integrity = "sha256-eo8mIaUafZL8LOM65bDIIIXw1rNQ/P/x5RK/XUtgo5g=",
|
|
patch_args = ["-p1"],
|
|
patches = [
|
|
"//rust/ast-generator:patches/rust-analyzer.patch",
|
|
],
|
|
strip_prefix = "rust-analyzer-%s" % RUST_ANALYZER_SRC_TAG,
|
|
url = "https://github.com/rust-lang/rust-analyzer/archive/refs/tags/%s.tar.gz" % RUST_ANALYZER_SRC_TAG,
|
|
)
|
|
|
|
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
|
|
dotnet.toolchain(dotnet_version = "9.0.100")
|
|
use_repo(dotnet, "dotnet_toolchains")
|
|
|
|
register_toolchains("@dotnet_toolchains//:all")
|
|
|
|
csharp_main_extension = use_extension("//csharp:paket.main_extension.bzl", "main_extension")
|
|
use_repo(csharp_main_extension, "paket.main")
|
|
|
|
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
|
|
pip.parse(
|
|
hub_name = "codegen_deps",
|
|
python_version = "3.12",
|
|
requirements_lock = "//misc/codegen:requirements_lock.txt",
|
|
)
|
|
use_repo(pip, "codegen_deps")
|
|
|
|
swift_deps = use_extension("//swift/third_party:load.bzl", "swift_deps")
|
|
|
|
# following list can be kept in sync with `bazel mod tidy`
|
|
use_repo(
|
|
swift_deps,
|
|
"binlog",
|
|
"picosha2",
|
|
"swift-prebuilt-linux",
|
|
"swift-prebuilt-linux-download-only",
|
|
"swift-prebuilt-macos",
|
|
"swift-prebuilt-macos-download-only",
|
|
"swift-resource-dir-linux",
|
|
"swift-resource-dir-macos",
|
|
)
|
|
|
|
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
|
|
node.toolchain(
|
|
name = "nodejs",
|
|
node_urls = [
|
|
"https://nodejs.org/dist/v{version}/{filename}",
|
|
"https://mirrors.dotsrc.org/nodejs/release/v{version}/{filename}",
|
|
],
|
|
node_version = "18.15.0",
|
|
)
|
|
use_repo(node, "nodejs", "nodejs_toolchains")
|
|
|
|
kotlin_extractor_deps = use_extension("//java/kotlin-extractor:deps.bzl", "kotlin_extractor_deps")
|
|
|
|
# following list can be kept in sync by running `bazel mod tidy` in `codeql`
|
|
use_repo(
|
|
kotlin_extractor_deps,
|
|
"codeql_kotlin_defaults",
|
|
"codeql_kotlin_embeddable",
|
|
"kotlin-compiler-1.6.0",
|
|
"kotlin-compiler-1.6.20",
|
|
"kotlin-compiler-1.7.0",
|
|
"kotlin-compiler-1.7.20",
|
|
"kotlin-compiler-1.8.0",
|
|
"kotlin-compiler-1.9.0-Beta",
|
|
"kotlin-compiler-1.9.20-Beta",
|
|
"kotlin-compiler-2.0.0-RC1",
|
|
"kotlin-compiler-2.0.20-Beta2",
|
|
"kotlin-compiler-2.1.0-Beta1",
|
|
"kotlin-compiler-2.1.20-Beta1",
|
|
"kotlin-compiler-2.2.0-Beta1",
|
|
"kotlin-compiler-2.2.20-Beta2",
|
|
"kotlin-compiler-embeddable-1.6.0",
|
|
"kotlin-compiler-embeddable-1.6.20",
|
|
"kotlin-compiler-embeddable-1.7.0",
|
|
"kotlin-compiler-embeddable-1.7.20",
|
|
"kotlin-compiler-embeddable-1.8.0",
|
|
"kotlin-compiler-embeddable-1.9.0-Beta",
|
|
"kotlin-compiler-embeddable-1.9.20-Beta",
|
|
"kotlin-compiler-embeddable-2.0.0-RC1",
|
|
"kotlin-compiler-embeddable-2.0.20-Beta2",
|
|
"kotlin-compiler-embeddable-2.1.0-Beta1",
|
|
"kotlin-compiler-embeddable-2.1.20-Beta1",
|
|
"kotlin-compiler-embeddable-2.2.0-Beta1",
|
|
"kotlin-compiler-embeddable-2.2.20-Beta2",
|
|
"kotlin-stdlib-1.6.0",
|
|
"kotlin-stdlib-1.6.20",
|
|
"kotlin-stdlib-1.7.0",
|
|
"kotlin-stdlib-1.7.20",
|
|
"kotlin-stdlib-1.8.0",
|
|
"kotlin-stdlib-1.9.0-Beta",
|
|
"kotlin-stdlib-1.9.20-Beta",
|
|
"kotlin-stdlib-2.0.0-RC1",
|
|
"kotlin-stdlib-2.0.20-Beta2",
|
|
"kotlin-stdlib-2.1.0-Beta1",
|
|
"kotlin-stdlib-2.1.20-Beta1",
|
|
"kotlin-stdlib-2.2.0-Beta1",
|
|
"kotlin-stdlib-2.2.20-Beta2",
|
|
)
|
|
|
|
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
|
|
go_sdk.download(version = "1.24.0")
|
|
|
|
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
|
|
go_deps.from_file(go_mod = "//go/extractor:go.mod")
|
|
use_repo(go_deps, "org_golang_x_mod", "org_golang_x_tools")
|
|
|
|
lfs_archive = use_repo_rule("//misc/bazel:lfs.bzl", "lfs_archive")
|
|
|
|
lfs_archive(
|
|
name = "ripunzip-linux",
|
|
src = "//misc/ripunzip:ripunzip-Linux.zip",
|
|
build_file = "//misc/ripunzip:BUILD.ripunzip.bazel",
|
|
)
|
|
|
|
lfs_archive(
|
|
name = "ripunzip-windows",
|
|
src = "//misc/ripunzip:ripunzip-Windows.zip",
|
|
build_file = "//misc/ripunzip:BUILD.ripunzip.bazel",
|
|
)
|
|
|
|
lfs_archive(
|
|
name = "ripunzip-macos",
|
|
src = "//misc/ripunzip:ripunzip-macOS.zip",
|
|
build_file = "//misc/ripunzip:BUILD.ripunzip.bazel",
|
|
)
|
|
|
|
register_toolchains(
|
|
"@nodejs_toolchains//:all",
|
|
)
|