daml/scala-protoc-plugins/scala-akka/BUILD.bazel
Gary Verhaegen d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00

62 lines
2.0 KiB
Python

# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:scala.bzl", "da_scala_binary", "da_scala_library")
da_scala_binary(
name = "compiler_plugin",
srcs = glob(["*.scala"]),
main_class = "com.daml.protoc.plugins.akka.AkkaStreamCompilerPlugin",
scala_deps = [
"@maven//:com_thesamet_scalapb_compilerplugin",
"@maven//:com_thesamet_scalapb_protoc_bridge",
"@maven//:com_thesamet_scalapb_protoc_gen",
],
visibility = ["//visibility:public"],
deps = [
"@maven//:com_google_protobuf_protobuf_java",
],
)
# From https://github.com/stackb/rules_proto/blob/3f890f5d6774bd74df28e89b20f34155dfe77732/scala/BUILD.bazel#L78-L97
# Curiously this didn't work
#
# genrule(
# name = "gen_protoc_gen_scala",
# srcs = ["compiler_plugin_deploy.jar", "@local_jdk//:bin/java"],
# outs = ["protoc-gen-scala.sh"],
# cmd = """
# echo '$(location @local_jdk//:bin/java) -jar $(location protoc_gen_deploy.jar) $$@' > $@
# """,
# executable = True,
# )
# ======================================================================
#
# Unable to get either bazel or maybe protoc to call a plugin whose
# implementation was fronted by a shell script (from a genrule). So, the only
# way this seemed to work was compile an executable that calls 'java -jar
# protoc_gen_scala_deploy.jar'. Either figure out how to do this in java
# directly or write the wrapper in C++ ot remove the go dependency here.
#
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = [
"protoc-gen-scala-akka.go",
],
importpath = "github.com/digital-asset/daml/scala/protoc-gen-scala-akka",
visibility = ["//visibility:public"],
)
go_binary(
name = "protoc-gen-scala-akka",
data = [
":compiler_plugin_deploy.jar",
"@bazel_tools//tools/jdk",
],
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)