Update git submodule location
Having the modules stored in `./vendor` causes issues with `go mod`.
Follow waypoint's convention to store in `./thirdparty` and grab
the same Makefile modifications to alert when the submodules need
to be initialized. Update generators to use new path.
This commit is contained in:
parent
00a58cbf41
commit
16931138e7
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "thirdparty/proto/api-common-protos"]
|
||||
[submodule "api-common-protos"]
|
||||
path = thirdparty/proto/api-common-protos
|
||||
url = https://github.com/googleapis/api-common-protos
|
||||
|
||||
5
Makefile
5
Makefile
@ -11,6 +11,7 @@ CGO_ENABLED?=0
|
||||
|
||||
.PHONY: bin
|
||||
bin: # bin creates the binaries for Vagrant for the current platform
|
||||
@test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
|
||||
CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -tags assetsembedded -o ./vagrant ./cmd/vagrant
|
||||
|
||||
.PHONY: bin/windows
|
||||
@ -21,10 +22,12 @@ bin/windows: # create windows binaries
|
||||
|
||||
.PHONY: bin/linux
|
||||
bin/linux: # create Linux binaries
|
||||
@test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
|
||||
GOOS=linux GOARCH=amd64 $(MAKE) bin
|
||||
|
||||
.PHONY: bin/darwin
|
||||
bin/darwin: # create Darwin binaries
|
||||
@test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }
|
||||
GOOS=darwin GOARCH=amd64 $(MAKE) bin
|
||||
|
||||
.PHONY: test
|
||||
@ -53,6 +56,6 @@ static-assets:
|
||||
gen/doc:
|
||||
@rm -rf ./doc/* 2> /dev/null
|
||||
protoc -I=. \
|
||||
-I=./vendor/proto/api-common-protos/ \
|
||||
-I=./thirdparty/proto/api-common-protos/ \
|
||||
--doc_out=./doc --doc_opt=html,index.html \
|
||||
./internal/server/proto/server.proto
|
||||
|
||||
9
gen.go
9
gen.go
@ -5,13 +5,16 @@ package main
|
||||
// and installed in the correct locations
|
||||
|
||||
// Builds the Vagrant server Go GRPC
|
||||
//go:generate sh -c "protoc -I`go list -m -f \"{{.Dir}}\" github.com/mitchellh/protostructure` -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/vagrant-plugin-sdk`/proto/vagrant_plugin_sdk -I./vendor/proto/api-common-protos -I./internal/server --go-grpc_out=require_unimplemented_servers=false:./internal/server/proto/vagrant_server --go-grpc_opt=module=github.com/hashicorp/vagrant/internal/server/proto/vagrant_server --go_out=./internal/server/proto/vagrant_server --go_opt=module=github.com/hashicorp/vagrant/internal/server/proto/vagrant_server internal/server/proto/vagrant_server/*.proto"
|
||||
//go:generate sh -c "protoc -I`go list -m -f \"{{.Dir}}\" github.com/mitchellh/protostructure` -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/vagrant-plugin-sdk`/proto/vagrant_plugin_sdk -I./thirdparty/proto/api-common-protos -I./internal/server --go-grpc_out=require_unimplemented_servers=false:./internal/server/proto/vagrant_server --go-grpc_opt=module=github.com/hashicorp/vagrant/internal/server/proto/vagrant_server --go_out=./internal/server/proto/vagrant_server --go_opt=module=github.com/hashicorp/vagrant/internal/server/proto/vagrant_server internal/server/proto/vagrant_server/*.proto"
|
||||
|
||||
// Builds the Ruby Vagrant Go GRPC for legacy Vagrant interactions
|
||||
//go:generate sh -c "protoc -I./vendor/proto/api-common-protos -I./internal/server -I`go list -m -f \"{{.Dir}}\" github.com/mitchellh/protostructure` -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/vagrant-plugin-sdk`/proto/vagrant_plugin_sdk --go-grpc_out=./internal/server/proto/ruby_vagrant --go-grpc_opt=module=github.com/hashicorp/vagrant/internal/server/proto/ruby_vagrant --go_out=./internal/server/proto/ruby_vagrant --go_opt=module=github.com/hashicorp/vagrant/internal/server/proto/ruby_vagrant internal/server/proto/ruby_vagrant/*.proto"
|
||||
//go:generate sh -c "protoc -I./thirdparty/proto/api-common-protos -I./internal/server -I`go list -m -f \"{{.Dir}}\" github.com/mitchellh/protostructure` -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/vagrant-plugin-sdk`/proto/vagrant_plugin_sdk --go-grpc_out=./internal/server/proto/ruby_vagrant --go-grpc_opt=module=github.com/hashicorp/vagrant/internal/server/proto/ruby_vagrant --go_out=./internal/server/proto/ruby_vagrant --go_opt=module=github.com/hashicorp/vagrant/internal/server/proto/ruby_vagrant internal/server/proto/ruby_vagrant/*.proto"
|
||||
|
||||
// Builds the Ruby GRPC for the Vagrant server and Ruby Vagrant interactions
|
||||
//go:generate sh -c "grpc_tools_ruby_protoc -I`go list -m -f \"{{.Dir}}\" github.com/mitchellh/protostructure` -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/vagrant-plugin-sdk`/proto/vagrant_plugin_sdk -I./vendor/proto/api-common-protos -I./internal/server --grpc_out=./lib/vagrant/protobufs/ --ruby_out=./lib/vagrant/protobufs/ internal/server/proto/vagrant_server/*.proto internal/server/proto/ruby_vagrant/*.proto"
|
||||
//go:generate sh -c "grpc_tools_ruby_protoc -I`go list -m -f \"{{.Dir}}\" github.com/mitchellh/protostructure` -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/vagrant-plugin-sdk`/proto/vagrant_plugin_sdk -I./thirdparty/proto/api-common-protos -I./internal/server --grpc_out=./lib/vagrant/protobufs/ --ruby_out=./lib/vagrant/protobufs/ internal/server/proto/vagrant_server/*.proto internal/server/proto/ruby_vagrant/*.proto"
|
||||
|
||||
// Builds the Ruby GRPC for the Vagrant Plugin SDK
|
||||
//go:generate sh -c "grpc_tools_ruby_protoc -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/vagrant-plugin-sdk`/proto -I`go list -m -f \"{{.Dir}}\" github.com/mitchellh/protostructure` -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/vagrant-plugin-sdk`/3rdparty/proto/api-common-protos -I`go list -m -f \"{{.Dir}}\" github.com/hashicorp/go-plugin`/internal --grpc_out=./lib/vagrant/protobufs/proto/ --ruby_out=./lib/vagrant/protobufs/proto/ plugin/grpc_broker.proto vagrant_plugin_sdk/plugin.proto protostructure.proto"
|
||||
|
||||
// Generate strings for flag types
|
||||
//go:generate stringer -type=Type -linecomment ./internal/flags
|
||||
|
||||
@ -416,17 +416,20 @@ func (c *baseCommand) flagSet(bit flagSetBit, f func([]*component.CommandFlag) [
|
||||
set = append(set,
|
||||
&component.CommandFlag{
|
||||
LongName: "server-addr",
|
||||
ShortName: "",
|
||||
Description: "Address for the server",
|
||||
Type: component.FlagString,
|
||||
},
|
||||
&component.CommandFlag{
|
||||
LongName: "server-tls",
|
||||
ShortName: "",
|
||||
Description: "Connect to server via TLS",
|
||||
DefaultValue: "true",
|
||||
Type: component.FlagBool,
|
||||
},
|
||||
&component.CommandFlag{
|
||||
LongName: "server-tls-skip-verify",
|
||||
ShortName: "",
|
||||
Description: "Skip verification of the TLS certificate advertised by the server",
|
||||
DefaultValue: "false",
|
||||
Type: component.FlagBool,
|
||||
@ -453,6 +456,7 @@ func (c *baseCommand) Parse(
|
||||
} else {
|
||||
opt.SetUnknownMode(getoptions.Fail)
|
||||
}
|
||||
opt.SetMode(getoptions.Bundling)
|
||||
|
||||
c.Log.Warn("parsing arguments with flags", "args", args, "flags", flags)
|
||||
remainArgs, err := opt.Parse(args)
|
||||
@ -489,9 +493,9 @@ func (c *baseCommand) generateCliFlags(set []*component.CommandFlag) *getoptions
|
||||
if f.Description != "" {
|
||||
opts = append(opts, opt.Description(f.Description))
|
||||
}
|
||||
if f.ShortName != "" {
|
||||
opts = append(opts, opt.Alias(f.ShortName))
|
||||
}
|
||||
// if f.ShortName != "" {
|
||||
// opts = append(opts, opt.Alias(f.ShortName))
|
||||
// }
|
||||
|
||||
switch f.Type {
|
||||
case component.FlagBool:
|
||||
|
||||
1
thirdparty/proto/api-common-protos
vendored
Submodule
1
thirdparty/proto/api-common-protos
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e16c55b094638b43a97edd0847614ab91e2461f7
|
||||
Loading…
x
Reference in New Issue
Block a user