Skip to content

Commit

Permalink
Migrate to Bzlmod.
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjayVas committed Dec 5, 2023
1 parent 52199fd commit 95066e5
Show file tree
Hide file tree
Showing 132 changed files with 599 additions and 1,672 deletions.
7 changes: 6 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Enable Bzlmod.
common --enable_bzlmod
common --registry=https://raw.githubusercontent.com/SanjayVas/bazel-registry/main/
common --registry=https://bcr.bazel.build

# Use clang as C++ compiler.
build --repo_env='CC=clang'

Expand All @@ -8,4 +13,4 @@ build --cxxopt='-std=c++17'
build --java_runtime_version=remotejdk_11

# Target Java 8.
build --java_language_version=8
build --java_language_version=8
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.0
6.4.0
7 changes: 0 additions & 7 deletions BUILD.bazel

This file was deleted.

195 changes: 195 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
module(
name = "common_jvm",
repo_name = "wfa_common_jvm",
)

bazel_dep(
name = "platforms",
version = "0.0.7",
)
bazel_dep(
name = "bazel_skylib",
version = "1.5.0",
)
bazel_dep(
name = "rules_proto",
version = "5.3.0-21.7",
)
bazel_dep(
name = "rules_pkg",
version = "0.9.1",
)
bazel_dep(
name = "rules_java",
version = "6.5.2",
)
bazel_dep(
name = "rules_jvm_external",
version = "5.3",
)
bazel_dep(
name = "rules_kotlin_jvm",
repo_name = "wfa_rules_kotlin_jvm",
version = "0.1.0-rc2",
)

bazel_dep(
name = "protobuf",
version = "21.7",
repo_name = "com_google_protobuf",
)

KOTLINX_COROUTINES_VERSION = "1.7.3"

PROTOBUF_JAVA_VERSION = "3.25.1"

GRPC_JAVA_VERSION = "1.59.1"

AWS_JAVA_SDK_VERSION = "2.17.258"

OPENTELEMETRY_JAVA_VERSION = "1.32.0"

TRUTH_VERSION = "1.1.2"

TINK_VERSION = "1.8.0"

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

# Work around "circular dependency" between grpc-core and grpc-util.
# TODO(bazelbuild/rules_jvm_external#966): Remove when fixed.
maven.artifact(
artifact = "grpc-core",
exclusions = ["io.grpc:grpc-util"],
group = "io.grpc",
version = GRPC_JAVA_VERSION,
)
maven.install(
artifacts = [
"junit:junit:4.13.2",
"org.conscrypt:conscrypt-openjdk-uber:2.5.2",
"org.jetbrains:annotations:23.0.0",
"org.mockito.kotlin:mockito-kotlin:3.2.0",
"info.picocli:picocli:4.4.0",
"com.google.api:api-common:2.5.0",
"com.google.api:gax:2.22.0",
"com.google.cloud:google-cloud-core:2.27.0",
"com.google.cloud:google-cloud-core-grpc:2.27.0",
"com.google.cloud:google-cloud-storage:2.29.1",
"com.google.cloud:google-cloud-nio:0.127.7",
"com.google.cloud:google-cloud-spanner:6.35.2",
"com.google.cloud:google-cloud-bigquery:2.10.10",
"com.google.protobuf:protobuf-java:" + PROTOBUF_JAVA_VERSION,
"com.google.protobuf:protobuf-java-util:" + PROTOBUF_JAVA_VERSION,
"io.grpc:grpc-context:" + GRPC_JAVA_VERSION,
"io.grpc:grpc-testing:" + GRPC_JAVA_VERSION,
"io.grpc:grpc-netty:" + GRPC_JAVA_VERSION,
"io.grpc:grpc-services:" + GRPC_JAVA_VERSION,
"io.netty:netty-handler:4.1.79.Final",
"org.jetbrains.kotlinx:kotlinx-coroutines-test:" + KOTLINX_COROUTINES_VERSION,
"org.jetbrains.kotlinx:kotlinx-coroutines-debug:" + KOTLINX_COROUTINES_VERSION,
"org.jetbrains.kotlinx:kotlinx-coroutines-reactive:" + KOTLINX_COROUTINES_VERSION,
"org.jetbrains.kotlinx:kotlinx-coroutines-guava:" + KOTLINX_COROUTINES_VERSION,
"org.reactivestreams:reactive-streams:1.0.4",
"io.projectreactor:reactor-core:3.4.19",
"com.google.crypto.tink:tink:" + TINK_VERSION,

# Truth.
"com.google.truth:truth:" + TRUTH_VERSION,
"com.google.truth.extensions:truth-java8-extension:" + TRUTH_VERSION,
"com.google.truth.extensions:truth-proto-extension:" + TRUTH_VERSION,
"com.google.truth.extensions:truth-liteproto-extension:" + TRUTH_VERSION,

# AWS.
"com.adobe.testing:s3mock-junit4:2.2.3",
"software.amazon.awssdk:s3:" + AWS_JAVA_SDK_VERSION,
"software.amazon.awssdk:secretsmanager:" + AWS_JAVA_SDK_VERSION,
"software.amazon.awssdk:sts:" + AWS_JAVA_SDK_VERSION,
"software.amazon.awssdk:regions:" + AWS_JAVA_SDK_VERSION,

# OpenTelemetry.
"io.opentelemetry:opentelemetry-api:" + OPENTELEMETRY_JAVA_VERSION,
"io.opentelemetry:opentelemetry-context:" + OPENTELEMETRY_JAVA_VERSION,

# PostgreSQL.
"com.google.cloud.sql:postgres-socket-factory:1.6.2",
"com.google.cloud.sql:cloud-sql-connector-r2dbc-core:1.6.2",
"com.google.cloud.sql:cloud-sql-connector-r2dbc-postgres:1.6.2",
"org.postgresql:postgresql:42.4.0",
"org.testcontainers:postgresql:1.18.3",
"org.postgresql:r2dbc-postgresql:0.9.1.RELEASE",
"io.r2dbc:r2dbc-spi:0.9.1.RELEASE",

# Liquibase.
"org.yaml:snakeyaml:1.30",
"org.liquibase:liquibase-core:4.18.0",
"com.google.cloudspannerecosystem:liquibase-spanner:4.17.0",
"com.google.cloud:google-cloud-spanner-jdbc:2.9.0",
"org.liquibase.ext:liquibase-postgresql:4.11.0",

# Math library.
"org.apache.commons:commons-math3:3.6.1",
"org.apache.commons:commons-numbers-gamma:1.1",

# CSV library.
"com.opencsv:opencsv:5.6",

# Riegeli Decompressor
"org.apache.commons:commons-compress:1.22",
"org.brotli:dec:0.1.2",
"com.github.luben:zstd-jni:1.5.2-5",
],
exclusions = [
# protobuf-java and protobuf-javalite cannot coexist.
"com.google.protobuf:protobuf-javalite",
],
fetch_sources = True,
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
strict_visibility = True,
)
use_repo(maven, "maven")

