Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Bzlmod. #65

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Enable Bzlmod with WFA registry.
common --enable_bzlmod
common --registry=https://raw.githubusercontent.com/world-federation-of-advertisers/bazel-registry/main
common --registry=https://bcr.bazel.build

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

Expand All @@ -7,5 +12,8 @@ build --cxxopt='-std=c++17'
# Use JDK 11. See https://github.com/bazelbuild/bazel/issues/6245.
build --java_runtime_version=remotejdk_11

# Target Java 8.
build --java_language_version=8
# Target Java 9.
build --java_language_version=9

# TODO(world-federation-of-advertisers/virtual-people-common#64): Remove when fixed.
test --compilation_mode=fastbuild
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
68 changes: 68 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module(
name = "virtual-people-common",
repo_name = "wfa_virtual_people_common",
)

TRUTH_VERSION = "1.1.2"

MAVEN_REPO_NAME = "vpc_maven"

# Bazel Central Registry modules.
bazel_dep(
name = "rules_proto",
version = "5.3.0-21.7",
)
bazel_dep(
name = "protobuf",
version = "21.7",
repo_name = "com_google_protobuf",
)
bazel_dep(
name = "rules_cc",
version = "0.0.9",
)
bazel_dep(
name = "abseil-cpp",
version = "20230802.0.bcr.1",
repo_name = "com_google_absl",
)
bazel_dep(
name = "googletest",
version = "1.14.0.bcr.1",
repo_name = "com_google_googletest",
)
bazel_dep(
name = "rules_java",
version = "7.2.0",
)
bazel_dep(
name = "rules_jvm_external",
version = "5.3",
)

# WFA registry modules.
bazel_dep(
name = "common-cpp",
version = "0.11.0",
repo_name = "wfa_common_cpp",
)
bazel_dep(
name = "rules_kotlin_jvm",
version = "0.1.1",
repo_name = "wfa_rules_kotlin_jvm",
)

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = MAVEN_REPO_NAME,
artifacts = [
"junit:junit:4.13.2",
"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,
],
fetch_sources = True, # For IDE integration.
strict_visibility = True,
)
use_repo(maven, MAVEN_REPO_NAME)
39 changes: 1 addition & 38 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,38 +1 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

load("//build:repositories.bzl", "virtual_people_common_repositories")

virtual_people_common_repositories()

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

common_jvm_repositories()

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

common_jvm_deps()

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

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

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

common_jvm_extra_deps()

load("@wfa_common_cpp//build:common_cpp_repositories.bzl", "common_cpp_repositories")

common_cpp_repositories()

load("@wfa_common_cpp//build:common_cpp_deps.bzl", "common_cpp_deps")

common_cpp_deps()
workspace(name = "wfa_virtual_people_common")
11 changes: 11 additions & 0 deletions imports/com/google/common/truth/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

java_library(
name = "truth",
exports = [
"@vpc_maven//:com_google_truth_extensions_truth_java8_extension",
"@vpc_maven//:com_google_truth_truth",
],
)
11 changes: 11 additions & 0 deletions imports/com/google/common/truth/extensions/proto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

java_library(
name = "proto",
exports = [
"@vpc_maven//:com_google_truth_extensions_truth_liteproto_extension",
"@vpc_maven//:com_google_truth_extensions_truth_proto_extension",
],
)
6 changes: 6 additions & 0 deletions imports/org/junit/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package(default_visibility = ["//visibility:public"])

