From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Cc: Puck Meerburg <puck@puckipedia.com>
Subject: [PATCH platform2 1/2] common-mk: add goproto_library source_relative opt
Date: Mon, 28 Jun 2021 17:31:05 +0000 [thread overview]
Message-ID: <20210628173106.1128138-2-hi@alyssa.is> (raw)
In-Reply-To: <20210628173106.1128138-1-hi@alyssa.is>
We need this for the go_package changes in protoc-gen-go 1.5.x. If we
didn't use source-relative paths, the full module path would be
repeated in the output location, so we'd get paths like
src/chromiumos/vm_tools/vm_crash/chromiumos/vm_tools/vm_crash/vm_crash.pb.go.
To avoid the duplication, we either need to set source_relative, or
set proto_out_dir to just go/src. The latter isn't workable, because
then everything two libraries that both use common.proto will both
generate outputs called "go/src/common.pb.go", which will upset GN.
---
common-mk/proto_library.gni | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/common-mk/proto_library.gni b/common-mk/proto_library.gni
index fb9fb4231d..23645a134f 100644
--- a/common-mk/proto_library.gni
+++ b/common-mk/proto_library.gni
@@ -225,6 +225,9 @@ template("proto_library") {
# proto_lib_dirs (optional)
# Directories to search for protos a proto file depends on.
# proto_in_dir and "${sysroot}/usr/share/proto" are added by default.
+# source_relative (optional)
+# If true, the output file is placed in the same relative directory as the
+# input file (but under proto_out_dir).
template("goproto_library") {
action(target_name) {
forward_variables_from(invoker,
@@ -254,6 +257,10 @@ template("goproto_library") {
go_plugin_parameters = []
+ if (defined(invoker.source_relative) && invoker.source_relative) {
+ go_plugin_parameters += [ "paths=source_relative" ]
+ }
+
if (defined(invoker.gen_grpc) && invoker.gen_grpc) {
go_plugin_parameters += [ "plugins=grpc" ]
}
--
2.31.1
next prev parent reply other threads:[~2021-06-28 17:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 17:31 [PATCH platform2 0/2] Make vm_protos compatible with protoc-gen-go 1.5.x Alyssa Ross
2021-06-28 17:31 ` Alyssa Ross [this message]
2021-06-28 17:31 ` [PATCH platform2 2/2] vm_tools: proto: set go_package correctly Alyssa Ross
2021-06-28 20:35 ` [PATCH platform2 0/2] Make vm_protos compatible with protoc-gen-go 1.5.x Cole Helbling
2021-06-30 9:12 ` Alyssa Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210628173106.1128138-2-hi@alyssa.is \
--to=hi@alyssa.is \
--cc=devel@spectrum-os.org \
--cc=puck@puckipedia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).