Merge pull request #16716 from github/criemen/rust-bzlmod-new

Rust: Move to bzlmod.
This commit is contained in:
Cornelius Riemenschneider
2024-06-11 13:13:16 +02:00
committed by GitHub
11 changed files with 55 additions and 8908 deletions

View File

@@ -1 +1 @@
7.1.2
7.2.0

View File

@@ -13,22 +13,45 @@ local_path_override(
# see https://registry.bazel.build/ for a list of available packages
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_go", version = "0.47.0")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_go", version = "0.48.0")
bazel_dep(name = "rules_pkg", version = "0.10.1")
bazel_dep(name = "rules_nodejs", version = "6.0.3")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_nodejs", version = "6.2.0")
bazel_dep(name = "rules_python", version = "0.32.2")
bazel_dep(name = "bazel_skylib", version = "1.6.1")
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")
bazel_dep(name = "rules_kotlin", version = "1.9.4-codeql.1")
bazel_dep(name = "gazelle", version = "0.36.0")
bazel_dep(name = "gazelle", version = "0.37.0")
bazel_dep(name = "rules_dotnet", version = "0.15.1")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "rules_rust", version = "0.46.0")
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
crate = use_extension(
"@rules_rust//crate_universe:extension.bzl",
"crate",
)
crate.from_cargo(
name = "py_deps",
cargo_lockfile = "//python/extractor/tsg-python:Cargo.lock",
manifests = [
"//python/extractor/tsg-python:Cargo.toml",
"//python/extractor/tsg-python/tsp:Cargo.toml",
],
)
crate.from_cargo(
name = "ruby_deps",
cargo_lockfile = "//ruby/extractor:Cargo.lock",
manifests = [
"//ruby/extractor:Cargo.toml",
"//ruby/extractor/codeql-extractor-fake-crate:Cargo.toml",
],
)
use_repo(crate, "py_deps", "ruby_deps")
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
dotnet.toolchain(dotnet_version = "8.0.101")
use_repo(dotnet, "dotnet_toolchains")

View File

@@ -11,7 +11,6 @@ codeql_csharp_library(
"Extractor/**/*.cs",
"Kinds/**/*.cs",
"Populators/**/*.cs",
"Properties/**/*.cs",
"*.cs",
]),
allow_unsafe_blocks = True,

View File

@@ -36,11 +36,3 @@ codeql_pack(
visibility = ["//visibility:public"],
zips = {"//javascript/extractor/lib/typescript": "tools"},
)
# TODO copy for internal repository backward compatibility
genrule(
name = "javascript.zip",
srcs = [":javascript-generic-zip"],
outs = ["javascript.zip"],
cmd = "cp $< $@",
)

23
misc/bazel/rust.bzl Normal file
View File

@@ -0,0 +1,23 @@
load("@rules_rust//rust:defs.bzl", "rust_binary")
load("@semmle_code//buildutils-internal:glibc_symbols_check.bzl", "glibc_symbols_check")
load("@semmle_code//buildutils-internal:lipo.bzl", "universal_binary")
def codeql_rust_binary(
name,
target_compatible_with = None,
visibility = None,
symbols_test = True,
**kwargs):
rust_label_name = name + "_single_arch"
universal_binary(
name = name,
dep = ":" + rust_label_name,
target_compatible_with = target_compatible_with,
visibility = visibility,
)
rust_binary(
name = rust_label_name,
**kwargs
)
if symbols_test:
glibc_symbols_check(name = name + "symbols-test", binary = name)

View File

@@ -1,5 +1,5 @@
load("@py_deps//:defs.bzl", "aliases", "all_crate_deps")
load("@semmle_code//:common.bzl", "codeql_rust_binary")
load("//misc/bazel:rust.bzl", "codeql_rust_binary")
codeql_rust_binary(
name = "tsg-python",

File diff suppressed because it is too large Load Diff

View File

@@ -6,15 +6,6 @@ version = "0.1.0"
authors = ["Taus Brock-Nannestad <tausbn@github.com>"]
edition = "2021"
# When changing/updating these, the `Cargo.Bazel.lock` file has to be regenerated.
# Run `CARGO_BAZEL_REPIN=true CARGO_BAZEL_REPIN_ONLY=py_deps ./tools/bazel sync --only=py_deps`
# in the `semmle-code` repository to do so.
# For more information, check out the documentation at
# https://bazelbuild.github.io/rules_rust/crate_universe.html#repinning--updating-dependencies
# In the future, the hope is to move this handling of the dependencies entirely into the `codeql` repository,
# but that depends on `rules_rust` being fully compatible with bzlmod, which they aren't yet
# (c.f. https://github.com/bazelbuild/rules_rust/issues/2452).
# Warning: The process takes >5min on my M1 mac, so do wait for a while.
[dependencies]
anyhow = "1.0"
regex = "1"

View File

@@ -1,5 +1,5 @@
load("@ruby_deps//:defs.bzl", "aliases", "all_crate_deps")
load("@semmle_code//:common.bzl", "codeql_rust_binary")
load("//misc/bazel:rust.bzl", "codeql_rust_binary")
codeql_rust_binary(
name = "extractor",

View File

@@ -6,15 +6,6 @@ version = "0.1.0"
authors = ["GitHub"]
edition = "2021"
# When changing/updating these, the `cargo-bazel-lock.json` file has to be regenerated.
# Run `CARGO_BAZEL_REPIN=true CARGO_BAZEL_REPIN_ONLY=ruby_deps ./tools/bazel sync --only=ruby_deps`
# in the `semmle-code` repository to do so.
# For more information, check out the documentation at
# https://bazelbuild.github.io/rules_rust/crate_universe.html#repinning--updating-dependencies
# In the future, the hope is to move this handling of the dependencies entirely into the `codeql` repository,
# but that depends on `rules_rust` being fully compatible with bzlmod, which they aren't yet
# (c.f. https://github.com/bazelbuild/rules_rust/issues/2452).
# Warning: The process takes >5min on my M1 mac, so do wait for a while.
[dependencies]
tree-sitter = ">= 0.22.6"
tree-sitter-embedded-template = { git = "https://github.com/tree-sitter/tree-sitter-embedded-template.git", rev = "38d5004a797298dc42c85e7706c5ceac46a3f29f" }

File diff suppressed because it is too large Load Diff