Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@

# sdk-core is a library we allow consumers pin specific versions.
Cargo.lock

/.idea/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "protos/api_upstream"]
path = protos/api_upstream
url = git@github.com:temporalio/api.git
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tonic = "0.3"
prost = "0.6"

[build-dependencies]
tonic-build = "0.3"
12 changes: 12 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
// We don't actually want to build the grpc definitions - we don't need them (for now).
// Just build the message structs.
.build_server(false)
.build_client(false)
.compile(
&["protos/core_interface.proto"],
&["protos/api_upstream", "protos"],
)?;
Ok(())
}
9 changes: 9 additions & 0 deletions protos/api_upstream/.buildkite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.15.6

RUN apt update && apt install -y --no-install-recommends \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/* \
# https://github.com/docker-library/golang/blob/c1baf037d71331eb0b8d4c70cff4c29cf124c5e0/1.4/Dockerfile
&& mkdir -p /temporal

WORKDIR /temporal
15 changes: 15 additions & 0 deletions protos/api_upstream/.buildkite/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3.5"

services:
build:
build:
context: ..
dockerfile: ./.buildkite/Dockerfile
environment:
- BUILDKITE_AGENT_ACCESS_TOKEN
- BUILDKITE_JOB_ID
- BUILDKITE_BUILD_ID
- BUILDKITE_BUILD_NUMBER
volumes:
- ../:/temporal
- /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
10 changes: 10 additions & 0 deletions protos/api_upstream/.buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
steps:
- label: "build"
agents:
queue: "default"
docker: "*"
command: "make"
plugins:
- docker-compose#v3.1.0:
run: build
config: ./.buildkite/docker-compose.yml
2 changes: 2 additions & 0 deletions protos/api_upstream/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.idea
/.gen
21 changes: 21 additions & 0 deletions protos/api_upstream/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.

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.
78 changes: 78 additions & 0 deletions protos/api_upstream/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
$(VERBOSE).SILENT:
############################# Main targets #############################
# Install everything, run all linters, and compile proto files.
install: grpc-install api-linter-install buf-install proto

# Run all linters and compile proto files.
proto: grpc
########################################################################

##### Variables ######
ifndef GOPATH
GOPATH := $(shell go env GOPATH)
endif

GOBIN := $(if $(shell go env GOBIN),$(shell go env GOBIN),$(GOPATH)/bin)
SHELL := PATH=$(GOBIN):$(PATH) /bin/sh

COLOR := "\e[1;36m%s\e[0m\n"

PROTO_ROOT := .
PROTO_FILES = $(shell find $(PROTO_ROOT) -name "*.proto")
PROTO_DIRS = $(sort $(dir $(PROTO_FILES)))
PROTO_OUT := .gen
PROTO_IMPORTS := -I=$(PROTO_ROOT) -I=$(GOPATH)/src/github.com/temporalio/gogo-protobuf/protobuf

$(PROTO_OUT):
mkdir $(PROTO_OUT)

##### Compile proto files for go #####
grpc: buf-lint api-linter buf-breaking gogo-grpc fix-path

go-grpc: clean $(PROTO_OUT)
printf $(COLOR) "Compile for go-gRPC..."
$(foreach PROTO_DIR,$(PROTO_DIRS),protoc $(PROTO_IMPORTS) --go_out=plugins=grpc,paths=source_relative:$(PROTO_OUT) $(PROTO_DIR)*.proto;)

gogo-grpc: clean $(PROTO_OUT)
printf $(COLOR) "Compile for gogo-gRPC..."
$(foreach PROTO_DIR,$(PROTO_DIRS),protoc $(PROTO_IMPORTS) --gogoslick_out=Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,plugins=grpc,paths=source_relative:$(PROTO_OUT) $(PROTO_DIR)*.proto;)

fix-path:
mv -f $(PROTO_OUT)/temporal/api/* $(PROTO_OUT) && rm -rf $(PROTO_OUT)/temporal

##### Plugins & tools #####
grpc-install: gogo-protobuf-install
printf $(COLOR) "Install/update gRPC plugins..."
GO111MODULE=on go get google.golang.org/grpc@v1.34.0

gogo-protobuf-install: go-protobuf-install
go get github.com/temporalio/gogo-protobuf/protoc-gen-gogoslick

go-protobuf-install:
GO111MODULE=on go get github.com/golang/protobuf/protoc-gen-go@v1.4.3

api-linter-install:
printf $(COLOR) "Install/update api-linter..."
GO111MODULE=on go get github.com/googleapis/api-linter/cmd/api-linter@v1.10.0

buf-install:
printf $(COLOR) "Install/update buf..."
GO111MODULE=on go get github.com/bufbuild/buf/cmd/buf@v0.33.0

##### Linters #####
api-linter:
printf $(COLOR) "Run api-linter..."
api-linter --set-exit-status $(PROTO_IMPORTS) --config $(PROTO_ROOT)/api-linter.yaml $(PROTO_FILES)

buf-lint:
printf $(COLOR) "Run buf linter..."
(cd $(PROTO_ROOT) && buf check lint)

buf-breaking:
@printf $(COLOR) "Run buf breaking changes check against master branch..."
@(cd $(PROTO_ROOT) && buf check breaking --against '.git#branch=master')

##### Clean #####
clean:
printf $(COLOR) "Delete generated go files..."
rm -rf $(PROTO_OUT)
7 changes: 7 additions & 0 deletions protos/api_upstream/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Temporal proto files

Install as git submodule to the project.

## License

MIT License, please see [LICENSE](LICENSE) for details.
38 changes: 38 additions & 0 deletions protos/api_upstream/api-linter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
- included_paths:
- '**/*.proto'
disabled_rules:
- 'core::0192::has-comments'

