patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Cc: Puck Meerburg <puck@puckipedia.com>
Subject: [PATCH platform2 2/2] vm_tools: proto: set go_package correctly
Date: Mon, 28 Jun 2021 17:31:06 +0000	[thread overview]
Message-ID: <20210628173106.1128138-3-hi@alyssa.is> (raw)
In-Reply-To: <20210628173106.1128138-1-hi@alyssa.is>

protoc-gen-go 1.5.x has become a lot stricter about this.  We have to
use import_mapping for common.proto because it ends up being included
in multiple Go libraries.  I'm not sure why it needs to be built once
per library, but that's the way it works.
---
 vm_tools/proto/BUILD.gn       | 5 +++++
 vm_tools/proto/tremplin.proto | 2 +-
 vm_tools/proto/vm_crash.proto | 2 +-
 vm_tools/proto/vm_guest.proto | 1 +
 vm_tools/proto/vm_host.proto  | 1 +
 5 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/vm_tools/proto/BUILD.gn b/vm_tools/proto/BUILD.gn
index 79c9b94c9f..aadc40165c 100644
--- a/vm_tools/proto/BUILD.gn
+++ b/vm_tools/proto/BUILD.gn
@@ -60,6 +60,8 @@ goproto_library("vm-crash-gorpcs") {
   proto_in_dir = "./"
   proto_out_dir = "go/src/chromiumos/vm_tools/vm_crash"
   gen_grpc = true
+  source_relative = true
+  import_mapping = [ "common.proto=chromiumos/vm_tools/vm_crash" ]
   sources = [
     "${proto_in_dir}/common.proto",
     "${proto_in_dir}/vm_crash.proto",
@@ -97,6 +99,7 @@ goproto_library("tremplin-gorpcs") {
   proto_in_dir = "./"
   proto_out_dir = "go/src/chromiumos/vm_tools/tremplin_proto"
   gen_grpc = true
+  source_relative = true
   sources = [ "${proto_in_dir}/tremplin.proto" ]
 }
 
@@ -120,6 +123,8 @@ goproto_library("vm-gorpcs") {
   proto_in_dir = "./"
   proto_out_dir = "go/src/chromiumos/vm_tools/vm_rpc"
   gen_grpc = true
+  source_relative = true
+  import_mapping = [ "common.proto=chromiumos/vm_tools/vm_rpc" ]
   sources = [
     "${proto_in_dir}/common.proto",
     "${proto_in_dir}/vm_guest.proto",
diff --git a/vm_tools/proto/tremplin.proto b/vm_tools/proto/tremplin.proto
index aac76f7a9e..e6a7bbed0e 100644
--- a/vm_tools/proto/tremplin.proto
+++ b/vm_tools/proto/tremplin.proto
@@ -8,7 +8,7 @@ option cc_enable_arenas = true;
 
 // This file defines services for tremplin, the container springboard service.
 package vm_tools.tremplin;
-option go_package = "tremplin_proto";
+option go_package = "chromiumos/vm_tools/tremplin_proto";
 
 // This needs to be duplicated because the gyp rule for building
 // go code makes it difficult to have imports.
diff --git a/vm_tools/proto/vm_crash.proto b/vm_tools/proto/vm_crash.proto
index 6e4f62fe13..3cd4279989 100644
--- a/vm_tools/proto/vm_crash.proto
+++ b/vm_tools/proto/vm_crash.proto
@@ -7,7 +7,7 @@ syntax = "proto3";
 option cc_enable_arenas = true;
 
 package vm_tools.cicerone;
-option go_package = "vm_crash";
+option go_package = "chromiumos/vm_tools/vm_crash";
 
 import "common.proto";
 
diff --git a/vm_tools/proto/vm_guest.proto b/vm_tools/proto/vm_guest.proto
index 86f11d0812..d0946078d5 100644
--- a/vm_tools/proto/vm_guest.proto
+++ b/vm_tools/proto/vm_guest.proto
@@ -8,6 +8,7 @@ option cc_enable_arenas = true;
 
 // This file defines services that will be running in the guest VM.
 package vm_tools;
+option go_package = "chromiumos/vm_tools/vm_rpc";
 
 import "common.proto";
 import "google/protobuf/timestamp.proto";
diff --git a/vm_tools/proto/vm_host.proto b/vm_tools/proto/vm_host.proto
index a8bd066f61..19759b0271 100644
--- a/vm_tools/proto/vm_host.proto
+++ b/vm_tools/proto/vm_host.proto
@@ -8,6 +8,7 @@ option cc_enable_arenas = true;
 
 // This file defines services that will be running on the host for the VM.
 package vm_tools;
+option go_package = "chromiumos/vm_tools/vm_rpc";
 
 import "common.proto";
 
-- 
2.31.1


  parent reply	other threads:[~2021-06-28 17:31 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 ` [PATCH platform2 1/2] common-mk: add goproto_library source_relative opt Alyssa Ross
2021-06-28 17:31 ` Alyssa Ross [this message]
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-3-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).