alias(
name = "junit",
actual = "@vpc_maven//:junit_junit",
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@wfa_common_jvm//build/rules_kotlin:defs.bzl", "kt_jvm_library")
load("@wfa_rules_kotlin_jvm//kotlin:defs.bzl", "kt_jvm_library")

package(default_visibility = ["//visibility:public"])

Expand All @@ -8,6 +8,6 @@ kt_jvm_library(
deps = [
"//src/main/kotlin/org/wfanet/virtualpeople/common/fieldfilter/utils",
"//src/main/proto/wfa/virtual_people/common:field_filter_kt_jvm_proto",
"@wfa_common_jvm//imports/java/com/google/protobuf",
"@wfa_rules_kotlin_jvm//imports/com/google/protobuf",
],
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@wfa_common_jvm//build/rules_kotlin:defs.bzl", "kt_jvm_library")
load("@wfa_rules_kotlin_jvm//kotlin:defs.bzl", "kt_jvm_library")

package(default_visibility = ["//visibility:public"])

Expand All @@ -7,6 +7,6 @@ kt_jvm_library(
srcs = glob(["*.kt"]),
deps = [
"//src/main/proto/wfa/virtual_people/common:field_filter_kt_jvm_proto",
"@wfa_common_jvm//imports/java/com/google/protobuf",
"@wfa_rules_kotlin_jvm//imports/com/google/protobuf",
],
)
67 changes: 9 additions & 58 deletions src/main/proto/wfa/virtual_people/common/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@wfa_common_jvm//build/kt_jvm_proto:defs.bzl", "kt_jvm_proto_library")
load("@wfa_rules_kotlin_jvm//kotlin:defs.bzl", "kt_jvm_proto_library")

package(default_visibility = ["//visibility:public"])

Expand All @@ -25,15 +24,9 @@ cc_proto_library(
deps = [":model_proto"],
)

java_proto_library(
name = "model_java_proto",
deps = [":model_proto"],
)

kt_jvm_proto_library(
name = "model_kt_jvm_proto",
srcs = [":model_proto"],
deps = [":model_java_proto"],
deps = [":model_proto"],
)

proto_library(
Expand All @@ -53,15 +46,9 @@ cc_proto_library(
deps = [":event_proto"],
)

java_proto_library(
name = "event_java_proto",
deps = [":event_proto"],
)

kt_jvm_proto_library(
name = "event_kt_jvm_proto",
srcs = [":event_proto"],
deps = [":event_java_proto"],
deps = [":event_proto"],
)

proto_library(
Expand All @@ -78,15 +65,9 @@ cc_proto_library(
deps = [":label_proto"],
)

java_proto_library(
name = "label_java_proto",
deps = [":label_proto"],
)

kt_jvm_proto_library(
name = "label_kt_jvm_proto",
srcs = [":label_proto"],
deps = [":label_java_proto"],
deps = [":label_proto"],
)

proto_library(
Expand All @@ -100,15 +81,9 @@ cc_proto_library(
deps = [":demographic_proto"],
)

java_proto_library(
name = "demographic_java_proto",
deps = [":demographic_proto"],
)

kt_jvm_proto_library(
name = "demographic_kt_jvm_proto",
srcs = [":demographic_proto"],
deps = [":demographic_java_proto"],
deps = [":demographic_proto"],
)

proto_library(
Expand All @@ -122,15 +97,9 @@ cc_proto_library(
deps = [":geo_location_proto"],
)

java_proto_library(
name = "geo_location_java_proto",
deps = [":geo_location_proto"],
)

kt_jvm_proto_library(
name = "geo_location_kt_jvm_proto",
srcs = [":geo_location_proto"],
deps = [":geo_location_java_proto"],
deps = [":geo_location_proto"],
)

proto_library(
Expand All @@ -147,15 +116,9 @@ cc_proto_library(
deps = [":panel_data_proto"],
)

java_proto_library(
name = "panel_data_java_proto",
deps = [":panel_data_proto"],
)

kt_jvm_proto_library(
name = "panel_data_kt_jvm_proto",
srcs = [":panel_data_proto"],
deps = [":panel_data_java_proto"],
deps = [":panel_data_proto"],
)

proto_library(
Expand All @@ -169,15 +132,9 @@ cc_proto_library(
deps = [":field_filter_proto"],
)

java_proto_library(
name = "field_filter_java_proto",
deps = [":field_filter_proto"],
)

kt_jvm_proto_library(
name = "field_filter_kt_jvm_proto",
srcs = [":field_filter_proto"],
deps = [":field_filter_java_proto"],
deps = [":field_filter_proto"],
)

proto_library(
Expand All @@ -191,13 +148,7 @@ cc_proto_library(
deps = [":config_proto"],
)

java_proto_library(
name = "config_java_proto",
deps = [":config_proto"],
)

kt_jvm_proto_library(
name = "config_kt_jvm_proto",
srcs = [":config_proto"],
deps = [":config_java_proto"],
deps = [":config_proto"],
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
load("@wfa_common_jvm//build/kt_jvm_proto:defs.bzl", "kt_jvm_proto_library")
load("@wfa_rules_kotlin_jvm//kotlin:defs.bzl", "kt_jvm_proto_library")

package(default_visibility = ["//src/test:__subpackages__"])

Expand All @@ -18,13 +17,7 @@ cc_proto_library(
deps = [":test_proto"],
)

java_proto_library(
name = "test_java_proto",
deps = [":test_proto"],
)

kt_jvm_proto_library(
name = "test_kt_jvm_proto",
srcs = [":test_proto"],
deps = [":test_java_proto"],
deps = [":test_proto"],
)
Loading
Loading