bazel_dep(
name = "rules_oci",
version = "1.4.3",
)

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
name = "java_image_base",
digest = "sha256:241064293d5477b6b91fb75abc923023a5fde11740a8ef56f54666579f8fef42",
image = "gcr.io/distroless/java11-debian11",
)
use_repo(
oci,
"java_image_base",
)

bazel_dep(
name = "googleapis",
version = "0.1.0-rc1",
)

googleapis = use_extension("@googleapis//extensions:googleapis.bzl", "googleapis")
use_repo(googleapis, "com_google_googleapis")

repo_targets = use_extension("@googleapis//extensions:repo_targets.bzl", "repo_targets")
use_repo(repo_targets, "com_google_googleapis_imports")

non_module_deps = use_extension(
"//build/extensions:non_module_deps.bzl",
"non_module_deps",
)
non_module_deps.tink_java_version(
sha256 = "cff458ea60897f7a5edc91d1eb9c58c650c2fd3206d94672f29c950b94398a49",
version = TINK_VERSION,
)
use_repo(
non_module_deps,
"cloud_spanner_emulator",
"com_google_highwayhash",
"io_grpc_grpc_proto",
"tink_java_src",
)
31 changes: 2 additions & 29 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
# This file marks the root of the Bazel workspace.
# See MODULE.bazel for external dependencies setup.
workspace(name = "wfa_common_jvm")

load("//build:common_jvm_repositories.bzl", "common_jvm_repositories")

common_jvm_repositories()

load("//build:common_jvm_deps.bzl", "common_jvm_deps")

common_jvm_deps()

load(
"//build:common_jvm_maven.bzl",
"COMMON_JVM_EXCLUDED_ARTIFACTS",
"COMMON_JVM_MAVEN_OVERRIDE_TARGETS",
"common_jvm_maven_artifacts",
)
load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
artifacts = common_jvm_maven_artifacts(),
excluded_artifacts = COMMON_JVM_EXCLUDED_ARTIFACTS,
fetch_sources = True,
generate_compat_repositories = True,
override_targets = COMMON_JVM_MAVEN_OVERRIDE_TARGETS,
repositories = ["https://repo.maven.apache.org/maven2/"],
)

load("//build:common_jvm_extra_deps.bzl", "common_jvm_extra_deps")

common_jvm_extra_deps()
31 changes: 0 additions & 31 deletions build/bazel_skylib/repo.bzl

This file was deleted.

Empty file removed build/bazel_toolchains/BUILD.bazel
Empty file.
38 changes: 0 additions & 38 deletions build/bazel_toolchains/repo.bzl

This file was deleted.

Empty file.
29 changes: 0 additions & 29 deletions build/com_github_grpc_grpc/repo.bzl

This file was deleted.

Empty file removed build/com_google_truth/BUILD.bazel
Empty file.
24 changes: 0 additions & 24 deletions build/com_google_truth/repo.bzl

This file was deleted.

Loading

0 comments on commit 95066e5

Please sign in to comment.