veyron/tools/playground: Fix GOPATH so the vdl compiler can use imports.
The GOPATH did not include $VEYRON_ROOT/veyron/go. As a result, the vdl
compiler could not compile vdl files with imports.
This CL adds $VEYRON_ROOT/veyron/go to the GOPATH in the docker instance
and in the test.sh. It also adds a veyron import to the testdata vdl to
make sure this works.
Change-Id: I8f358a0b32d09c62966b6f30d10c63cf51359380
diff --git a/tools/playground/builder/Dockerfile b/tools/playground/builder/Dockerfile
index 218a248..1ed9de4 100644
--- a/tools/playground/builder/Dockerfile
+++ b/tools/playground/builder/Dockerfile
@@ -4,7 +4,7 @@
RUN apt-get install -y curl g++ git golang libc6-i386 make python
ENV HOME /root
ENV VEYRON_ROOT /usr/local/veyron
-ENV GOPATH /home/playground
+ENV GOPATH /home/playground:$VEYRON_ROOT/veyron/go
# Setup veyron and veyron profiles.
# Note: This will be cached! If you want to re-build the docker image using
diff --git a/tools/playground/test.sh b/tools/playground/test.sh
index 420e8d1..61571bd 100755
--- a/tools/playground/test.sh
+++ b/tools/playground/test.sh
@@ -36,7 +36,7 @@
local -r DIR="${REPO_ROOT}/go/src/veyron/tools/playground/testdata"
- export GOPATH="$(pwd)"
+ export GOPATH="$(pwd)":$VEYRON_ROOT/veyron/go
export PATH="$(pwd):$PATH"
# Test without identities
diff --git a/tools/playground/testdata/pingpong/wire.vdl b/tools/playground/testdata/pingpong/wire.vdl
index b4e8e0a..011afde 100644
--- a/tools/playground/testdata/pingpong/wire.vdl
+++ b/tools/playground/testdata/pingpong/wire.vdl
@@ -1,5 +1,7 @@
package pingpong
+import "veyron2/security"
+
type PingPong interface {
- Ping(message string) (string, error)
-}
\ No newline at end of file
+ Ping(message string) (string, error) {security.ReadLabel}
+}
diff --git a/tools/playground/testdata/pingpong/wire.vdl.go b/tools/playground/testdata/pingpong/wire.vdl.go
deleted file mode 100644
index 4dd7572..0000000
--- a/tools/playground/testdata/pingpong/wire.vdl.go
+++ /dev/null
@@ -1,185 +0,0 @@
-// This file was auto-generated by the veyron vdl tool.
-// Source: wire.vdl
-
-package pingpong
-
-import (
- // The non-user imports are prefixed with "_gen_" to prevent collisions.
- _gen_veyron2 "veyron2"
- _gen_context "veyron2/context"
- _gen_ipc "veyron2/ipc"
- _gen_naming "veyron2/naming"
- _gen_vdlutil "veyron2/vdl/vdlutil"
- _gen_wiretype "veyron2/wiretype"
-)
-
-// TODO(bprosnitz) Remove this line once signatures are updated to use typevals.
-// It corrects a bug where _gen_wiretype is unused in VDL pacakges where only bootstrap types are used on interfaces.
-const _ = _gen_wiretype.TypeIDInvalid
-
-// PingPong is the interface the client binds and uses.
-// PingPong_ExcludingUniversal is the interface without internal framework-added methods
-// to enable embedding without method collisions. Not to be used directly by clients.
-type PingPong_ExcludingUniversal interface {
- Ping(ctx _gen_context.T, message string, opts ..._gen_ipc.CallOpt) (reply string, err error)
-}
-type PingPong interface {
- _gen_ipc.UniversalServiceMethods
- PingPong_ExcludingUniversal
-}
-
-// PingPongService is the interface the server implements.
-type PingPongService interface {
- Ping(context _gen_ipc.ServerContext, message string) (reply string, err error)
-}
-
-// BindPingPong returns the client stub implementing the PingPong
-// interface.
-//
-// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
-// global Runtime is used.
-func BindPingPong(name string, opts ..._gen_ipc.BindOpt) (PingPong, error) {
- var client _gen_ipc.Client
- switch len(opts) {
- case 0:
- // Do nothing.
- case 1:
- if clientOpt, ok := opts[0].(_gen_ipc.Client); opts[0] == nil || ok {
- client = clientOpt
- } else {
- return nil, _gen_vdlutil.ErrUnrecognizedOption
- }
- default:
- return nil, _gen_vdlutil.ErrTooManyOptionsToBind
- }
- stub := &clientStubPingPong{defaultClient: client, name: name}
-
- return stub, nil
-}
-
-// NewServerPingPong creates a new server stub.
-//
-// It takes a regular server implementing the PingPongService
-// interface, and returns a new server stub.
-func NewServerPingPong(server PingPongService) interface{} {
- return &ServerStubPingPong{
- service: server,
- }
-}
-
-// clientStubPingPong implements PingPong.
-type clientStubPingPong struct {
- defaultClient _gen_ipc.Client
- name string
-}
-
-func (__gen_c *clientStubPingPong) client(ctx _gen_context.T) _gen_ipc.Client {
- if __gen_c.defaultClient != nil {
- return __gen_c.defaultClient
- }
- return _gen_veyron2.RuntimeFromContext(ctx).Client()
-}
-
-func (__gen_c *clientStubPingPong) Ping(ctx _gen_context.T, message string, opts ..._gen_ipc.CallOpt) (reply string, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Ping", []interface{}{message}, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubPingPong) UnresolveStep(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply []string, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "UnresolveStep", nil, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubPingPong) Signature(ctx _gen_context.T, opts ..._gen_ipc.CallOpt) (reply _gen_ipc.ServiceSignature, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "Signature", nil, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-func (__gen_c *clientStubPingPong) GetMethodTags(ctx _gen_context.T, method string, opts ..._gen_ipc.CallOpt) (reply []interface{}, err error) {
- var call _gen_ipc.Call
- if call, err = __gen_c.client(ctx).StartCall(ctx, __gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
- return
- }
- if ierr := call.Finish(&reply, &err); ierr != nil {
- err = ierr
- }
- return
-}
-
-// ServerStubPingPong wraps a server that implements
-// PingPongService and provides an object that satisfies
-// the requirements of veyron2/ipc.ReflectInvoker.
-type ServerStubPingPong struct {
- service PingPongService
-}
-
-func (__gen_s *ServerStubPingPong) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) {
- // TODO(bprosnitz) GetMethodTags() will be replaces with Signature().
- // Note: This exhibits some weird behavior like returning a nil error if the method isn't found.
- // This will change when it is replaced with Signature().
- switch method {
- case "Ping":
- return []interface{}{}, nil
- default:
- return nil, nil
- }
-}
-
-func (__gen_s *ServerStubPingPong) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
- result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
- result.Methods["Ping"] = _gen_ipc.MethodSignature{
- InArgs: []_gen_ipc.MethodArgument{
- {Name: "message", Type: 3},
- },
- OutArgs: []_gen_ipc.MethodArgument{
- {Name: "", Type: 3},
- {Name: "", Type: 65},
- },
- }
-
- result.TypeDefs = []_gen_vdlutil.Any{
- _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
-
- return result, nil
-}
-
-func (__gen_s *ServerStubPingPong) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
- if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok {
- return unresolver.UnresolveStep(call)
- }
- if call.Server() == nil {
- return
- }
- var published []string
- if published, err = call.Server().Published(); err != nil || published == nil {
- return
- }
- reply = make([]string, len(published))
- for i, p := range published {
- reply[i] = _gen_naming.Join(p, call.Name())
- }
- return
-}
-
-func (__gen_s *ServerStubPingPong) Ping(call _gen_ipc.ServerCall, message string) (reply string, err error) {
- reply, err = __gen_s.service.Ping(call, message)
- return
-}