- included_paths:
- '**/message.proto'
disabled_rules:
- 'core::0122::name-suffix'
- 'core::0123::resource-annotation'

- included_paths:
- '**/workflowservice/v1/request_response.proto'
disabled_rules:
- 'core::0122::name-suffix'
- 'core::0131::request-name-required'
- 'core::0131::request-unknown-fields'
- 'core::0132::request-parent-required'
- 'core::0132::request-unknown-fields'
- 'core::0132::response-unknown-fields'
- 'core::0134::request-unknown-fields'
- 'core::0158::request-page-size-field'
- 'core::0158::request-page-token-field'
- 'core::0158::response-next-page-token-field'
- 'core::0158::response-plural-first-field'
- 'core::0158::response-repeated-first-field'

- included_paths:
- '**/workflowservice/v1/service.proto'
disabled_rules:
- 'core::0127::http-annotation'
- 'core::0131::method-signature'
- 'core::0131::response-message-name'

- included_paths:
- 'dependencies/gogoproto/gogo.proto'
disabled_rules:
- 'all'
12 changes: 12 additions & 0 deletions protos/api_upstream/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: v1beta1
build:
roots:
- .
lint:
ignore:
- dependencies
use:
- DEFAULT
breaking:
use:
- PACKAGE
141 changes: 141 additions & 0 deletions protos/api_upstream/dependencies/gogoproto/gogo.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
// Protocol Buffers for Go with Gadgets
//
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
// http://github.com/temporalio/gogo-protobuf
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

syntax = "proto2";
package gogoproto;

import "google/protobuf/descriptor.proto";

option go_package = "github.com/gogo/protobuf/gogoproto";

extend google.protobuf.EnumOptions {
optional bool goproto_enum_prefix = 62001;
optional bool goproto_enum_stringer = 62021;
optional bool enum_stringer = 62022;
optional string enum_customname = 62023;
optional bool enumdecl = 62024;
}

extend google.protobuf.EnumValueOptions {
optional string enumvalue_customname = 66001;
}

extend google.protobuf.FileOptions {
optional bool goproto_getters_all = 63001;
optional bool goproto_enum_prefix_all = 63002;
optional bool goproto_stringer_all = 63003;
optional bool verbose_equal_all = 63004;
optional bool face_all = 63005;
optional bool gostring_all = 63006;
optional bool populate_all = 63007;
optional bool stringer_all = 63008;
optional bool onlyone_all = 63009;

optional bool equal_all = 63013;
optional bool description_all = 63014;
optional bool testgen_all = 63015;
optional bool benchgen_all = 63016;
optional bool marshaler_all = 63017;
optional bool unmarshaler_all = 63018;
optional bool stable_marshaler_all = 63019;

optional bool sizer_all = 63020;

optional bool goproto_enum_stringer_all = 63021;
optional bool enum_stringer_all = 63022;

optional bool unsafe_marshaler_all = 63023;
optional bool unsafe_unmarshaler_all = 63024;

optional bool goproto_extensions_map_all = 63025;
optional bool goproto_unrecognized_all = 63026;
optional bool gogoproto_import = 63027;
optional bool protosizer_all = 63028;
optional bool compare_all = 63029;
optional bool typedecl_all = 63030;
optional bool enumdecl_all = 63031;

optional bool goproto_registration = 63032;
optional bool messagename_all = 63033;

optional bool goproto_sizecache_all = 63034;
optional bool goproto_unkeyed_all = 63035;
}

extend google.protobuf.MessageOptions {
optional bool goproto_getters = 64001;
optional bool goproto_stringer = 64003;
optional bool verbose_equal = 64004;
optional bool face = 64005;
optional bool gostring = 64006;
optional bool populate = 64007;
optional bool stringer = 67008;
optional bool onlyone = 64009;

optional bool equal = 64013;
optional bool description = 64014;
optional bool testgen = 64015;
optional bool benchgen = 64016;
optional bool marshaler = 64017;
optional bool unmarshaler = 64018;
optional bool stable_marshaler = 64019;

optional bool sizer = 64020;

optional bool unsafe_marshaler = 64023;
optional bool unsafe_unmarshaler = 64024;

optional bool goproto_extensions_map = 64025;
optional bool goproto_unrecognized = 64026;

optional bool protosizer = 64028;
optional bool compare = 64029;

optional bool typedecl = 64030;

optional bool messagename = 64033;

optional bool goproto_sizecache = 64034;
optional bool goproto_unkeyed = 64035;
}

extend google.protobuf.FieldOptions {
optional bool nullable = 65001;
optional bool embed = 65002;
optional string customtype = 65003;
optional string customname = 65004;
optional string jsontag = 65005;
optional string moretags = 65006;
optional string casttype = 65007;
optional string castkey = 65008;
optional string castvalue = 65009;

optional bool stdtime = 65010;
optional bool stdduration = 65011;
optional bool wktpointer = 65012;
}
Loading