Skip to content

Commit

Permalink
gentest
Browse files Browse the repository at this point in the history
  • Loading branch information
ValdemarGr committed Aug 4, 2023
1 parent 54dbe12 commit d113959
Show file tree
Hide file tree
Showing 7 changed files with 1,277 additions and 26 deletions.
3 changes: 3 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ scala_repositories()
register_toolchains("//toolchains:scala_proto_deps_toolchain")

register_toolchains("//toolchains:scala_proto_fs2_grpc_toolchain")

load("//:common_protos.bzl", "common_protos_dependencies")
common_protos_dependencies()
48 changes: 48 additions & 0 deletions common_protos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,51 @@ proto_library(
)
"""
)

# validate_sha = "04e84b10ceef0008673460bcf06f036b2add8d80"
# http_archive(
# name = "validate_protos",
# # sha256 = "22087a397beb5d40ff9c93463c61643d05bcabe1dfcbe67511e87f61385e9e54",
# strip_prefix = "protoc-gen-validate-%s" % validate_sha,
# url = "https://github.com/bufbuild/protoc-gen-validate/archive/%s.zip" % validate_sha,
# workspace_file_content = "",
# build_file_content = """
# proto_library(
# name = "validate_protos",
# visibility = ["//visibility:public"],
# deps = [
# "@common_protos//:scalapb_protos",
# "@common_protos//:common_protos"
# ],
# srcs = glob(["validate/*.proto"]
# )
# """
# )

validate_scalapb_sha = "5d5e886f6ede389fc35b9a676728be39e2c391d8"
http_archive(
name = "validate_scalapb_protos",
# sha256 = "22087a397beb5d40ff9c93463c61643d05bcabe1dfcbe67511e87f61385e9e54",
strip_prefix = "scalapb-validate-%s" % validate_scalapb_sha,
url = "https://github.com/scalapb/scalapb-validate/archive/%s.zip" % validate_scalapb_sha,
build_file_content = """
proto_library(
name = "validate_scalapb_protos",
visibility = ["//visibility:public"],
deps = [
"@common_protos//:scalapb_protos",
"@fs2_grpc//validate"
],
srcs = glob(["core/src/main/protobuf/scalapb/*.proto"]),
strip_import_prefix = "core/src/main/protobuf/scalapb"
)
"""
)

google_api_common_protos_sha = "3332dec527759859840a3a2ff108c67a54708130"
http_archive(
name = "google_api_common_protos",
# sha256 = "22087a397beb5d40ff9c93463c61643d05bcabe1dfcbe67511e87f61385e9e54",
strip_prefix = "api-common-protos-%s" % google_api_common_protos_sha,
url = "https://github.com/googleapis/api-common-protos/archive/%s.zip" % google_api_common_protos_sha
)
4 changes: 4 additions & 0 deletions dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ project_deps = [
# usage
java_dependency("io.grpc", "grpc-netty-shaded", grpc_version),
scala_dependency("org.typelevel", "fs2-grpc-runtime", "2.7.4"),

scala_dependency("com.thesamet.scalapb", "scalapb-validate-core" , "0.3.4"),
scala_dependency("com.thesamet.scalapb", "scalapb-validate-codegen" , "0.3.4"),
scala_dependency("com.thesamet.scalapb.common-protos", "proto-google-common-protos-scalapb_0.11", "2.9.6-0")
]

def add_scala_fullver(s):
Expand Down
364 changes: 339 additions & 25 deletions maven_install.json

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ declare_deps_provider(
deps = [
"@maven//:org_scala_lang_scala_library",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:build_buf_protoc_gen_validate_pgv_java_stub",
"@maven//:com_thesamet_scalapb_protoc_gen_2_13",
"@maven//:com_thesamet_scalapb_protoc_bridge_2_13",
"@maven//:com_thesamet_scalapb_compilerplugin_2_13",
"@maven//:com_thesamet_scalapb_scalapb_validate_core_2_13",
"@maven//:com_thesamet_scalapb_scalapb_validate_codegen_2_13"
]
)

Expand All @@ -18,6 +21,7 @@ declare_deps_provider(
deps_id = "scalapb_compile_deps",
deps = [
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:build_buf_protoc_gen_validate_pgv_java_stub",
"@maven//:com_thesamet_scalapb_lenses_2_13",
"@maven//:com_thesamet_scalapb_scalapb_runtime_2_13",
"@maven//:com_thesamet_scalapb_scalapb_runtime_grpc_2_13",
Expand All @@ -33,6 +37,8 @@ declare_deps_provider(
"@maven//:org_typelevel_cats_kernel_2_13",
"@maven//:co_fs2_fs2_core_2_13",
"//:runtime",
"@maven//:com_thesamet_scalapb_scalapb_validate_core_2_13",
"@maven//:com_thesamet_scalapb_scalapb_validate_codegen_2_13",
# "@maven//:org_typelevel_fs2_grpc_runtime_2_13",

"@maven//:io_grpc_grpc_api",
Expand All @@ -51,6 +57,8 @@ declare_deps_provider(
deps_id = "scalapb_grpc_deps",
deps = [
"@maven//:com_thesamet_scalapb_protoc_gen_2_13",
"@maven//:com_thesamet_scalapb_scalapb_validate_core_2_13",
"@maven//:com_thesamet_scalapb_scalapb_validate_codegen_2_13",
],
)

Expand All @@ -74,11 +82,15 @@ scala_proto_toolchain(
extra_generator_dependencies = [
"@fs2_grpc//:codegen",
"@maven//:com_thesamet_scalapb_protoc_gen_2_13",
"@maven//:com_thesamet_scalapb_protoc_bridge_2_13"
"@maven//:com_thesamet_scalapb_protoc_bridge_2_13",
"@maven//:com_thesamet_scalapb_scalapb_validate_core_2_13",
"@maven//:com_thesamet_scalapb_scalapb_validate_codegen_2_13",
],
main_generator = "scalapb.ScalaPbCodeGenerator",
# main_generator = "scalapb.validate.compiler.CodeGenerator",
named_generators = {
"fs2": "fs2.grpc.codegen.Fs2CodeGenerator",
"scala": "scalapb.validate.compiler.CodeGenerator"
},
with_grpc = True,
with_flat_package = True
Expand Down
8 changes: 8 additions & 0 deletions validate/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
name = "validate",
srcs = ["validate.proto"],
deps = ["@common_protos//:common_protos"],
visibility = ["//visibility:public"],
)
Loading

0 comments on commit d113959

Please sign in to comment.