Skip to content

Commit

Permalink
examples: Fix WORKSPACE to allow referencing grpc-xds
Browse files Browse the repository at this point in the history
  • Loading branch information
ejona86 committed Jul 23, 2024
1 parent 36e687f commit 5ec0187
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 0 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,3 @@ maven.override(
switched_rules = use_extension("@com_google_googleapis//:extensions.bzl", "switched_rules")

switched_rules.use_languages(java = True)

use_repo(switched_rules, "com_google_googleapis_imports")
10 changes: 10 additions & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,13 @@ java_binary(
":examples",
],
)

# grpc-xds requires some WORKSPACE/MODULE deps that aren't needed by the other
# targets. This just makes sure the example WORKSPACE/MODULE works with
# grpc-xds.
java_library(
name = "test_grpc_xds_compiles",
runtime_deps = [
"@io_grpc_grpc_java//xds",
],
)
5 changes: 5 additions & 0 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bazel_dep(name = "googleapis", repo_name = "com_google_googleapis", version = "0.0.0-20240326-1c8d509c5")
bazel_dep(name = "grpc-java", repo_name = "io_grpc_grpc_java", version = "1.66.0-SNAPSHOT") # CURRENT_GRPC_VERSION
bazel_dep(name = "grpc-proto", repo_name = "io_grpc_grpc_proto", version = "0.0.0-20240627-ec30f58")
bazel_dep(name = "protobuf", repo_name = "com_google_protobuf", version = "23.1")
Expand All @@ -10,6 +11,10 @@ local_path_override(
path = "..",
)

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

switched_rules.use_languages(java = True)

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

use_repo(maven, "maven")
Expand Down
11 changes: 11 additions & 0 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

load("@envoy_api//bazel:repositories.bzl", "api_dependencies")

api_dependencies()

load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")

switched_rules_by_language(
name = "com_google_googleapis_imports",
java = True,
)

maven_install(
artifacts = [
"com.google.api.grpc:grpc-google-cloud-pubsub-v1:0.1.24",
Expand Down

0 comments on commit 5ec0187

Please sign in to comment.