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:
Chris Roberts 2022-01-28 14:43:00 -08:00 committed by Paul Hinze
parent 00a58cbf41
commit 16931138e7
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
5 changed files with 19 additions and 8 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "thirdparty/proto/api-common-protos"] [submodule "api-common-protos"]
path = thirdparty/proto/api-common-protos path = thirdparty/proto/api-common-protos
url = https://github.com/googleapis/api-common-protos url = https://github.com/googleapis/api-common-protos

View File

@ -11,6 +11,7 @@ CGO_ENABLED?=0
.PHONY: bin .PHONY: bin
bin: # bin creates the binaries for Vagrant for the current platform 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 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -tags assetsembedded -o ./vagrant ./cmd/vagrant
.PHONY: bin/windows .PHONY: bin/windows
@ -21,10 +22,12 @@ bin/windows: # create windows binaries
.PHONY: bin/linux .PHONY: bin/linux
bin/linux: # create Linux binaries 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 GOOS=linux GOARCH=amd64 $(MAKE) bin
.PHONY: bin/darwin .PHONY: bin/darwin
bin/darwin: # create Darwin binaries 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 GOOS=darwin GOARCH=amd64 $(MAKE) bin
.PHONY: test .PHONY: test
@ -53,6 +56,6 @@ static-assets:
gen/doc: gen/doc:
@rm -rf ./doc/* 2> /dev/null @rm -rf ./doc/* 2> /dev/null
protoc -I=. \ protoc -I=. \
-I=./vendor/proto/api-common-protos/ \ -I=./thirdparty/proto/api-common-protos/ \
--doc_out=./doc --doc_opt=html,index.html \ --doc_out=./doc --doc_opt=html,index.html \
./internal/server/proto/server.proto ./internal/server/proto/server.proto

9
gen.go
View File

@ -5,13 +5,16 @@ package main
// and installed in the correct locations // and installed in the correct locations
// Builds the Vagrant server Go GRPC // 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 // 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 // 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 // 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" //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

View File

@ -416,17 +416,20 @@ func (c *baseCommand) flagSet(bit flagSetBit, f func([]*component.CommandFlag) [
set = append(set, set = append(set,
&component.CommandFlag{ &component.CommandFlag{
LongName: "server-addr", LongName: "server-addr",
ShortName: "",
Description: "Address for the server", Description: "Address for the server",
Type: component.FlagString, Type: component.FlagString,
}, },
&component.CommandFlag{ &component.CommandFlag{
LongName: "server-tls", LongName: "server-tls",
ShortName: "",
Description: "Connect to server via TLS", Description: "Connect to server via TLS",
DefaultValue: "true", DefaultValue: "true",
Type: component.FlagBool, Type: component.FlagBool,
}, },
&component.CommandFlag{ &component.CommandFlag{
LongName: "server-tls-skip-verify", LongName: "server-tls-skip-verify",
ShortName: "",
Description: "Skip verification of the TLS certificate advertised by the server", Description: "Skip verification of the TLS certificate advertised by the server",
DefaultValue: "false", DefaultValue: "false",
Type: component.FlagBool, Type: component.FlagBool,
@ -453,6 +456,7 @@ func (c *baseCommand) Parse(
} else { } else {
opt.SetUnknownMode(getoptions.Fail) opt.SetUnknownMode(getoptions.Fail)
} }
opt.SetMode(getoptions.Bundling)
c.Log.Warn("parsing arguments with flags", "args", args, "flags", flags) c.Log.Warn("parsing arguments with flags", "args", args, "flags", flags)
remainArgs, err := opt.Parse(args) remainArgs, err := opt.Parse(args)
@ -489,9 +493,9 @@ func (c *baseCommand) generateCliFlags(set []*component.CommandFlag) *getoptions
if f.Description != "" { if f.Description != "" {
opts = append(opts, opt.Description(f.Description)) opts = append(opts, opt.Description(f.Description))
} }
if f.ShortName != "" { // if f.ShortName != "" {
opts = append(opts, opt.Alias(f.ShortName)) // opts = append(opts, opt.Alias(f.ShortName))
} // }
switch f.Type { switch f.Type {
case component.FlagBool: case component.FlagBool:

1
thirdparty/proto/api-common-protos vendored Submodule

@ -0,0 +1 @@
Subproject commit e16c55b094638b43a97edd0847614ab91e2461f7