blob: 1c9e25e6912869f35077a251f623a1589f6fd85b [file]
module(
name = "bazel-diff",
version = "45.0.2",
compatibility_level = 0,
)
bazel_dep(name = "aspect_rules_lint", version = "2.1.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.5.1.2", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5", dev_dependency = True)
bazel_dep(name = "bazel_skylib", version = "1.9.0")
# Direct dep because //release selects on @platforms//os and @platforms//cpu to
# name the release binaries.
bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "rules_java", version = "9.7.0")
bazel_dep(name = "rules_kotlin", version = "2.4.0")
bazel_dep(name = "rules_license", version = "1.0.0")
# kt_jvm_test hardcodes its _lcov_merger to Bazel's built-in merger instead of
# reading the coverage fragment's output_generator configuration field, so it
# ignores --coverage_output_generator (see tools/coverage/README.md — that flag
# is how per-target coverage minimums are enforced). Patch it to use the
# configuration field, like rules_go/rules_rust/rules_java do. Root-module-only:
# overrides are ignored when bazel-diff is consumed as a dependency.
single_version_override(
module_name = "rules_kotlin",
patch_strip = 1,
patches = ["//tools/coverage:rules_kotlin_lcov_merger.patch"],
)
bazel_dep(name = "rules_jvm_external", version = "6.10")
# Add protobuf and grpc for Bazel 9 compatibility
bazel_dep(name = "protobuf", version = "33.4")
bazel_dep(name = "stardoc", version = "0.7.2")
single_version_override(
module_name = "grpc-java",
version = "1.78.0",
)
bazel_dep(name = "grpc", version = "1.76.0", repo_name = "com_github_grpc_grpc")
# Override transitive dependencies to Bazel 9 compatible versions.
# Marked dev_dependency: these are only needed when building bazel-diff itself
# (as the root module). rules_nodejs and rules_foreign_cc are not referenced by
# any bazel-diff target, and rules_python is supplied transitively (proto codegen)
# regardless, so consumers resolve their own versions via MVS.
bazel_dep(name = "rules_nodejs", version = "6.7.3", dev_dependency = True)
bazel_dep(name = "rules_foreign_cc", version = "0.15.1", dev_dependency = True)
bazel_dep(name = "rules_python", version = "1.8.4", dev_dependency = True)
# Go support is internal to building/testing bazel-diff (tooling under tools/go,
# whose line coverage is gated at >=90% in CI). Marked dev_dependency so consumers
# of bazel-diff as a module don't inherit rules_go/gazelle via MVS.
bazel_dep(name = "rules_go", version = "0.60.0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.47.0", dev_dependency = True)
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk", dev_dependency = True)
go_sdk.download(version = "1.23.1")
# Rust is a first-class published implementation (`//:bazel-diff-rust`) and is
# also used by the LCOV merger under //tools/coverage. Kept as a non-dev
# dependency so BCR consumers and top-level verify_targets can build the Rust
# binary without --ignore_dev_dependency stripping the crate repos/toolchains.
bazel_dep(name = "rules_rust", version = "0.73.0")
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
# rustfmt_version is pinned to the same release as the toolchain instead of
# rules_rust's default (a nightly), so the `rustfmt_aspect` gate in .bazelrc
# checks formatting with the exact rustfmt a contributor gets from `cargo fmt`
# on a stable toolchain. A nightly rustfmt can change defaults between releases,
# which would fail CI on code that formats cleanly locally.
rust.toolchain(
edition = "2021",
rustfmt_version = "1.90.0",
# Confine the stock toolchains to platforms that use the system libc. They
# are only constrained by os and cpu -- rules_rust has no musl constraint --
# so on //platforms:linux_x86_64_musl they would match alongside the musl
# toolchain below and resolution would silently take whichever of the two
# was registered first.
target_settings = ["//platforms:is_system_libc"],
versions = ["1.90.0"],
)
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")
# Rust std for the statically linked musl release binary, cross-compiled from a
# glibc Linux host (the release runner) or from an Apple Silicon Mac (so a
# maintainer can reproduce the published binary locally). rustc itself is the
# ordinary glibc build: only the target changes, which is what keeps proc-macro
# and build-script actions -- compiled for the exec platform -- loadable.
# These toolchains join the same @rust_toolchains hub registered above.
rust.repository_set(
name = "rust_musl_linux_x86_64",
edition = "2021",
exec_triple = "x86_64-unknown-linux-gnu",
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
"//platforms:musl",
],
target_settings = ["//platforms:is_musl"],
target_triple = "x86_64-unknown-linux-musl",
versions = ["1.90.0"],
)
# rules_rust also emits a toolchain for a set's own exec triple, so the set
# above comes with a glibc x86_64 Linux toolchain whether or not it is wanted.
# Declaring its constraints keeps it from matching musl builds; the set-level
# //platforms:is_musl gate keeps it out of ordinary builds, where the stock
# toolchain serves and this one would otherwise be a second, identical
# candidate whose repository is a redundant ~200MB download.
rust.repository_set(
name = "rust_musl_linux_x86_64",
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
"//platforms:system_libc",
],
target_triple = "x86_64-unknown-linux-gnu",
)
# The macOS-hosted half of the same story. No companion tag is needed here: this
# set's exec-triple toolchain targets macOS, and a macOS platform can never
# satisfy the set's //platforms:is_musl gate.
rust.repository_set(
name = "rust_musl_macos_aarch64",
edition = "2021",
exec_triple = "aarch64-apple-darwin",
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
"//platforms:musl",
],
target_settings = ["//platforms:is_musl"],
target_triple = "x86_64-unknown-linux-musl",
versions = ["1.90.0"],
)
# C toolchain for the musl target: a gcc cross-compiler bundled with musl libc,
# used to link the Rust binary and to build the C in `ring` (rustls). Scoped to
# //platforms:musl so it never displaces the host cc toolchain on ordinary
# builds. dev_dependency because only bazel-diff's own release build needs it --
# consumers of the module never resolve it.
bazel_dep(name = "toolchains_musl", version = "0.1.27.bcr.1", dev_dependency = True)
toolchains_musl = use_extension(
"@toolchains_musl//:toolchains_musl.bzl",
"toolchains_musl",
dev_dependency = True,
)
toolchains_musl.config(extra_target_compatible_with = ["//platforms:musl"])
# Toolchain pinned to `rust-version` in Cargo.toml, so the MSRV job in ci.yaml
# can prove the crate still builds on the minimum Rust it advertises. Keep the
# version in sync with `rust-version` in Cargo.toml.
#
# It lands in the same @rust_toolchains hub as everything above, but rules_rust
# appends `repository_set` toolchains *after* the default ones, so it never wins
# ordinary toolchain resolution. The MSRV job selects it explicitly with
# --extra_toolchains, which outranks every registered toolchain. It carries the
# same system-libc gate as the stock toolchains for the same reason they do: one
# Rust toolchain should match any given build, never two.
#
# Linux/x86_64 only: a `repository_set` tag declares one exec triple, and the
# MSRV job runs on ubuntu-latest. Building it on another host just falls back to
# the default toolchain (no MSRV coverage), it does not fail.
rust.repository_set(
name = "rust_msrv",
edition = "2021",
exec_triple = "x86_64-unknown-linux-gnu",
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
"//platforms:system_libc",
],
target_settings = ["//platforms:is_system_libc"],
target_triple = "x86_64-unknown-linux-gnu",
versions = ["1.85.0"],
)
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = "bazel_diff_maven",
artifacts = [
"com.google.code.gson:gson:2.14.0@jar",
"com.google.guava:guava:33.6.0-jre",
"com.willowtreeapps.assertk:assertk-jvm:0.28.1",
"info.picocli:picocli:4.7.7@jar",
"io.insert-koin:koin-core-jvm:4.2.2",
"io.insert-koin:koin-test-junit4:4.2.2",
"junit:junit:4.13.2",
"org.apache.commons:commons-pool2:2.13.1",
"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0",
"org.mockito.kotlin:mockito-kotlin:6.3.0",
"software.amazon.awssdk:url-connection-client:2.46.7",
],
fail_if_repin_required = True,
lock_file = "//:maven_install.json",
)
# AWS SDK for the `serve` S3 hash-cache backend. The Netty/Apache HTTP clients are
# excluded (the service explicitly uses the lightweight url-connection-client above)
# to keep the deploy jar lean. `sts` is runtime-only: DefaultCredentialsProvider needs
# it to assume the pod's IAM role via web identity (IRSA) when running on EKS.
maven.artifact(
name = "bazel_diff_maven",
artifact = "s3",
exclusions = [
"software.amazon.awssdk:netty-nio-client",
"software.amazon.awssdk:apache-client",
"software.amazon.awssdk:apache5-client",
],
group = "software.amazon.awssdk",
version = "2.46.7",
)
maven.artifact(
name = "bazel_diff_maven",
artifact = "sts",
exclusions = [
"software.amazon.awssdk:netty-nio-client",
"software.amazon.awssdk:apache-client",
"software.amazon.awssdk:apache5-client",
],
group = "software.amazon.awssdk",
version = "2.46.7",
)
use_repo(
maven,
bazel_diff_maven = "bazel_diff_maven",
)
non_module_repositories = use_extension("//:extensions.bzl", "non_module_repositories", dev_dependency = True)
use_repo(non_module_repositories, "ktfmt")
register_toolchains("//:kotlin_toolchain")
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
crate.from_cargo(
name = "bazel_diff_crates",
cargo_lockfile = "//:Cargo.lock",
# crate_universe refuses to run from_cargo in a non-root module without a
# checked-in cargo-bazel lockfile (repinning can't cross module boundaries),
# so BCR consumers need this file shipped in the release archive.
# Regenerate with: CARGO_BAZEL_REPIN=1 bazel sync --only=bazel_diff_crates
lockfile = "//:cargo-bazel-lock.json",
manifests = ["//:Cargo.toml"],
)
use_repo(crate, "bazel_diff_crates")