Skip to content

Commit

Permalink
feat: Support multi-version generation
Browse files Browse the repository at this point in the history
This allows the generator repo to be imported multiple times with
different versions, so the same Bazel workspace can have different
APIs generated with different versions.
  • Loading branch information
jskeet committed May 16, 2022
1 parent 591f83d commit 6d5b238
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//rules_csharp_gapic:csharp_compiler_repo.bzl", "csharp_compiler", "dotnet_restore")

def gapic_generator_csharp_repositories():
def gapic_generator_csharp_repositories(gapic_generator_suffix = ""):
_rules_gapic_version = "0.8.0"
_rules_gapic_sha256 = "75705d03068ba07cc885a85bb4585e2a278414e31510e60577df8437a28a4ae1"

Expand All @@ -34,6 +34,6 @@ def gapic_generator_csharp_repositories():
)
maybe(
dotnet_restore,
name = "gapic_generator_restore",
csproj = "@gapic_generator_csharp//:Google.Api.Generator/Google.Api.Generator.csproj",
name = "gapic_generator_restore%s" % gapic_generator_suffix,
csproj = "@gapic_generator_csharp%s//:Google.Api.Generator/Google.Api.Generator.csproj" % gapic_generator_suffix,
)
3 changes: 2 additions & 1 deletion rules_csharp_gapic/csharp_gapic.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def csharp_gapic_library(
grpc_service_config = None,
common_resources_config = None,
service_yaml = None,
generator_binary = "//rules_csharp_gapic:csharp_gapic_generator_binary",
**kwargs):
# Build zip file of gapic-generator output
name_srcjar = "{name}_srcjar".format(name = name)
Expand All @@ -54,7 +55,7 @@ def csharp_gapic_library(
proto_custom_library(
name = name_srcjar,
deps = srcs,
plugin = Label("//rules_csharp_gapic:csharp_gapic_generator_binary"),
plugin = Label(generator_binary),
plugin_file_args = plugin_file_args,
output_type = "gapic",
output_suffix = ".srcjar",
Expand Down

0 comments on commit 6d5b238

Please sign in to comment.