Skip to content

Commit

Permalink
Move build proto dependencies to separate go.mod (#3377)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshtin committed Sep 14, 2022
1 parent 6e592f6 commit f4b94d2
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
# Executables produced by temporal repo
/temporal-*
/tctl*
/tdbg

# Buf proto image
/proto/image.bin

# Goreleaser
/dist

# Fossa
.fossa.yml

# direnv
.envrc
15 changes: 5 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,20 @@ INTEG_TEST_NDC_ROOT := ./host/ndc
PROTO_ROOT := proto
PROTO_FILES = $(shell find ./$(PROTO_ROOT)/internal -name "*.proto")
PROTO_DIRS = $(sort $(dir $(PROTO_FILES)))
PROTO_IMPORTS := -I=$(PROTO_ROOT)/internal -I=$(PROTO_ROOT)/api -I=$(GOPATH)/src/github.com/temporalio/gogo-protobuf/protobuf
PROTO_IMPORTS = -I=$(PROTO_ROOT)/internal -I=$(PROTO_ROOT)/api -I=$(shell go list -modfile build/go.mod -m -f '{{.Dir}}' github.com/temporalio/gogo-protobuf)/protobuf
PROTO_OUT := api


ALL_SRC := $(shell find . -name "*.go")
ALL_SRC += go.mod
# Replace below with build tags and `go test ./...` for targets
ALL_SCRIPTS := $(shell find . -name "*.sh")
# TODO (jeremy): Replace below with build tags and `go test ./...` for targets
TEST_DIRS := $(sort $(dir $(filter %_test.go,$(ALL_SRC))))
INTEG_TEST_DIRS := $(filter $(INTEG_TEST_ROOT)/ $(INTEG_TEST_NDC_ROOT)/,$(TEST_DIRS))
UNIT_TEST_DIRS := $(filter-out $(INTEG_TEST_ROOT)% $(INTEG_TEST_XDC_ROOT)% $(INTEG_TEST_NDC_ROOT)%,$(TEST_DIRS))

ALL_SCRIPTS := $(shell find . -name "*.sh")

PINNED_DEPENDENCIES := \
github.com/apache/thrift@v0.0.0-20161221203622-b2a4d4ae21c7 \
github.com/go-sql-driver/mysql@v1.5.0
github.com/go-sql-driver/mysql@v1.5.0

# Code coverage output files.
COVER_ROOT := ./.coverage
Expand Down Expand Up @@ -114,9 +112,7 @@ update-mockgen:

update-proto-plugins:
@printf $(COLOR) "Install/update proto plugins..."
@go install github.com/temporalio/gogo-protobuf/protoc-gen-gogoslick@latest
# This to download sources of gogo-protobuf which are required to build proto files.
@GO111MODULE=off go get github.com/temporalio/gogo-protobuf/protoc-gen-gogoslick
@go install -modfile build/go.mod github.com/temporalio/gogo-protobuf/protoc-gen-gogoslick
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

update-tctl:
Expand Down Expand Up @@ -288,7 +284,6 @@ integration-with-fault-injection-test: clean-test-results
@go test $(INTEG_TEST_XDC_ROOT) -timeout=$(TEST_TIMEOUT) $(TEST_TAG) -PersistenceFaultInjectionRate=0.005 | tee -a test.log
@! grep -q "^--- FAIL" test.log


test: unit-test integration-test integration-with-fault-injection-test

##### Coverage #####
Expand Down
7 changes: 7 additions & 0 deletions build/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module build

go 1.18

require (
github.com/temporalio/gogo-protobuf v1.22.1
)
5 changes: 5 additions & 0 deletions build/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/temporalio/gogo-protobuf v1.22.1 h1:K5ja5MqmCQKo4tlX7u3g+ZJqbvRr0589ss2cZQx2dSM=
github.com/temporalio/gogo-protobuf v1.22.1/go.mod h1:tCaEv+fB8tsyLgoaqKr78K/JOhdRe684yyo0z30SHyA=
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
29 changes: 29 additions & 0 deletions build/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// The MIT License
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package build

import (
_ "github.com/temporalio/gogo-protobuf/gogoproto" // gogoproto is just a random package name for module.
)

0 comments on commit f4b94d2

Please sign in to comment.