From aed03b5bf5ffcd6ef0fee0674659f5c7b8004f73 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Fri, 29 Jan 2021 17:39:34 +0100 Subject: [PATCH] generate all protobuf and embed.go files in CI --- .drone.star | 82 +- Makefile | 36 + accounts/Makefile | 105 ++- accounts/pkg/proto/v0/accounts.proto | 28 +- .../grpc.tmpl => accounts/templates/GRPC.tmpl | 0 docs/Makefile | 27 +- docs/extensions/accounts/.gitignore | 1 + docs/extensions/glauth/.gitignore | 3 +- docs/extensions/idp/.gitignore | 1 + docs/extensions/ocs/.gitignore | 1 + docs/extensions/onlyoffice/.gitignore | 2 + docs/extensions/proxy/.gitignore | 1 + docs/extensions/settings/.gitignore | 1 + docs/extensions/storage/.gitignore | 1 + docs/extensions/store/.gitignore | 1 + docs/extensions/thumbnails/.gitignore | 1 + docs/extensions/thumbnails/grpc.md | 71 -- docs/extensions/web/.gitignore | 1 + docs/extensions/webdav/.gitignore | 1 + glauth/Makefile | 55 +- idp/Makefile | 104 +-- ocis-pkg/Makefile | 22 +- ocis/Makefile | 28 +- ocs/Makefile | 55 +- onlyoffice/Makefile | 36 +- proxy/Makefile | 27 +- settings/Makefile | 113 ++- settings/pkg/proto/v0/settings.proto | 49 +- settings/templates/GRPC.tmpl | 75 ++ .../third_party/google/api/annotations.proto | 31 - settings/third_party/google/api/http.proto | 318 ------- .../third_party/google/api/httpbody.proto | 78 -- .../third_party/google/protobuf/any.proto | 154 --- .../google/protobuf/descriptor.proto | 883 ------------------ .../third_party/google/protobuf/struct.proto | 96 -- settings/third_party/google/rpc/code.proto | 186 ---- .../google/rpc/error_details.proto | 200 ---- settings/third_party/google/rpc/status.proto | 92 -- .../options/annotations.proto | 44 - .../options/openapiv2.proto | 379 -------- storage/Makefile | 26 +- store/Makefile | 106 ++- store/pkg/proto/v0/store.proto | 30 +- store/templates/GRPC.tmpl | 75 ++ .../google/api/annotations.proto | 0 .../google/api/field_behavior.proto | 0 .../google/api/http.proto | 0 .../google/protobuf/descriptor.proto | 0 .../google/protobuf/empty.proto | 0 .../google/protobuf/field_mask.proto | 0 .../google/protobuf/timestamp.proto | 0 thumbnails/Makefile | 107 ++- thumbnails/pkg/proto/v0/thumbnails.pb_test.go | 121 +++ thumbnails/pkg/proto/v0/thumbnails.proto | 29 +- thumbnails/templates/GRPC.tmpl | 75 ++ web/Makefile | 55 +- webdav/Makefile | 55 +- 57 files changed, 1092 insertions(+), 2976 deletions(-) rename thumbnails/templates/grpc.tmpl => accounts/templates/GRPC.tmpl (100%) create mode 100644 docs/extensions/onlyoffice/.gitignore delete mode 100644 docs/extensions/thumbnails/grpc.md create mode 100644 settings/templates/GRPC.tmpl delete mode 100644 settings/third_party/google/api/annotations.proto delete mode 100644 settings/third_party/google/api/http.proto delete mode 100644 settings/third_party/google/api/httpbody.proto delete mode 100644 settings/third_party/google/protobuf/any.proto delete mode 100644 settings/third_party/google/protobuf/descriptor.proto delete mode 100644 settings/third_party/google/protobuf/struct.proto delete mode 100644 settings/third_party/google/rpc/code.proto delete mode 100644 settings/third_party/google/rpc/error_details.proto delete mode 100644 settings/third_party/google/rpc/status.proto delete mode 100644 settings/third_party/protoc-gen-swagger/options/annotations.proto delete mode 100644 settings/third_party/protoc-gen-swagger/options/openapiv2.proto create mode 100644 store/templates/GRPC.tmpl rename {accounts/third_party => third_party}/google/api/annotations.proto (100%) rename {accounts/third_party => third_party}/google/api/field_behavior.proto (100%) rename {accounts/third_party => third_party}/google/api/http.proto (100%) rename {accounts/third_party => third_party}/google/protobuf/descriptor.proto (100%) rename {accounts/third_party => third_party}/google/protobuf/empty.proto (100%) rename {accounts/third_party => third_party}/google/protobuf/field_mask.proto (100%) rename {accounts/third_party => third_party}/google/protobuf/timestamp.proto (100%) create mode 100644 thumbnails/pkg/proto/v0/thumbnails.pb_test.go create mode 100644 thumbnails/templates/GRPC.tmpl diff --git a/.drone.star b/.drone.star index 0050f65a8..45f768d85 100644 --- a/.drone.star +++ b/.drone.star @@ -1,22 +1,22 @@ config = { - 'modules': { - 'accounts': 'frontend', - 'glauth':'', - 'idp':'', - 'ocis': '', - 'web':'', - 'ocis-pkg':'', - 'ocs':'', - 'proxy':'', - 'settings':'frontend', - 'storage':'', - 'store':'', - 'thumbnails':'', - 'webdav':'', - 'onlyoffice':'frontend', - 'graph': '', - 'graph-explorer': '' - }, + 'modules': [ + 'accounts', + 'glauth', + 'graph-explorer', + 'graph', + 'idp', + 'ocis-pkg', + 'ocis', + 'ocs', + 'onlyoffice', + 'proxy', + 'settings', + 'storage', + 'store', + 'thumbnails', + 'web', + 'webdav', + ], 'apiTests': { 'numberOfParts': 10 }, @@ -320,9 +320,6 @@ def testOcisModule(ctx, module): } ] - if config['modules'][module] == 'frontend': - steps = frontend(module) + steps - return { 'kind': 'pipeline', 'type': 'docker', @@ -353,7 +350,7 @@ def buildOcisBinaryForTesting(ctx): 'arch': 'amd64', }, 'steps': - makeGenerate('ocis') + + makeGenerate('') + build() + rebuildBuildArtifactCache(ctx, 'ocis-binary-amd64', 'ocis/bin/ocis'), 'trigger': { @@ -711,7 +708,7 @@ def dockerRelease(ctx, arch): 'arch': arch, }, 'steps': - makeGenerate('ocis') + + makeGenerate('') + build() + [ { 'name': 'dryrun', @@ -880,7 +877,7 @@ def binaryRelease(ctx, name): 'arch': 'amd64', }, 'steps': - makeGenerate('ocis') + [ + makeGenerate('') + [ { 'name': 'build', 'image': 'webhippie/golang:1.15', @@ -1191,9 +1188,9 @@ def docs(ctx): }, 'steps': [ { - 'name': 'generate-config-docs', + 'name': 'docs-generate', 'image': 'webhippie/golang:1.15', - 'commands': ['make -C %s config-docs-generate' % (module) for module in config['modules']], + 'commands': ['make -C %s docs-generate' % (module) for module in config['modules']], }, { 'name': 'prepare', @@ -1270,13 +1267,26 @@ def docs(ctx): } def makeGenerate(module): + if module == "": + make = "make" + else: + make = "make -C %s" % (module) return [ { - 'name': 'generate', + 'name': 'generate nodejs', + 'image': 'owncloudci/nodejs:12', + 'pull': 'always', + 'commands': [ + '%s ci-node-generate' % (make), + ], + 'volumes': [stepVolumeGoWebhippie,], + }, + { + 'name': 'generate go', 'image': 'webhippie/golang:1.15', 'pull': 'always', 'commands': [ - 'make -C %s generate' % (module), + '%s ci-go-generate' % (make), ], 'volumes': [stepVolumeGoWebhippie,], } @@ -1321,22 +1331,6 @@ def notify(ctx): } } -def frontend(module): - return [ - { - 'name': 'frontend', - 'image': 'webhippie/nodejs:latest', - 'pull': 'always', - 'commands': [ - 'cd %s' % (module), - 'yarn install --frozen-lockfile', - 'yarn lint', - 'yarn test', - 'yarn build', - ], - } - ] - def ocisServer(storage, accounts_hash_difficulty = 4, volumes=[]): environment = { #'OCIS_LOG_LEVEL': 'debug', diff --git a/Makefile b/Makefile index 5c2b553f2..350fad924 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,42 @@ vendor-bin/behat/composer.lock: vendor-bin/behat/composer.json composer.lock: composer.json @echo composer.lock is not up to date. +.PHONY: generate +generate: + @for mod in $(OCIS_MODULES); do \ + $(MAKE) --no-print-directory -C $$mod generate; \ + done + +.PHONY: vet +vet: + @for mod in $(OCIS_MODULES); do \ + $(MAKE) --no-print-directory -C $$mod vet; \ + done + +.PHONY: clean +clean: + @for mod in $(OCIS_MODULES); do \ + $(MAKE) --no-print-directory -C $$mod clean; \ + done + +.PHONY: docs-generate +docs-generate: + @for mod in $(OCIS_MODULES); do \ + $(MAKE) --no-print-directory -C $$mod docs-generate; \ + done + +.PHONY: ci-go-generate +ci-go-generate: + @for mod in $(OCIS_MODULES); do \ + $(MAKE) --no-print-directory -C $$mod ci-go-generate; \ + done + +.PHONY: ci-node-generate +ci-node-generate: + @for mod in $(OCIS_MODULES); do \ + $(MAKE) --no-print-directory -C $$mod ci-node-generate; \ + done + .PHONY: go-mod-tidy go-mod-tidy: @for mod in $(OCIS_MODULES); do \ diff --git a/accounts/Makefile b/accounts/Makefile index f806106df..226fee910 100644 --- a/accounts/Makefile +++ b/accounts/Makefile @@ -29,6 +29,11 @@ FEATURE_PATH ?= "ui/tests/acceptance/features" TAGS ?= +ifndef GOPATH + export GOPATH := $(shell go env GOPATH) +endif +export PATH := $(PATH):$(GOPATH)/bin + ifndef OUTPUT ifneq ($(DRONE_TAG),) OUTPUT ?= $(subst v,,$(DRONE_TAG)) @@ -84,10 +89,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: protobuf - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -144,10 +145,6 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md - .PHONY: test-acceptance-webui test-acceptance-webui: ./ui/tests/run-acceptance-test.sh $(FEATURE_PATH) @@ -156,6 +153,41 @@ test-acceptance-webui: watch: go run github.com/cespare/reflex -c reflex.conf +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: config-docs-generate \ + grpc-docs-generate + +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md + +.PHONY: grpc-docs-generate +grpc-docs-generate: ../docs/extensions/${NAME}/grpc.md + +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: protobuf # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: yarn-build + +.PHONY: yarn-build +yarn-build: node_modules + yarn lint + yarn test + yarn build + +.PHONY: node_modules +node_modules: + yarn install --frozen-lockfile + +############ protobuf ############ $(GOPATH)/bin/protoc-gen-go: GO111MODULE=off go get -v google.golang.org/protobuf/cmd/protoc-gen-go @@ -168,32 +200,53 @@ $(GOPATH)/bin/protoc-gen-microweb: $(GOPATH)/bin/protoc-gen-openapiv2: GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 -$(PROTO_SRC)/accounts.pb.go: $(PROTO_SRC)/accounts.proto - protoc \ - -I=third_party/ \ - -I=$(PROTO_SRC)/ \ - --go_out=. accounts.proto +$(GOPATH)/bin/protoc-gen-doc: + GO111MODULE=off go get -v github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc -$(PROTO_SRC)/accounts.pb.micro.go: $(PROTO_SRC)/accounts.proto +.PHONY: $(PROTO_SRC)/${NAME}.pb.go +$(PROTO_SRC)/${NAME}.pb.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-go protoc \ - -I=third_party/ \ + -I=../third_party/ \ -I=$(PROTO_SRC)/ \ - --micro_out=. accounts.proto + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --go_out=. ${NAME}.proto -$(PROTO_SRC)/accounts.pb.web.go: $(PROTO_SRC)/accounts.proto +.PHONY: $(PROTO_SRC)/${NAME}.pb.micro.go +$(PROTO_SRC)/${NAME}.pb.micro.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-micro protoc \ - -I=third_party/ \ + -I=../third_party/ \ -I=$(PROTO_SRC)/ \ - --microweb_out=. accounts.proto + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --micro_out=. ${NAME}.proto -$(PROTO_SRC)/accounts.swagger.json: $(PROTO_SRC)/accounts.proto - # the other commands above respect the declared package in the .proto file for placement of the resulting file. - # `swagger_out` doesn't, so we have to specify the output path as `$(PROTO_SRC)` instead of `.` +.PHONY: $(PROTO_SRC)/${NAME}.pb.web.go +$(PROTO_SRC)/${NAME}.pb.web.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-microweb protoc \ - -I=third_party/ \ + -I=../third_party/ \ -I=$(PROTO_SRC)/ \ - --swagger_out=$(PROTO_SRC) accounts.proto + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --microweb_out=. ${NAME}.proto + +.PHONY: $(PROTO_SRC)/${NAME}.swagger.json +$(PROTO_SRC)/${NAME}.swagger.json: $(GOPATH)/bin/protoc-gen-openapiv2 + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --openapiv2_out=$(PROTO_SRC)/ ${NAME}.proto + +.PHONY: ../docs/extensions/${NAME}/grpc.md +../docs/extensions/${NAME}/grpc.md: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-doc + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --doc_opt=./templates/GRPC.tmpl,grpc.md \ + --doc_out=../docs/extensions/${NAME} $(PROTO_SRC)/${NAME}.proto .PHONY: protobuf -protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-openapiv2 \ - $(PROTO_SRC)/accounts.pb.go $(PROTO_SRC)/accounts.pb.micro.go $(PROTO_SRC)/accounts.pb.web.go $(PROTO_SRC)/accounts.swagger.json +protobuf: $(PROTO_SRC)/${NAME}.pb.go \ + $(PROTO_SRC)/${NAME}.pb.micro.go \ + $(PROTO_SRC)/${NAME}.pb.web.go \ + $(PROTO_SRC)/${NAME}.swagger.json \ + ../docs/extensions/${NAME}/grpc.md diff --git a/accounts/pkg/proto/v0/accounts.proto b/accounts/pkg/proto/v0/accounts.proto index cdc24882e..98c0eca2c 100644 --- a/accounts/pkg/proto/v0/accounts.proto +++ b/accounts/pkg/proto/v0/accounts.proto @@ -2,7 +2,7 @@ syntax = "proto3"; option go_package = "pkg/proto/v0;proto"; -package settings; +package accounts; import "google/api/field_behavior.proto"; import "google/api/annotations.proto"; @@ -10,6 +10,32 @@ import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "ownCloud Infinite Scale accounts"; + version: "1.0.0"; + contact: { + name: "ownCloud GmbH"; + url: "https://github.com/owncloud/ocis"; + email: "support@owncloud.com"; + }; + license: { + name: "Apache-2.0"; + url: "https://github.com/owncloud/ocis/blob/master/LICENSE"; + }; + }; + schemes: HTTP; + schemes: HTTPS; + consumes: "application/json"; + produces: "application/json"; + external_docs: { + description: "Developer Manual"; + url: "https://owncloud.github.io/extensions/accounts/"; + }; +}; + // Follow recommended Methods for rpc APIs https://cloud.google.com/apis/design/resources?hl=de#methods // https://cloud.google.com/apis/design/standard_methods?hl=de#list // https://cloud.google.com/apis/design/naming_convention?hl=de diff --git a/thumbnails/templates/grpc.tmpl b/accounts/templates/GRPC.tmpl similarity index 100% rename from thumbnails/templates/grpc.tmpl rename to accounts/templates/GRPC.tmpl diff --git a/docs/Makefile b/docs/Makefile index c137e5cfe..8021170b7 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,30 +1,13 @@ SHELL := bash -OCIS_MODULES = \ - accounts \ - glauth \ - idp \ - ocis \ - ocs \ - ocis-pkg \ - proxy \ - settings \ - storage \ - store \ - thumbnails \ - web \ - webdav - .PHONY: help help: @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -.PHONY: config-docs-generate -config-docs-generate: ## run config-docs-generate for all oCIS extensions - @for mod in $(OCIS_MODULES); do \ - $(MAKE) --no-print-directory -C ../$$mod config-docs-generate; \ - done - +.PHONY: docs-generate +docs-generate: ## run config-docs-generate for all oCIS extensions + @$(MAKE) --no-print-directory -C ../ docs-generate + .PHONY: docs-copy docs-copy: ## copy docs to hugo @mkdir -p hugo/content/ @@ -38,7 +21,7 @@ docs-copy: ## copy docs to hugo rsync -ax --delete --exclude hugo/ --exclude Makefile --exclude .gitignore --exclude README.md ../. content/; \ .PHONY: docs-serve -docs-serve: config-docs-generate docs-copy ## serve docs with hugo +docs-serve: docs-generate docs-copy ## serve docs with hugo @docker run --rm --network host -v $(shell pwd)/hugo:/src owncloudci/hugo:0 server .PHONY: clean diff --git a/docs/extensions/accounts/.gitignore b/docs/extensions/accounts/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/accounts/.gitignore +++ b/docs/extensions/accounts/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/glauth/.gitignore b/docs/extensions/glauth/.gitignore index 422034a72..582a0f847 100644 --- a/docs/extensions/glauth/.gitignore +++ b/docs/extensions/glauth/.gitignore @@ -1 +1,2 @@ -configuration.md \ No newline at end of file +configuration.md +grpc.md diff --git a/docs/extensions/idp/.gitignore b/docs/extensions/idp/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/idp/.gitignore +++ b/docs/extensions/idp/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/ocs/.gitignore b/docs/extensions/ocs/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/ocs/.gitignore +++ b/docs/extensions/ocs/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/onlyoffice/.gitignore b/docs/extensions/onlyoffice/.gitignore new file mode 100644 index 000000000..582a0f847 --- /dev/null +++ b/docs/extensions/onlyoffice/.gitignore @@ -0,0 +1,2 @@ +configuration.md +grpc.md diff --git a/docs/extensions/proxy/.gitignore b/docs/extensions/proxy/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/proxy/.gitignore +++ b/docs/extensions/proxy/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/settings/.gitignore b/docs/extensions/settings/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/settings/.gitignore +++ b/docs/extensions/settings/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/storage/.gitignore b/docs/extensions/storage/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/storage/.gitignore +++ b/docs/extensions/storage/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/store/.gitignore b/docs/extensions/store/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/store/.gitignore +++ b/docs/extensions/store/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/thumbnails/.gitignore b/docs/extensions/thumbnails/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/thumbnails/.gitignore +++ b/docs/extensions/thumbnails/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/thumbnails/grpc.md b/docs/extensions/thumbnails/grpc.md deleted file mode 100644 index 868a5dea5..000000000 --- a/docs/extensions/thumbnails/grpc.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: "GRPC API" -date: 2018-05-02T00:00:00+00:00 -weight: 50 -geekdocRepo: https://github.com/owncloud/ocis -geekdocEditPath: edit/master/docs/extensions/thumbnails -geekdocFilePath: grpc.md ---- - -{{< toc >}} - -## pkg/proto/v0/thumbnails.proto - -### GetRequest - -A request to retrieve a thumbnail - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| filepath | [string](#string) | | The path to the source image | -| filetype | [GetRequest.FileType](#getrequestfiletype) | | The type to which the thumbnail should get encoded to. | -| etag | [string](#string) | | The etag of the source image | -| width | [int32](#int32) | | The width of the thumbnail | -| height | [int32](#int32) | | The height of the thumbnail | -| authorization | [string](#string) | | The authorization token | - -### GetResponse - -The service response - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| thumbnail | [bytes](#bytes) | | The thumbnail as a binary | -| mimetype | [string](#string) | | The mimetype of the thumbnail | - -### GetRequest.FileType - -The file types to which the thumbnail cna get encoded to. - -| Name | Number | Description | -| ---- | ------ | ----------- | -| PNG | 0 | Represents PNG type | -| JPG | 1 | Represents JPG type | - -### ThumbnailService - -A Service for handling thumbnail generation - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| GetThumbnail | [GetRequest](#getrequest) | [GetResponse](#getresponse) | Generates the thumbnail and returns it. | - -## Scalar Value Types - -| .proto Type | Notes | C++ | Java | -| ----------- | ----- | --- | ---- | -| {{< div id="double" content="double" >}} | | double | double | -| {{< div id="float" content="float" >}} | | float | float | -| {{< div id="int32" content="int32" >}} | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | -| {{< div id="int64" content="int64" >}} | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | -| {{< div id="uint32" content="uint32" >}} | Uses variable-length encoding. | uint32 | int | -| {{< div id="uint64" content="uint64" >}} | Uses variable-length encoding. | uint64 | long | -| {{< div id="sint32" content="sint32" >}} | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | -| {{< div id="sint64" content="sint64" >}} | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | -| {{< div id="fixed32" content="fixed32" >}} | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | -| {{< div id="fixed64" content="fixed64" >}} | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | -| {{< div id="sfixed32" content="sfixed32" >}} | Always four bytes. | int32 | int | -| {{< div id="sfixed64" content="sfixed64" >}} | Always eight bytes. | int64 | long | -| {{< div id="bool" content="bool" >}} | | bool | boolean | -| {{< div id="string" content="string" >}} | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | -| {{< div id="bytes" content="bytes" >}} | May contain any arbitrary sequence of bytes. | string | ByteString | diff --git a/docs/extensions/web/.gitignore b/docs/extensions/web/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/web/.gitignore +++ b/docs/extensions/web/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/docs/extensions/webdav/.gitignore b/docs/extensions/webdav/.gitignore index b0c8840e2..582a0f847 100644 --- a/docs/extensions/webdav/.gitignore +++ b/docs/extensions/webdav/.gitignore @@ -1 +1,2 @@ configuration.md +grpc.md diff --git a/glauth/Makefile b/glauth/Makefile index 332711da0..c403dd112 100644 --- a/glauth/Makefile +++ b/glauth/Makefile @@ -79,10 +79,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -139,49 +135,26 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md - .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf -# $(GOPATH)/bin/protoc-gen-go: -# GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go +############ docs generate ############ -# $(GOPATH)/bin/protoc-gen-micro: -# GO111MODULE=off go get -v github.com/micro/protoc-gen-micro +.PHONY: docs-generate +docs-generate: config-docs-generate -# $(GOPATH)/bin/protoc-gen-microweb: -# GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -# $(GOPATH)/bin/protoc-gen-swagger: -# GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate -# pkg/proto/v0/example.pb.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --go_out=pkg/proto/v0 example.proto +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) -# pkg/proto/v0/example.pb.micro.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --micro_out=pkg/proto/v0 example.proto - -# pkg/proto/v0/example.pb.web.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --microweb_out=pkg/proto/v0 example.proto - -# pkg/proto/v0/example.swagger.json: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --swagger_out=pkg/proto/v0 example.proto - -# .PHONY: protobuf -# protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger pkg/proto/v0/example.pb.go pkg/proto/v0/example.pb.micro.go pkg/proto/v0/example.pb.web.go pkg/proto/v0/example.swagger.json +.PHONY: ci-node-generate +ci-node-generate: diff --git a/idp/Makefile b/idp/Makefile index 91f5e04f3..3d0199439 100644 --- a/idp/Makefile +++ b/idp/Makefile @@ -86,32 +86,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: assets - go generate $(GENERATE) - -# TODO find a docker container with go and yarn so we can properly build assets in ci -#assets: assets/identifier/static assets/identifier/index.html -.PHONY: assets -assets: assets/identifier/static assets/identifier/static/logo.svg assets/identifier/static/favicon.ico - -assets/identifier/static: - mkdir -p assets/identifier/static - -.PHONY: assets/identifier/static/logo.svg -assets/identifier/static/logo.svg: - curl -o assets/identifier/static/logo.svg ${LOGO_URL} - -.PHONY: assets/identifier/static/favicon.ico -assets/identifier/static/favicon.ico: - curl -o assets/identifier/static/favicon.ico ${FAVICON_URL} - -assets/identifier/index.html: node_modules - yarn build - -node_modules: - yarn install - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -168,49 +142,59 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md - .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf -# $(GOPATH)/bin/protoc-gen-go: -# GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go +############ docs generate ############ -# $(GOPATH)/bin/protoc-gen-micro: -# GO111MODULE=off go get -v github.com/micro/protoc-gen-micro +.PHONY: docs-generate +docs-generate: config-docs-generate -# $(GOPATH)/bin/protoc-gen-microweb: -# GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -# $(GOPATH)/bin/protoc-gen-swagger: -# GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate -# pkg/proto/v0/example.pb.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --go_out=pkg/proto/v0 example.proto +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) -# pkg/proto/v0/example.pb.micro.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --micro_out=pkg/proto/v0 example.proto +.PHONY: ci-node-generate +ci-node-generate: assets -# pkg/proto/v0/example.pb.web.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --microweb_out=pkg/proto/v0 example.proto +.PHONY: assets +assets: yarn-build \ + assets/identifier/static \ + assets/identifier/static/logo.svg \ + assets/identifier/static/favicon.ico -# pkg/proto/v0/example.swagger.json: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --swagger_out=pkg/proto/v0 example.proto +assets/identifier/static: + mkdir -p assets/identifier/static -# .PHONY: protobuf -# protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger pkg/proto/v0/example.pb.go pkg/proto/v0/example.pb.micro.go pkg/proto/v0/example.pb.web.go pkg/proto/v0/example.swagger.json +.PHONY: assets/identifier/static/logo.svg # force overwrite +assets/identifier/static/logo.svg: + curl -o assets/identifier/static/logo.svg ${LOGO_URL} + +.PHONY: assets/identifier/static/favicon.ico # force overwrite +assets/identifier/static/favicon.ico: + curl -o assets/identifier/static/favicon.ico ${FAVICON_URL} + +.PHONY: yarn-build +yarn-build: node_modules + #yarn lint #TODO: activate + #yarn test #TODO: activate + yarn build + +.PHONY: node_modules +node_modules: + yarn install --frozen-lockfile + +######### + +.PHONY: generate +generate: assets + go generate $(GENERATE) diff --git a/ocis-pkg/Makefile b/ocis-pkg/Makefile index 6a00a59f0..2f3b3bf66 100644 --- a/ocis-pkg/Makefile +++ b/ocis-pkg/Makefile @@ -57,10 +57,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -78,6 +74,18 @@ go-coverage: build: $(GOBUILD) -v -tags '$(TAGS)' -ldflags '$(LDFLAGS)' ./... -.PHONY: config-docs-generate -config-docs-generate: -# go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md \ No newline at end of file +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: + +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: diff --git a/ocis/Makefile b/ocis/Makefile index b789191b7..0a6d7e266 100644 --- a/ocis/Makefile +++ b/ocis/Makefile @@ -87,10 +87,6 @@ vet: ## vet lint: ## lint for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: ## generate - go generate $(GENERATE) - .PHONY: changelog changelog: ## generate changelog go run github.com/restic/calens -i ../changelog -t ../changelog/CHANGELOG.tmpl >| ../CHANGELOG.md @@ -154,10 +150,26 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: config-docs-generate -config-docs-generate: ## generate configuration documentation - go run github.com/owncloud/flaex >| ../docs/ocis/configuration.md - .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf + +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: config-docs-generate + +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/$(NAME)/configuration.md + +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: diff --git a/ocs/Makefile b/ocs/Makefile index 01ffc6823..ef2ebeb70 100644 --- a/ocs/Makefile +++ b/ocs/Makefile @@ -80,10 +80,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -140,49 +136,26 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md - .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf -# $(GOPATH)/bin/protoc-gen-go: -# GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go +############ docs generate ############ -# $(GOPATH)/bin/protoc-gen-micro: -# GO111MODULE=off go get -v github.com/micro/protoc-gen-micro +.PHONY: docs-generate +docs-generate: config-docs-generate -# $(GOPATH)/bin/protoc-gen-microweb: -# GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -# $(GOPATH)/bin/protoc-gen-swagger: -# GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate -# pkg/proto/v0/example.pb.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --go_out=logtostderr=true:pkg/proto/v0 example.proto +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) -# pkg/proto/v0/example.pb.micro.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --micro_out=logtostderr=true:pkg/proto/v0 example.proto - -# pkg/proto/v0/example.pb.web.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --microweb_out=logtostderr=true:pkg/proto/v0 example.proto - -# pkg/proto/v0/example.swagger.json: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --swagger_out=logtostderr=true:pkg/proto/v0 example.proto - -# .PHONY: protobuf -# protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger pkg/proto/v0/example.pb.go pkg/proto/v0/example.pb.micro.go pkg/proto/v0/example.pb.web.go pkg/proto/v0/example.swagger.json +.PHONY: ci-node-generate +ci-node-generate: diff --git a/onlyoffice/Makefile b/onlyoffice/Makefile index 1ae16b93f..46b14fb75 100644 --- a/onlyoffice/Makefile +++ b/onlyoffice/Makefile @@ -81,10 +81,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -141,10 +137,36 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check +.PHONY: watch +watch: + go run github.com/cespare/reflex -c reflex.conf + +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: config-docs-generate + .PHONY: config-docs-generate config-docs-generate: go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -.PHONY: watch -watch: - go run github.com/cespare/reflex -c reflex.conf +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: yarn-build + +.PHONY: yarn-build +yarn-build: node_modules + yarn lint + yarn test + yarn build + +.PHONY: node_modules +node_modules: + yarn install --frozen-lockfile diff --git a/proxy/Makefile b/proxy/Makefile index 26f2cd2ba..53c047337 100644 --- a/proxy/Makefile +++ b/proxy/Makefile @@ -80,10 +80,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -140,10 +136,27 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check +.PHONY: watch +watch: + go run github.com/cespare/reflex -c reflex.conf + +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: config-docs-generate + .PHONY: config-docs-generate config-docs-generate: go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -.PHONY: watch -watch: - go run github.com/cespare/reflex -c reflex.conf +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: + diff --git a/settings/Makefile b/settings/Makefile index 21b83e058..37fee1c06 100644 --- a/settings/Makefile +++ b/settings/Makefile @@ -27,6 +27,11 @@ FEATURE_PATH ?= "ui/tests/acceptance/features" TAGS ?= +ifndef GOPATH + export GOPATH := $(shell go env GOPATH) +endif +export PATH := $(PATH):$(GOPATH)/bin + ifndef OUTPUT ifneq ($(DRONE_TAG),) OUTPUT ?= $(subst v,,$(DRONE_TAG)) @@ -83,10 +88,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -147,16 +148,47 @@ release-finish: release-copy release-check test-acceptance-webui: ./ui/tests/run-acceptance-test.sh $(FEATURE_PATH) -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md - .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: config-docs-generate \ + grpc-docs-generate + +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md + +.PHONY: grpc-docs-generate +grpc-docs-generate: ../docs/extensions/${NAME}/grpc.md + +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: protobuf # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: yarn-build + +.PHONY: yarn-build +yarn-build: node_modules + yarn lint + yarn test + yarn build + +.PHONY: node_modules +node_modules: + yarn install --frozen-lockfile + +############ protobuf ############ $(GOPATH)/bin/protoc-gen-go: - GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go + GO111MODULE=off go get -v google.golang.org/protobuf/cmd/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro: GO111MODULE=on go get -v github.com/micro/protoc-gen-micro/v2 @@ -164,37 +196,56 @@ $(GOPATH)/bin/protoc-gen-micro: $(GOPATH)/bin/protoc-gen-microweb: GO111MODULE=off go get -v github.com/owncloud/protoc-gen-microweb -$(GOPATH)/bin/protoc-gen-swagger: - GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +$(GOPATH)/bin/protoc-gen-openapiv2: + GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 -$(PROTO_SRC)/settings.pb.go: $(PROTO_SRC)/settings.proto - protoc \ - --plugin=protoc-gen-go=$(GOPATH)/bin/protoc-gen-go \ - -I=third_party/ \ - -I=$(PROTO_SRC)/ \ - --go_out=. settings.proto +$(GOPATH)/bin/protoc-gen-doc: + GO111MODULE=off go get -v github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc -$(PROTO_SRC)/settings.pb.micro.go: $(PROTO_SRC)/settings.proto +.PHONY: $(PROTO_SRC)/${NAME}.pb.go +$(PROTO_SRC)/${NAME}.pb.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-go protoc \ - --plugin=protoc-gen-micro=$(GOPATH)/bin/protoc-gen-micro \ - -I=third_party/ \ + -I=../third_party/ \ -I=$(PROTO_SRC)/ \ - --micro_out=. settings.proto + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --go_out=. ${NAME}.proto -$(PROTO_SRC)/settings.pb.web.go: $(PROTO_SRC)/settings.proto +.PHONY: $(PROTO_SRC)/${NAME}.pb.micro.go +$(PROTO_SRC)/${NAME}.pb.micro.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-micro protoc \ - --plugin=protoc-gen-microweb=$(GOPATH)/bin/protoc-gen-microweb \ - -I=third_party/ \ + -I=../third_party/ \ -I=$(PROTO_SRC)/ \ - --microweb_out=. settings.proto + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --micro_out=. ${NAME}.proto -$(PROTO_SRC)/settings.swagger.json: $(PROTO_SRC)/settings.proto +.PHONY: $(PROTO_SRC)/${NAME}.pb.web.go +$(PROTO_SRC)/${NAME}.pb.web.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-microweb protoc \ - --plugin=protoc-gen-swagger=$(GOPATH)/bin/protoc-gen-swagger \ - -I=third_party/ \ + -I=../third_party/ \ -I=$(PROTO_SRC)/ \ - --swagger_out=$(PROTO_SRC) settings.proto + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --microweb_out=. ${NAME}.proto + +.PHONY: $(PROTO_SRC)/${NAME}.swagger.json +$(PROTO_SRC)/${NAME}.swagger.json: $(GOPATH)/bin/protoc-gen-openapiv2 + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --openapiv2_out=$(PROTO_SRC)/ ${NAME}.proto + +.PHONY: ../docs/extensions/${NAME}/grpc.md +../docs/extensions/${NAME}/grpc.md: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-doc + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --doc_opt=./templates/GRPC.tmpl,grpc.md \ + --doc_out=../docs/extensions/${NAME} $(PROTO_SRC)/${NAME}.proto .PHONY: protobuf -protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger \ - $(PROTO_SRC)/settings.pb.go $(PROTO_SRC)/settings.pb.micro.go $(PROTO_SRC)/settings.pb.web.go $(PROTO_SRC)/settings.swagger.json +protobuf: $(PROTO_SRC)/${NAME}.pb.go \ + $(PROTO_SRC)/${NAME}.pb.micro.go \ + $(PROTO_SRC)/${NAME}.pb.web.go \ + $(PROTO_SRC)/${NAME}.swagger.json \ + ../docs/extensions/${NAME}/grpc.md diff --git a/settings/pkg/proto/v0/settings.proto b/settings/pkg/proto/v0/settings.proto index 9956a3c71..a2e4c3e2a 100644 --- a/settings/pkg/proto/v0/settings.proto +++ b/settings/pkg/proto/v0/settings.proto @@ -4,32 +4,33 @@ package proto; option go_package = "pkg/proto/v0;proto"; import "google/api/annotations.proto"; -import "protoc-gen-swagger/options/annotations.proto"; import "google/protobuf/empty.proto"; -option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { - info: { - title: "Settings"; - version: "1.0"; - contact: { - name: "ownCloud GmbH"; - url: "https://github.com/owncloud/ocis-settings"; - email: "support@owncloud.com"; - }; - license: { - name: "Apache-2.0"; - url: "https://github.com/owncloud/ocis/settings/blob/master/LICENSE"; - }; - }; - schemes: HTTP; - schemes: HTTPS; - consumes: "application/json"; - produces: "application/json"; - external_docs: { - description: "Developer Manual"; - url: "http://owncloud.github.io/extensions/ocis_settings/"; - }; -}; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "ownCloud Infinite Scale settings"; + version: "1.0.0"; + contact: { + name: "ownCloud GmbH"; + url: "https://github.com/owncloud/ocis"; + email: "support@owncloud.com"; + }; + license: { + name: "Apache-2.0"; + url: "https://github.com/owncloud/ocis/blob/master/LICENSE"; + }; + }; + schemes: HTTP; + schemes: HTTPS; + consumes: "application/json"; + produces: "application/json"; + external_docs: { + description: "Developer Manual"; + url: "https://owncloud.github.io/extensions/settings/"; + }; +}; service BundleService { rpc SaveBundle(SaveBundleRequest) returns (SaveBundleResponse) { diff --git a/settings/templates/GRPC.tmpl b/settings/templates/GRPC.tmpl new file mode 100644 index 000000000..545ab202d --- /dev/null +++ b/settings/templates/GRPC.tmpl @@ -0,0 +1,75 @@ +--- +title: "GRPC API" +date: 2018-05-02T00:00:00+00:00 +weight: 50 +geekdocRepo: https://github.com/owncloud/ocis-thumbnails +geekdocEditPath: edit/master/docs +geekdocFilePath: grpc.md +--- + +{{`{{< toc >}}`}} + +{{ range .Files -}} +## {{ .Name }} + +{{ .Description }} +{{- range .Messages -}} +{{- /* remove newline */}}### {{ .LongName }} + +{{ .Description }} + +{{ if .HasFields -}} +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +{{ range .Fields -}} +| {{.Name}} | [{{.LongType}}](#{{.LongType | lower | replace "." "" }}) | {{.Label}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end }} | +{{ end -}} +{{ end }} +{{ if .HasExtensions -}} +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +{{ range .Extensions -}} +| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | +{{ end -}} +{{ end -}} +{{ end -}} +{{- range .Enums -}} +### {{ .LongName }} + +{{ .Description }} + +| Name | Number | Description | +| ---- | ------ | ----------- | +{{range .Values -}} +| {{.Name}} | {{.Number}} | {{nobr .Description}} | +{{ end -}} +{{ end -}} + +{{ if .HasExtensions }} + +### File-level Extensions +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +{{ range .Extensions -}} +| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} | +{{ end -}} +{{ end -}} +{{- range .Services }} +### {{ .Name }} + +{{ .Description }} + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +{{ range .Methods -}} +| {{.Name}} | [{{.RequestLongType}}](#{{.RequestLongType | lower | replace "." "" }}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}](#{{.ResponseLongType | lower | replace "." "" }}){{if .ResponseStreaming}} stream{{end}} | {{nobr .Description}} | +{{ end -}} +{{ end -}} +{{ end }} +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | +| ----------- | ----- | --- | ---- | +{{ range .Scalars -}} +| {{`{{< div id="`}}{{.ProtoType}}{{`" content="`}}{{.ProtoType}}{{`" >}}`}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | +{{ end }} \ No newline at end of file diff --git a/settings/third_party/google/api/annotations.proto b/settings/third_party/google/api/annotations.proto deleted file mode 100644 index 85c361b47..000000000 --- a/settings/third_party/google/api/annotations.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2015, Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.api; - -import "google/api/http.proto"; -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "AnnotationsProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.MethodOptions { - // See `HttpRule`. - HttpRule http = 72295728; -} diff --git a/settings/third_party/google/api/http.proto b/settings/third_party/google/api/http.proto deleted file mode 100644 index 2bd3a19bf..000000000 --- a/settings/third_party/google/api/http.proto +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.api; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "HttpProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - - -// Defines the HTTP configuration for an API service. It contains a list of -// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method -// to one or more HTTP REST API methods. -message Http { - // A list of HTTP configuration rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated HttpRule rules = 1; - - // When set to true, URL path parmeters will be fully URI-decoded except in - // cases of single segment matches in reserved expansion, where "%2F" will be - // left encoded. - // - // The default behavior is to not decode RFC 6570 reserved characters in multi - // segment matches. - bool fully_decode_reserved_expansion = 2; -} - -// `HttpRule` defines the mapping of an RPC method to one or more HTTP -// REST API methods. The mapping specifies how different portions of the RPC -// request message are mapped to URL path, URL query parameters, and -// HTTP request body. The mapping is typically specified as an -// `google.api.http` annotation on the RPC method, -// see "google/api/annotations.proto" for details. -// -// The mapping consists of a field specifying the path template and -// method kind. The path template can refer to fields in the request -// message, as in the example below which describes a REST GET -// operation on a resource collection of messages: -// -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; -// } -// } -// message GetMessageRequest { -// message SubMessage { -// string subfield = 1; -// } -// string message_id = 1; // mapped to the URL -// SubMessage sub = 2; // `sub.subfield` is url-mapped -// } -// message Message { -// string text = 1; // content of the resource -// } -// -// The same http annotation can alternatively be expressed inside the -// `GRPC API Configuration` YAML file. -// -// http: -// rules: -// - selector: .Messaging.GetMessage -// get: /v1/messages/{message_id}/{sub.subfield} -// -// This definition enables an automatic, bidrectional mapping of HTTP -// JSON to RPC. Example: -// -// HTTP | RPC -// -----|----- -// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` -// -// In general, not only fields but also field paths can be referenced -// from a path pattern. Fields mapped to the path pattern cannot be -// repeated and must have a primitive (non-message) type. -// -// Any fields in the request message which are not bound by the path -// pattern automatically become (optional) HTTP query -// parameters. Assume the following definition of the request message: -// -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http).get = "/v1/messages/{message_id}"; -// } -// } -// message GetMessageRequest { -// message SubMessage { -// string subfield = 1; -// } -// string message_id = 1; // mapped to the URL -// int64 revision = 2; // becomes a parameter -// SubMessage sub = 3; // `sub.subfield` becomes a parameter -// } -// -// -// This enables a HTTP JSON to RPC mapping as below: -// -// HTTP | RPC -// -----|----- -// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` -// -// Note that fields which are mapped to HTTP parameters must have a -// primitive type or a repeated primitive type. Message types are not -// allowed. In the case of a repeated type, the parameter can be -// repeated in the URL, as in `...?param=A¶m=B`. -// -// For HTTP method kinds which allow a request body, the `body` field -// specifies the mapping. Consider a REST update method on the -// message resource collection: -// -// -// service Messaging { -// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { -// option (google.api.http) = { -// put: "/v1/messages/{message_id}" -// body: "message" -// }; -// } -// } -// message UpdateMessageRequest { -// string message_id = 1; // mapped to the URL -// Message message = 2; // mapped to the body -// } -// -// -// The following HTTP JSON to RPC mapping is enabled, where the -// representation of the JSON in the request body is determined by -// protos JSON encoding: -// -// HTTP | RPC -// -----|----- -// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` -// -// The special name `*` can be used in the body mapping to define that -// every field not bound by the path template should be mapped to the -// request body. This enables the following alternative definition of -// the update method: -// -// service Messaging { -// rpc UpdateMessage(Message) returns (Message) { -// option (google.api.http) = { -// put: "/v1/messages/{message_id}" -// body: "*" -// }; -// } -// } -// message Message { -// string message_id = 1; -// string text = 2; -// } -// -// -// The following HTTP JSON to RPC mapping is enabled: -// -// HTTP | RPC -// -----|----- -// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` -// -// Note that when using `*` in the body mapping, it is not possible to -// have HTTP parameters, as all fields not bound by the path end in -// the body. This makes this option more rarely used in practice of -// defining REST APIs. The common usage of `*` is in custom methods -// which don't use the URL at all for transferring data. -// -// It is possible to define multiple HTTP methods for one RPC by using -// the `additional_bindings` option. Example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get: "/v1/messages/{message_id}" -// additional_bindings { -// get: "/v1/users/{user_id}/messages/{message_id}" -// } -// }; -// } -// } -// message GetMessageRequest { -// string message_id = 1; -// string user_id = 2; -// } -// -// -// This enables the following two alternative HTTP JSON to RPC -// mappings: -// -// HTTP | RPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` -// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` -// -// # Rules for HTTP mapping -// -// The rules for mapping HTTP path, query parameters, and body fields -// to the request message are as follows: -// -// 1. The `body` field specifies either `*` or a field path, or is -// omitted. If omitted, it indicates there is no HTTP request body. -// 2. Leaf fields (recursive expansion of nested messages in the -// request) can be classified into three types: -// (a) Matched in the URL template. -// (b) Covered by body (if body is `*`, everything except (a) fields; -// else everything under the body field) -// (c) All other fields. -// 3. URL query parameters found in the HTTP request are mapped to (c) fields. -// 4. Any body sent with an HTTP request can contain only (b) fields. -// -// The syntax of the path template is as follows: -// -// Template = "/" Segments [ Verb ] ; -// Segments = Segment { "/" Segment } ; -// Segment = "*" | "**" | LITERAL | Variable ; -// Variable = "{" FieldPath [ "=" Segments ] "}" ; -// FieldPath = IDENT { "." IDENT } ; -// Verb = ":" LITERAL ; -// -// The syntax `*` matches a single path segment. The syntax `**` matches zero -// or more path segments, which must be the last part of the path except the -// `Verb`. The syntax `LITERAL` matches literal text in the path. -// -// The syntax `Variable` matches part of the URL path as specified by its -// template. A variable template must not contain other variables. If a variable -// matches a single path segment, its template may be omitted, e.g. `{var}` -// is equivalent to `{var=*}`. -// -// If a variable contains exactly one path segment, such as `"{var}"` or -// `"{var=*}"`, when such a variable is expanded into a URL path, all characters -// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the -// Discovery Document as `{var}`. -// -// If a variable contains one or more path segments, such as `"{var=foo/*}"` -// or `"{var=**}"`, when such a variable is expanded into a URL path, all -// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables -// show up in the Discovery Document as `{+var}`. -// -// NOTE: While the single segment variable matches the semantics of -// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 -// Simple String Expansion, the multi segment variable **does not** match -// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion -// does not expand special characters like `?` and `#`, which would lead -// to invalid URLs. -// -// NOTE: the field paths in variables and in the `body` must not refer to -// repeated fields or map fields. -message HttpRule { - // Selects methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Determines the URL pattern is matched by this rules. This pattern can be - // used with any of the {get|put|post|delete|patch} methods. A custom method - // can be defined using the 'custom' field. - oneof pattern { - // Used for listing and getting information about resources. - string get = 2; - - // Used for updating a resource. - string put = 3; - - // Used for creating a resource. - string post = 4; - - // Used for deleting a resource. - string delete = 5; - - // Used for updating a resource. - string patch = 6; - - // The custom pattern is used for specifying an HTTP method that is not - // included in the `pattern` field, such as HEAD, or "*" to leave the - // HTTP method unspecified for this rule. The wild-card rule is useful - // for services that provide content to Web (HTML) clients. - CustomHttpPattern custom = 8; - } - - // The name of the request field whose value is mapped to the HTTP body, or - // `*` for mapping all fields not captured by the path pattern to the HTTP - // body. NOTE: the referred field must not be a repeated field and must be - // present at the top-level of request message type. - string body = 7; - - // Optional. The name of the response field whose value is mapped to the HTTP - // body of response. Other response fields are ignored. When - // not set, the response message will be used as HTTP body of response. - string response_body = 12; - - // Additional HTTP bindings for the selector. Nested bindings must - // not contain an `additional_bindings` field themselves (that is, - // the nesting may only be one level deep). - repeated HttpRule additional_bindings = 11; -} - -// A custom pattern is used for defining custom HTTP verb. -message CustomHttpPattern { - // The name of this custom HTTP verb. - string kind = 1; - - // The path matched by this custom verb. - string path = 2; -} diff --git a/settings/third_party/google/api/httpbody.proto b/settings/third_party/google/api/httpbody.proto deleted file mode 100644 index 4428515c1..000000000 --- a/settings/third_party/google/api/httpbody.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2018 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/any.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; -option java_multiple_files = true; -option java_outer_classname = "HttpBodyProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Message that represents an arbitrary HTTP body. It should only be used for -// payload formats that can't be represented as JSON, such as raw binary or -// an HTML page. -// -// -// This message can be used both in streaming and non-streaming API methods in -// the request as well as the response. -// -// It can be used as a top-level request field, which is convenient if one -// wants to extract parameters from either the URL or HTTP template into the -// request fields and also want access to the raw HTTP body. -// -// Example: -// -// message GetResourceRequest { -// // A unique request id. -// string request_id = 1; -// -// // The raw HTTP body is bound to this field. -// google.api.HttpBody http_body = 2; -// } -// -// service ResourceService { -// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); -// rpc UpdateResource(google.api.HttpBody) returns -// (google.protobuf.Empty); -// } -// -// Example with streaming methods: -// -// service CaldavService { -// rpc GetCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// rpc UpdateCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// } -// -// Use of this type only changes how the request and response bodies are -// handled, all other features will continue to work unchanged. -message HttpBody { - // The HTTP Content-Type header value specifying the content type of the body. - string content_type = 1; - - // The HTTP request/response body as raw binary. - bytes data = 2; - - // Application specific response metadata. Must be set in the first response - // for streaming APIs. - repeated google.protobuf.Any extensions = 3; -} \ No newline at end of file diff --git a/settings/third_party/google/protobuf/any.proto b/settings/third_party/google/protobuf/any.proto deleted file mode 100644 index 493294255..000000000 --- a/settings/third_party/google/protobuf/any.proto +++ /dev/null @@ -1,154 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// 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 = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "github.com/golang/protobuf/ptypes/any"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "AnyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) -// ... -// foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; -} diff --git a/settings/third_party/google/protobuf/descriptor.proto b/settings/third_party/google/protobuf/descriptor.proto deleted file mode 100644 index ed08fcbc5..000000000 --- a/settings/third_party/google/protobuf/descriptor.proto +++ /dev/null @@ -1,883 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// 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. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// The messages in this file describe the definitions found in .proto files. -// A valid .proto file can be translated directly to a FileDescriptorProto -// without any other information (e.g. without reading its imports). - - -syntax = "proto2"; - -package google.protobuf; -option go_package = "github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.Reflection"; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// descriptor.proto must be optimized for speed because reflection-based -// algorithms don't work during bootstrapping. -option optimize_for = SPEED; - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} - -// Describes a complete .proto file. -message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. - - // Names of files imported by this file. - repeated string dependency = 3; - // Indexes of the public imported files in the dependency list above. - repeated int32 public_dependency = 10; - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - repeated int32 weak_dependency = 11; - - // All top-level definitions in this file. - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - - optional FileOptions options = 8; - - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - optional SourceCodeInfo source_code_info = 9; - - // The syntax of the proto file. - // The supported values are "proto2" and "proto3". - optional string syntax = 12; -} - -// Describes a message type. -message DescriptorProto { - optional string name = 1; - - repeated FieldDescriptorProto field = 2; - repeated FieldDescriptorProto extension = 6; - - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - - message ExtensionRange { - optional int32 start = 1; - optional int32 end = 2; - - optional ExtensionRangeOptions options = 3; - } - repeated ExtensionRange extension_range = 5; - - repeated OneofDescriptorProto oneof_decl = 8; - - optional MessageOptions options = 7; - - // Range of reserved tag numbers. Reserved tag numbers may not be used by - // fields or extension ranges in the same message. Reserved ranges may - // not overlap. - message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - } - repeated ReservedRange reserved_range = 9; - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - repeated string reserved_name = 10; -} - -message ExtensionRangeOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -// Describes a field within a message. -message FieldDescriptorProto { - enum Type { - // 0 is reserved for errors. - // Order is weird for historical reasons. - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 - // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; // Length-delimited aggregate. - - // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. - }; - - enum Label { - // 0 is reserved for errors - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - }; - - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; - - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - optional Type type = 5; - - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - optional string type_name = 6; - - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - optional string extendee = 2; - - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - // TODO(kenton): Base-64 encode? - optional string default_value = 7; - - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - optional int32 oneof_index = 9; - - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - optional string json_name = 10; - - optional FieldOptions options = 8; -} - -// Describes a oneof. -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; -} - -// Describes an enum type. -message EnumDescriptorProto { - optional string name = 1; - - repeated EnumValueDescriptorProto value = 2; - - optional EnumOptions options = 3; - - // Range of reserved numeric values. Reserved values may not be used by - // entries in the same enum. Reserved ranges may not overlap. - // - // Note that this is distinct from DescriptorProto.ReservedRange in that it - // is inclusive such that it can appropriately represent the entire int32 - // domain. - message EnumReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Inclusive. - } - - // Range of reserved numeric values. Reserved numeric values may not be used - // by enum values in the same enum declaration. Reserved ranges may not - // overlap. - repeated EnumReservedRange reserved_range = 4; - - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - repeated string reserved_name = 5; -} - -// Describes a value within an enum. -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - - optional EnumValueOptions options = 3; -} - -// Describes a service. -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - - optional ServiceOptions options = 3; -} - -// Describes a method of a service. -message MethodDescriptorProto { - optional string name = 1; - - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - optional string input_type = 2; - optional string output_type = 3; - - optional MethodOptions options = 4; - - // Identifies if client streams multiple client messages - optional bool client_streaming = 5 [default=false]; - // Identifies if server streams multiple server messages - optional bool server_streaming = 6 [default=false]; -} - - -// =================================================================== -// Options - -// Each of the definitions above may have "options" attached. These are -// just annotations which may cause code to be generated slightly differently -// or may contain hints for code that manipulates protocol messages. -// -// Clients may define custom options as extensions of the *Options messages. -// These extensions may not yet be known at parsing time, so the parser cannot -// store the values in them. Instead it stores them in a field in the *Options -// message called uninterpreted_option. This field must have the same name -// across all *Options messages. We then use this field to populate the -// extensions when we build a descriptor, at which point all protos have been -// parsed and so all extensions are known. -// -// Extension numbers for custom options may be chosen as follows: -// * For options which will only be used within a single application or -// organization, or for experimental options, use field numbers 50000 -// through 99999. It is up to you to ensure that you do not use the -// same number for multiple options. -// * For options which will be published and used publicly by multiple -// independent entities, e-mail protobuf-global-extension-registry@google.com -// to reserve extension numbers. Simply provide your project name (e.g. -// Objective-C plugin) and your project website (if available) -- there's no -// need to explain how you intend to use them. Usually you only need one -// extension number. You can declare multiple options with only one extension -// number by putting them in a sub-message. See the Custom Options section of -// the docs for examples: -// https://developers.google.com/protocol-buffers/docs/proto#options -// If this turns out to be popular, a web service will be set up -// to automatically assign option numbers. - - -message FileOptions { - - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - optional string java_package = 1; - - - // If set, all the classes from the .proto file are wrapped in a single - // outer class with the given name. This applies to both Proto1 - // (equivalent to the old "--one_java_file" option) and Proto2 (where - // a .proto always translates to a single class, but you may want to - // explicitly choose the class name). - optional string java_outer_classname = 8; - - // If set true, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the outer class - // named by java_outer_classname. However, the outer class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - optional bool java_multiple_files = 10 [default=false]; - - // This option does nothing. - optional bool java_generate_equals_and_hash = 20 [deprecated=true]; - - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - optional bool java_string_check_utf8 = 27 [default=false]; - - - // Generated classes can be optimized for speed or code size. - enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. - } - optional OptimizeMode optimize_for = 9 [default=SPEED]; - - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - optional string go_package = 11; - - - - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - optional bool cc_generic_services = 16 [default=false]; - optional bool java_generic_services = 17 [default=false]; - optional bool py_generic_services = 18 [default=false]; - optional bool php_generic_services = 42 [default=false]; - - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - optional bool deprecated = 23 [default=false]; - - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - optional bool cc_enable_arenas = 31 [default=false]; - - - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - optional string objc_class_prefix = 36; - - // Namespace for generated classes; defaults to the package. - optional string csharp_namespace = 37; - - // By default Swift generators will take the proto package and CamelCase it - // replacing '.' with underscore and use that to prefix the types/symbols - // defined. When this options is provided, they will use this value instead - // to prefix the types/symbols defined. - optional string swift_prefix = 39; - - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - optional string php_class_prefix = 40; - - // Use this option to change the namespace of php generated classes. Default - // is empty. When this option is empty, the package name will be used for - // determining the namespace. - optional string php_namespace = 41; - - - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be used - // for determining the namespace. - optional string php_metadata_namespace = 44; - - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - optional string ruby_package = 45; - - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. - // See the documentation for the "Options" section above. - extensions 1000 to max; - - reserved 38; -} - -message MessageOptions { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - optional bool message_set_wire_format = 1 [default=false]; - - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - optional bool no_standard_descriptor_accessor = 2 [default=false]; - - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - optional bool deprecated = 3 [default=false]; - - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementions still need to work as - // if the field is a repeated message field. - // - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - optional bool map_entry = 7; - - reserved 8; // javalite_serializable - reserved 9; // javanano_as_lite - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message FieldOptions { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - optional CType ctype = 1 [default = STRING]; - enum CType { - // Default mode. - STRING = 0; - - CORD = 1; - - STRING_PIECE = 2; - } - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - optional bool packed = 2; - - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - // is represented as JavaScript string, which avoids loss of precision that - // can happen when a large value is converted to a floating point JavaScript. - // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - // use the JavaScript "number" type. The behavior of the default option - // JS_NORMAL is implementation dependent. - // - // This option is an enum to permit additional types to be added, e.g. - // goog.math.Integer. - optional JSType jstype = 6 [default = JS_NORMAL]; - enum JSType { - // Use the default type. - JS_NORMAL = 0; - - // Use JavaScript strings. - JS_STRING = 1; - - // Use JavaScript numbers. - JS_NUMBER = 2; - } - - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - optional bool lazy = 5 [default=false]; - - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - optional bool deprecated = 3 [default=false]; - - // For Google-internal migration only. Do not use. - optional bool weak = 10 [default=false]; - - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; - - reserved 4; // removed jtype -} - -message OneofOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumOptions { - - // Set this option to true to allow mapping different tag names to the same - // value. - optional bool allow_alias = 2; - - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - optional bool deprecated = 3 [default=false]; - - reserved 5; // javanano_as_lite - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumValueOptions { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - optional bool deprecated = 1 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message ServiceOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - optional bool deprecated = 33 [default=false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message MethodOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - optional bool deprecated = 33 [default=false]; - - // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - // or neither? HTTP based RPC implementation may choose GET verb for safe - // methods, and PUT verb for idempotent methods instead of the default POST. - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; // implies idempotent - IDEMPOTENT = 2; // idempotent, but may have side effects - } - optional IdempotencyLevel idempotency_level = - 34 [default=IDEMPOTENCY_UNKNOWN]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -message UninterpretedOption { - // The name of the uninterpreted option. Each string represents a segment in - // a dot-separated name. is_extension is true iff a segment represents an - // extension (denoted with parentheses in options specs in .proto files). - // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - // "foo.(bar.baz).qux". - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } - repeated NamePart name = 2; - - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; -} - -// =================================================================== -// Optional source code info - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -message SourceCodeInfo { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendent. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - repeated Location location = 1; - message Location { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition. For - // example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - repeated int32 path = 1 [packed=true]; - - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - repeated int32 span = 2 [packed=true]; - - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to qux. - // // - // // Another line attached to qux. - // optional double qux = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to qux or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -message GeneratedCodeInfo { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - repeated Annotation annotation = 1; - message Annotation { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - repeated int32 path = 1 [packed=true]; - - // Identifies the filesystem path to the original source .proto. - optional string source_file = 2; - - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - optional int32 begin = 3; - - // Identifies the ending offset in bytes in the generated code that - // relates to the identified offset. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - optional int32 end = 4; - } -} diff --git a/settings/third_party/google/protobuf/struct.proto b/settings/third_party/google/protobuf/struct.proto deleted file mode 100644 index 7d7808e7f..000000000 --- a/settings/third_party/google/protobuf/struct.proto +++ /dev/null @@ -1,96 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// 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. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// 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 = "proto3"; - -package google.protobuf; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "StructProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - - -// `Struct` represents a structured data value, consisting of fields -// which map to dynamically typed values. In some languages, `Struct` -// might be supported by a native representation. For example, in -// scripting languages like JS a struct is represented as an -// object. The details of that representation are described together -// with the proto support for the language. -// -// The JSON representation for `Struct` is JSON object. -message Struct { - // Unordered map of dynamically typed values. - map fields = 1; -} - -// `Value` represents a dynamically typed value which can be either -// null, a number, a string, a boolean, a recursive struct value, or a -// list of values. A producer of value is expected to set one of that -// variants, absence of any variant indicates an error. -// -// The JSON representation for `Value` is JSON value. -message Value { - // The kind of value. - oneof kind { - // Represents a null value. - NullValue null_value = 1; - // Represents a double value. - double number_value = 2; - // Represents a string value. - string string_value = 3; - // Represents a boolean value. - bool bool_value = 4; - // Represents a structured value. - Struct struct_value = 5; - // Represents a repeated `Value`. - ListValue list_value = 6; - } -} - -// `NullValue` is a singleton enumeration to represent the null value for the -// `Value` type union. -// -// The JSON representation for `NullValue` is JSON `null`. -enum NullValue { - // Null value. - NULL_VALUE = 0; -} - -// `ListValue` is a wrapper around a repeated field of values. -// -// The JSON representation for `ListValue` is JSON array. -message ListValue { - // Repeated field of dynamically typed values. - repeated Value values = 1; -} diff --git a/settings/third_party/google/rpc/code.proto b/settings/third_party/google/rpc/code.proto deleted file mode 100644 index 8fef41170..000000000 --- a/settings/third_party/google/rpc/code.proto +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.rpc; - -option go_package = "google.golang.org/genproto/googleapis/rpc/code;code"; -option java_multiple_files = true; -option java_outer_classname = "CodeProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - - -// The canonical error codes for Google APIs. -// -// -// Sometimes multiple error codes may apply. Services should return -// the most specific error code that applies. For example, prefer -// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. -// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. -enum Code { - // Not an error; returned on success - // - // HTTP Mapping: 200 OK - OK = 0; - - // The operation was cancelled, typically by the caller. - // - // HTTP Mapping: 499 Client Closed Request - CANCELLED = 1; - - // Unknown error. For example, this error may be returned when - // a `Status` value received from another address space belongs to - // an error space that is not known in this address space. Also - // errors raised by APIs that do not return enough error information - // may be converted to this error. - // - // HTTP Mapping: 500 Internal Server Error - UNKNOWN = 2; - - // The client specified an invalid argument. Note that this differs - // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments - // that are problematic regardless of the state of the system - // (e.g., a malformed file name). - // - // HTTP Mapping: 400 Bad Request - INVALID_ARGUMENT = 3; - - // The deadline expired before the operation could complete. For operations - // that change the state of the system, this error may be returned - // even if the operation has completed successfully. For example, a - // successful response from a server could have been delayed long - // enough for the deadline to expire. - // - // HTTP Mapping: 504 Gateway Timeout - DEADLINE_EXCEEDED = 4; - - // Some requested entity (e.g., file or directory) was not found. - // - // Note to server developers: if a request is denied for an entire class - // of users, such as gradual feature rollout or undocumented whitelist, - // `NOT_FOUND` may be used. If a request is denied for some users within - // a class of users, such as user-based access control, `PERMISSION_DENIED` - // must be used. - // - // HTTP Mapping: 404 Not Found - NOT_FOUND = 5; - - // The entity that a client attempted to create (e.g., file or directory) - // already exists. - // - // HTTP Mapping: 409 Conflict - ALREADY_EXISTS = 6; - - // The caller does not have permission to execute the specified - // operation. `PERMISSION_DENIED` must not be used for rejections - // caused by exhausting some resource (use `RESOURCE_EXHAUSTED` - // instead for those errors). `PERMISSION_DENIED` must not be - // used if the caller can not be identified (use `UNAUTHENTICATED` - // instead for those errors). This error code does not imply the - // request is valid or the requested entity exists or satisfies - // other pre-conditions. - // - // HTTP Mapping: 403 Forbidden - PERMISSION_DENIED = 7; - - // The request does not have valid authentication credentials for the - // operation. - // - // HTTP Mapping: 401 Unauthorized - UNAUTHENTICATED = 16; - - // Some resource has been exhausted, perhaps a per-user quota, or - // perhaps the entire file system is out of space. - // - // HTTP Mapping: 429 Too Many Requests - RESOURCE_EXHAUSTED = 8; - - // The operation was rejected because the system is not in a state - // required for the operation's execution. For example, the directory - // to be deleted is non-empty, an rmdir operation is applied to - // a non-directory, etc. - // - // Service implementors can use the following guidelines to decide - // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: - // (a) Use `UNAVAILABLE` if the client can retry just the failing call. - // (b) Use `ABORTED` if the client should retry at a higher level - // (e.g., when a client-specified test-and-set fails, indicating the - // client should restart a read-modify-write sequence). - // (c) Use `FAILED_PRECONDITION` if the client should not retry until - // the system state has been explicitly fixed. E.g., if an "rmdir" - // fails because the directory is non-empty, `FAILED_PRECONDITION` - // should be returned since the client should not retry unless - // the files are deleted from the directory. - // - // HTTP Mapping: 400 Bad Request - FAILED_PRECONDITION = 9; - - // The operation was aborted, typically due to a concurrency issue such as - // a sequencer check failure or transaction abort. - // - // See the guidelines above for deciding between `FAILED_PRECONDITION`, - // `ABORTED`, and `UNAVAILABLE`. - // - // HTTP Mapping: 409 Conflict - ABORTED = 10; - - // The operation was attempted past the valid range. E.g., seeking or - // reading past end-of-file. - // - // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may - // be fixed if the system state changes. For example, a 32-bit file - // system will generate `INVALID_ARGUMENT` if asked to read at an - // offset that is not in the range [0,2^32-1], but it will generate - // `OUT_OF_RANGE` if asked to read from an offset past the current - // file size. - // - // There is a fair bit of overlap between `FAILED_PRECONDITION` and - // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific - // error) when it applies so that callers who are iterating through - // a space can easily look for an `OUT_OF_RANGE` error to detect when - // they are done. - // - // HTTP Mapping: 400 Bad Request - OUT_OF_RANGE = 11; - - // The operation is not implemented or is not supported/enabled in this - // service. - // - // HTTP Mapping: 501 Not Implemented - UNIMPLEMENTED = 12; - - // Internal errors. This means that some invariants expected by the - // underlying system have been broken. This error code is reserved - // for serious errors. - // - // HTTP Mapping: 500 Internal Server Error - INTERNAL = 13; - - // The service is currently unavailable. This is most likely a - // transient condition, which can be corrected by retrying with - // a backoff. - // - // See the guidelines above for deciding between `FAILED_PRECONDITION`, - // `ABORTED`, and `UNAVAILABLE`. - // - // HTTP Mapping: 503 Service Unavailable - UNAVAILABLE = 14; - - // Unrecoverable data loss or corruption. - // - // HTTP Mapping: 500 Internal Server Error - DATA_LOSS = 15; -} diff --git a/settings/third_party/google/rpc/error_details.proto b/settings/third_party/google/rpc/error_details.proto deleted file mode 100644 index f24ae0099..000000000 --- a/settings/third_party/google/rpc/error_details.proto +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.rpc; - -import "google/protobuf/duration.proto"; - -option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails"; -option java_multiple_files = true; -option java_outer_classname = "ErrorDetailsProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - - -// Describes when the clients can retry a failed request. Clients could ignore -// the recommendation here or retry when this information is missing from error -// responses. -// -// It's always recommended that clients should use exponential backoff when -// retrying. -// -// Clients should wait until `retry_delay` amount of time has passed since -// receiving the error response before retrying. If retrying requests also -// fail, clients should use an exponential backoff scheme to gradually increase -// the delay between retries based on `retry_delay`, until either a maximum -// number of retires have been reached or a maximum retry delay cap has been -// reached. -message RetryInfo { - // Clients should wait at least this long between retrying the same request. - google.protobuf.Duration retry_delay = 1; -} - -// Describes additional debugging info. -message DebugInfo { - // The stack trace entries indicating where the error occurred. - repeated string stack_entries = 1; - - // Additional debugging information provided by the server. - string detail = 2; -} - -// Describes how a quota check failed. -// -// For example if a daily limit was exceeded for the calling project, -// a service could respond with a QuotaFailure detail containing the project -// id and the description of the quota limit that was exceeded. If the -// calling project hasn't enabled the service in the developer console, then -// a service could respond with the project id and set `service_disabled` -// to true. -// -// Also see RetryDetail and Help types for other details about handling a -// quota failure. -message QuotaFailure { - // A message type used to describe a single quota violation. For example, a - // daily quota or a custom quota that was exceeded. - message Violation { - // The subject on which the quota check failed. - // For example, "clientip:" or "project:". - string subject = 1; - - // A description of how the quota check failed. Clients can use this - // description to find more about the quota configuration in the service's - // public documentation, or find the relevant quota limit to adjust through - // developer console. - // - // For example: "Service disabled" or "Daily Limit for read operations - // exceeded". - string description = 2; - } - - // Describes all quota violations. - repeated Violation violations = 1; -} - -// Describes what preconditions have failed. -// -// For example, if an RPC failed because it required the Terms of Service to be -// acknowledged, it could list the terms of service violation in the -// PreconditionFailure message. -message PreconditionFailure { - // A message type used to describe a single precondition failure. - message Violation { - // The type of PreconditionFailure. We recommend using a service-specific - // enum type to define the supported precondition violation types. For - // example, "TOS" for "Terms of Service violation". - string type = 1; - - // The subject, relative to the type, that failed. - // For example, "google.com/cloud" relative to the "TOS" type would - // indicate which terms of service is being referenced. - string subject = 2; - - // A description of how the precondition failed. Developers can use this - // description to understand how to fix the failure. - // - // For example: "Terms of service not accepted". - string description = 3; - } - - // Describes all precondition violations. - repeated Violation violations = 1; -} - -// Describes violations in a client request. This error type focuses on the -// syntactic aspects of the request. -message BadRequest { - // A message type used to describe a single bad request field. - message FieldViolation { - // A path leading to a field in the request body. The value will be a - // sequence of dot-separated identifiers that identify a protocol buffer - // field. E.g., "field_violations.field" would identify this field. - string field = 1; - - // A description of why the request element is bad. - string description = 2; - } - - // Describes all violations in a client request. - repeated FieldViolation field_violations = 1; -} - -// Contains metadata about the request that clients can attach when filing a bug -// or providing other forms of feedback. -message RequestInfo { - // An opaque string that should only be interpreted by the service generating - // it. For example, it can be used to identify requests in the service's logs. - string request_id = 1; - - // Any data that was used to serve this request. For example, an encrypted - // stack trace that can be sent back to the service provider for debugging. - string serving_data = 2; -} - -// Describes the resource that is being accessed. -message ResourceInfo { - // A name for the type of resource being accessed, e.g. "sql table", - // "cloud storage bucket", "file", "Google calendar"; or the type URL - // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". - string resource_type = 1; - - // The name of the resource being accessed. For example, a shared calendar - // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current - // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. - string resource_name = 2; - - // The owner of the resource (optional). - // For example, "user:" or "project:". - string owner = 3; - - // Describes what error is encountered when accessing this resource. - // For example, updating a cloud project may require the `writer` permission - // on the developer console project. - string description = 4; -} - -// Provides links to documentation or for performing an out of band action. -// -// For example, if a quota check failed with an error indicating the calling -// project hasn't enabled the accessed service, this can contain a URL pointing -// directly to the right place in the developer console to flip the bit. -message Help { - // Describes a URL link. - message Link { - // Describes what the link offers. - string description = 1; - - // The URL of the link. - string url = 2; - } - - // URL(s) pointing to additional information on handling the current error. - repeated Link links = 1; -} - -// Provides a localized error message that is safe to return to the user -// which can be attached to an RPC error. -message LocalizedMessage { - // The locale used following the specification defined at - // http://www.rfc-editor.org/rfc/bcp/bcp47.txt. - // Examples are: "en-US", "fr-CH", "es-MX" - string locale = 1; - - // The localized error message in the above locale. - string message = 2; -} diff --git a/settings/third_party/google/rpc/status.proto b/settings/third_party/google/rpc/status.proto deleted file mode 100644 index 0839ee966..000000000 --- a/settings/third_party/google/rpc/status.proto +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2017 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.rpc; - -import "google/protobuf/any.proto"; - -option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; -option java_multiple_files = true; -option java_outer_classname = "StatusProto"; -option java_package = "com.google.rpc"; -option objc_class_prefix = "RPC"; - - -// The `Status` type defines a logical error model that is suitable for different -// programming environments, including REST APIs and RPC APIs. It is used by -// [gRPC](https://github.com/grpc). The error model is designed to be: -// -// - Simple to use and understand for most users -// - Flexible enough to meet unexpected needs -// -// # Overview -// -// The `Status` message contains three pieces of data: error code, error message, -// and error details. The error code should be an enum value of -// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The -// error message should be a developer-facing English message that helps -// developers *understand* and *resolve* the error. If a localized user-facing -// error message is needed, put the localized message in the error details or -// localize it in the client. The optional error details may contain arbitrary -// information about the error. There is a predefined set of error detail types -// in the package `google.rpc` that can be used for common error conditions. -// -// # Language mapping -// -// The `Status` message is the logical representation of the error model, but it -// is not necessarily the actual wire format. When the `Status` message is -// exposed in different client libraries and different wire protocols, it can be -// mapped differently. For example, it will likely be mapped to some exceptions -// in Java, but more likely mapped to some error codes in C. -// -// # Other uses -// -// The error model and the `Status` message can be used in a variety of -// environments, either with or without APIs, to provide a -// consistent developer experience across different environments. -// -// Example uses of this error model include: -// -// - Partial errors. If a service needs to return partial errors to the client, -// it may embed the `Status` in the normal response to indicate the partial -// errors. -// -// - Workflow errors. A typical workflow has multiple steps. Each step may -// have a `Status` message for error reporting. -// -// - Batch operations. If a client uses batch request and batch response, the -// `Status` message should be used directly inside batch response, one for -// each error sub-response. -// -// - Asynchronous operations. If an API call embeds asynchronous operation -// results in its response, the status of those operations should be -// represented directly using the `Status` message. -// -// - Logging. If some API errors are stored in logs, the message `Status` could -// be used directly after any stripping needed for security/privacy reasons. -message Status { - // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. - int32 code = 1; - - // A developer-facing error message, which should be in English. Any - // user-facing error message should be localized and sent in the - // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. - string message = 2; - - // A list of messages that carry the error details. There is a common set of - // message types for APIs to use. - repeated google.protobuf.Any details = 3; -} diff --git a/settings/third_party/protoc-gen-swagger/options/annotations.proto b/settings/third_party/protoc-gen-swagger/options/annotations.proto deleted file mode 100644 index 5151fd5a6..000000000 --- a/settings/third_party/protoc-gen-swagger/options/annotations.proto +++ /dev/null @@ -1,44 +0,0 @@ -syntax = "proto3"; - -package grpc.gateway.protoc_gen_swagger.options; - -option go_package = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"; - -import "google/protobuf/descriptor.proto"; -import "protoc-gen-swagger/options/openapiv2.proto"; - -extend google.protobuf.FileOptions { - // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - Swagger openapiv2_swagger = 1042; -} -extend google.protobuf.MethodOptions { - // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - Operation openapiv2_operation = 1042; -} -extend google.protobuf.MessageOptions { - // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - Schema openapiv2_schema = 1042; -} -extend google.protobuf.ServiceOptions { - // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - Tag openapiv2_tag = 1042; -} -extend google.protobuf.FieldOptions { - // ID assigned by protobuf-global-extension-registry@google.com for grpc-gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - JSONSchema openapiv2_field = 1042; -} diff --git a/settings/third_party/protoc-gen-swagger/options/openapiv2.proto b/settings/third_party/protoc-gen-swagger/options/openapiv2.proto deleted file mode 100644 index 83cb564fa..000000000 --- a/settings/third_party/protoc-gen-swagger/options/openapiv2.proto +++ /dev/null @@ -1,379 +0,0 @@ -syntax = "proto3"; - -package grpc.gateway.protoc_gen_swagger.options; - -option go_package = "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options"; - -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; - -// `Swagger` is a representation of OpenAPI v2 specification's Swagger object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject -// -// TODO(ivucica): document fields -message Swagger { - string swagger = 1; - Info info = 2; - string host = 3; - // `base_path` is the common prefix path used on all API endpoints (ie. /api, /v1, etc.). By adding this, - // it allows you to remove this portion from the path endpoints in your Swagger file making them easier - // to read. Note that using `base_path` does not change the endpoint paths that are generated in the resulting - // Swagger file. If you wish to use `base_path` with relatively generated Swagger paths, the - // `base_path` prefix must be manually removed from your `google.api.http` paths and your code changed to - // serve the API from the `base_path`. - string base_path = 4; - enum SwaggerScheme { - UNKNOWN = 0; - HTTP = 1; - HTTPS = 2; - WS = 3; - WSS = 4; - } - repeated SwaggerScheme schemes = 5; - repeated string consumes = 6; - repeated string produces = 7; - // field 8 is reserved for 'paths'. - reserved 8; - // field 9 is reserved for 'definitions', which at this time are already - // exposed as and customizable as proto messages. - reserved 9; - map responses = 10; - SecurityDefinitions security_definitions = 11; - repeated SecurityRequirement security = 12; - // field 13 is reserved for 'tags', which are supposed to be exposed as and - // customizable as proto services. TODO(ivucica): add processing of proto - // service objects into OpenAPI v2 Tag objects. - reserved 13; - ExternalDocumentation external_docs = 14; - map extensions = 15; -} - -// `Operation` is a representation of OpenAPI v2 specification's Operation object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject -// -// TODO(ivucica): document fields -message Operation { - repeated string tags = 1; - string summary = 2; - string description = 3; - ExternalDocumentation external_docs = 4; - string operation_id = 5; - repeated string consumes = 6; - repeated string produces = 7; - // field 8 is reserved for 'parameters'. - reserved 8; - map responses = 9; - repeated string schemes = 10; - bool deprecated = 11; - repeated SecurityRequirement security = 12; - map extensions = 13; -} - -// `Response` is a representation of OpenAPI v2 specification's Response object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject -// -message Response { - // `Description` is a short description of the response. - // GFM syntax can be used for rich text representation. - string description = 1; - // `Schema` optionally defines the structure of the response. - // If `Schema` is not provided, it means there is no content to the response. - Schema schema = 2; - // field 3 is reserved for 'headers'. - reserved 3; - // field 3 is reserved for 'example'. - reserved 4; - map extensions = 5; -} - -// `Info` is a representation of OpenAPI v2 specification's Info object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject -// -// TODO(ivucica): document fields -message Info { - string title = 1; - string description = 2; - string terms_of_service = 3; - Contact contact = 4; - License license = 5; - string version = 6; - map extensions = 7; -} - -// `Contact` is a representation of OpenAPI v2 specification's Contact object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject -// -// TODO(ivucica): document fields -message Contact { - string name = 1; - string url = 2; - string email = 3; -} - -// `License` is a representation of OpenAPI v2 specification's License object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject -// -message License { - // Required. The license name used for the API. - string name = 1; - // A URL to the license used for the API. - string url = 2; -} - -// `ExternalDocumentation` is a representation of OpenAPI v2 specification's -// ExternalDocumentation object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject -// -// TODO(ivucica): document fields -message ExternalDocumentation { - string description = 1; - string url = 2; -} - -// `Schema` is a representation of OpenAPI v2 specification's Schema object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject -// -// TODO(ivucica): document fields -message Schema { - JSONSchema json_schema = 1; - string discriminator = 2; - bool read_only = 3; - // field 4 is reserved for 'xml'. - reserved 4; - ExternalDocumentation external_docs = 5; - google.protobuf.Any example = 6; -} - -// `JSONSchema` represents properties from JSON Schema taken, and as used, in -// the OpenAPI v2 spec. -// -// This includes changes made by OpenAPI v2. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject -// -// See also: https://cswr.github.io/JsonSchema/spec/basic_types/, -// https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json -// -// TODO(ivucica): document fields -message JSONSchema { - // field 1 is reserved for '$id', omitted from OpenAPI v2. - reserved 1; - // field 2 is reserved for '$schema', omitted from OpenAPI v2. - reserved 2; - // Ref is used to define an external reference to include in the message. - // This could be a fully qualified proto message reference, and that type must be imported - // into the protofile. If no message is identified, the Ref will be used verbatim in - // the output. - // For example: - // `ref: ".google.protobuf.Timestamp"`. - string ref = 3; - // field 4 is reserved for '$comment', omitted from OpenAPI v2. - reserved 4; - string title = 5; - string description = 6; - string default = 7; - bool read_only = 8; - // field 9 is reserved for 'examples', which is omitted from OpenAPI v2 in favor of 'example' field. - reserved 9; - double multiple_of = 10; - double maximum = 11; - bool exclusive_maximum = 12; - double minimum = 13; - bool exclusive_minimum = 14; - uint64 max_length = 15; - uint64 min_length = 16; - string pattern = 17; - // field 18 is reserved for 'additionalItems', omitted from OpenAPI v2. - reserved 18; - // field 19 is reserved for 'items', but in OpenAPI-specific way. TODO(ivucica): add 'items'? - reserved 19; - uint64 max_items = 20; - uint64 min_items = 21; - bool unique_items = 22; - // field 23 is reserved for 'contains', omitted from OpenAPI v2. - reserved 23; - uint64 max_properties = 24; - uint64 min_properties = 25; - repeated string required = 26; - // field 27 is reserved for 'additionalProperties', but in OpenAPI-specific way. TODO(ivucica): add 'additionalProperties'? - reserved 27; - // field 28 is reserved for 'definitions', omitted from OpenAPI v2. - reserved 28; - // field 29 is reserved for 'properties', but in OpenAPI-specific way. TODO(ivucica): add 'additionalProperties'? - reserved 29; - // following fields are reserved, as the properties have been omitted from OpenAPI v2: - // patternProperties, dependencies, propertyNames, const - reserved 30 to 33; - // Items in 'array' must be unique. - repeated string array = 34; - - enum JSONSchemaSimpleTypes { - UNKNOWN = 0; - ARRAY = 1; - BOOLEAN = 2; - INTEGER = 3; - NULL = 4; - NUMBER = 5; - OBJECT = 6; - STRING = 7; - } - - repeated JSONSchemaSimpleTypes type = 35; - // following fields are reserved, as the properties have been omitted from OpenAPI v2: - // format, contentMediaType, contentEncoding, if, then, else - reserved 36 to 41; - // field 42 is reserved for 'allOf', but in OpenAPI-specific way. TODO(ivucica): add 'allOf'? - reserved 42; - // following fields are reserved, as the properties have been omitted from OpenAPI v2: - // anyOf, oneOf, not - reserved 43 to 45; -} - -// `Tag` is a representation of OpenAPI v2 specification's Tag object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject -// -// TODO(ivucica): document fields -message Tag { - // field 1 is reserved for 'name'. In our generator, this is (to be) extracted - // from the name of proto service, and thus not exposed to the user, as - // changing tag object's name would break the link to the references to the - // tag in individual operation specifications. - // - // TODO(ivucica): Add 'name' property. Use it to allow override of the name of - // global Tag object, then use that name to reference the tag throughout the - // Swagger file. - reserved 1; - // TODO(ivucica): Description should be extracted from comments on the proto - // service object. - string description = 2; - ExternalDocumentation external_docs = 3; -} - -// `SecurityDefinitions` is a representation of OpenAPI v2 specification's -// Security Definitions object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject -// -// A declaration of the security schemes available to be used in the -// specification. This does not enforce the security schemes on the operations -// and only serves to provide the relevant details for each scheme. -message SecurityDefinitions { - // A single security scheme definition, mapping a "name" to the scheme it defines. - map security = 1; -} - -// `SecurityScheme` is a representation of OpenAPI v2 specification's -// Security Scheme object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject -// -// Allows the definition of a security scheme that can be used by the -// operations. Supported schemes are basic authentication, an API key (either as -// a header or as a query parameter) and OAuth2's common flows (implicit, -// password, application and access code). -message SecurityScheme { - // Required. The type of the security scheme. Valid values are "basic", - // "apiKey" or "oauth2". - enum Type { - TYPE_INVALID = 0; - TYPE_BASIC = 1; - TYPE_API_KEY = 2; - TYPE_OAUTH2 = 3; - } - - // Required. The location of the API key. Valid values are "query" or "header". - enum In { - IN_INVALID = 0; - IN_QUERY = 1; - IN_HEADER = 2; - } - - // Required. The flow used by the OAuth2 security scheme. Valid values are - // "implicit", "password", "application" or "accessCode". - enum Flow { - FLOW_INVALID = 0; - FLOW_IMPLICIT = 1; - FLOW_PASSWORD = 2; - FLOW_APPLICATION = 3; - FLOW_ACCESS_CODE = 4; - } - - // Required. The type of the security scheme. Valid values are "basic", - // "apiKey" or "oauth2". - Type type = 1; - // A short description for security scheme. - string description = 2; - // Required. The name of the header or query parameter to be used. - // - // Valid for apiKey. - string name = 3; - // Required. The location of the API key. Valid values are "query" or "header". - // - // Valid for apiKey. - In in = 4; - // Required. The flow used by the OAuth2 security scheme. Valid values are - // "implicit", "password", "application" or "accessCode". - // - // Valid for oauth2. - Flow flow = 5; - // Required. The authorization URL to be used for this flow. This SHOULD be in - // the form of a URL. - // - // Valid for oauth2/implicit and oauth2/accessCode. - string authorization_url = 6; - // Required. The token URL to be used for this flow. This SHOULD be in the - // form of a URL. - // - // Valid for oauth2/password, oauth2/application and oauth2/accessCode. - string token_url = 7; - // Required. The available scopes for the OAuth2 security scheme. - // - // Valid for oauth2. - Scopes scopes = 8; - map extensions = 9; -} - -// `SecurityRequirement` is a representation of OpenAPI v2 specification's -// Security Requirement object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject -// -// Lists the required security schemes to execute this operation. The object can -// have multiple security schemes declared in it which are all required (that -// is, there is a logical AND between the schemes). -// -// The name used for each property MUST correspond to a security scheme -// declared in the Security Definitions. -message SecurityRequirement { - // If the security scheme is of type "oauth2", then the value is a list of - // scope names required for the execution. For other security scheme types, - // the array MUST be empty. - message SecurityRequirementValue { - repeated string scope = 1; - } - // Each name must correspond to a security scheme which is declared in - // the Security Definitions. If the security scheme is of type "oauth2", - // then the value is a list of scope names required for the execution. - // For other security scheme types, the array MUST be empty. - map security_requirement = 1; -} - -// `Scopes` is a representation of OpenAPI v2 specification's Scopes object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject -// -// Lists the available scopes for an OAuth2 security scheme. -message Scopes { - // Maps between a name of a scope to a short description of it (as the value - // of the property). - map scope = 1; -} diff --git a/storage/Makefile b/storage/Makefile index eb5e2a08f..22328aa26 100644 --- a/storage/Makefile +++ b/storage/Makefile @@ -81,10 +81,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -141,10 +137,26 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check +.PHONY: watch +watch: + go run github.com/cespare/reflex -c reflex.conf + +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: config-docs-generate + .PHONY: config-docs-generate config-docs-generate: go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -.PHONY: watch -watch: - go run github.com/cespare/reflex -c reflex.conf +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: diff --git a/store/Makefile b/store/Makefile index e7c3bc867..e0669f472 100644 --- a/store/Makefile +++ b/store/Makefile @@ -3,6 +3,9 @@ NAME := store IMPORT := github.com/owncloud/ocis/$(NAME) BIN := bin DIST := dist +HUGO := hugo +PROTO_VERSION := v0 +PROTO_SRC := pkg/proto/$(PROTO_VERSION) ifeq ($(OS), Windows_NT) EXECUTABLE := $(NAME).exe @@ -24,6 +27,11 @@ GENERATE ?= $(PACKAGES) TAGS ?= +ifndef GOPATH + export GOPATH := $(shell go env GOPATH) +endif +export PATH := $(PATH):$(GOPATH)/bin + ifndef OUTPUT ifneq ($(DRONE_TAG),) OUTPUT ?= $(subst v,,$(DRONE_TAG)) @@ -80,10 +88,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -140,29 +144,95 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md - .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: config-docs-generate \ + grpc-docs-generate + +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md + +.PHONY: grpc-docs-generate +grpc-docs-generate: ../docs/extensions/${NAME}/grpc.md + +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: protobuf # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: + + +############ protobuf ############ $(GOPATH)/bin/protoc-gen-go: - GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go + GO111MODULE=off go get -v google.golang.org/protobuf/cmd/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro: - GO111MODULE=off go get -v github.com/micro/protoc-gen-micro + GO111MODULE=on go get -v github.com/micro/protoc-gen-micro/v2 -pkg/proto/v0/store.pb.go: pkg/proto/v0/store.proto - protoc \ - -I=pkg/proto/v0/ \ - --go_out=pkg/proto/v0 store.proto +$(GOPATH)/bin/protoc-gen-microweb: + GO111MODULE=off go get -v github.com/owncloud/protoc-gen-microweb -pkg/proto/v0/store.pb.micro.go: pkg/proto/v0/store.proto +$(GOPATH)/bin/protoc-gen-openapiv2: + GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 + +$(GOPATH)/bin/protoc-gen-doc: + GO111MODULE=off go get -v github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc + +.PHONY: $(PROTO_SRC)/${NAME}.pb.go +$(PROTO_SRC)/${NAME}.pb.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-go protoc \ - -I=pkg/proto/v0/ \ - --micro_out=pkg/proto/v0 store.proto + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --go_out=. ${NAME}.proto + +.PHONY: $(PROTO_SRC)/${NAME}.pb.micro.go +$(PROTO_SRC)/${NAME}.pb.micro.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-micro + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --micro_out=. ${NAME}.proto + +.PHONY: $(PROTO_SRC)/${NAME}.pb.web.go +$(PROTO_SRC)/${NAME}.pb.web.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-microweb + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --microweb_out=. ${NAME}.proto + +.PHONY: $(PROTO_SRC)/${NAME}.swagger.json +$(PROTO_SRC)/${NAME}.swagger.json: $(GOPATH)/bin/protoc-gen-openapiv2 + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --openapiv2_out=$(PROTO_SRC)/ ${NAME}.proto + +.PHONY: ../docs/extensions/${NAME}/grpc.md +../docs/extensions/${NAME}/grpc.md: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-doc + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --doc_opt=./templates/GRPC.tmpl,grpc.md \ + --doc_out=../docs/extensions/${NAME} $(PROTO_SRC)/${NAME}.proto .PHONY: protobuf -protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro pkg/proto/v0/store.pb.go pkg/proto/v0/store.pb.micro.go +protobuf: $(PROTO_SRC)/${NAME}.pb.go \ + $(PROTO_SRC)/${NAME}.pb.micro.go \ + $(PROTO_SRC)/${NAME}.swagger.json \ + ../docs/extensions/${NAME}/grpc.md + #$(PROTO_SRC)/${NAME}.pb.web.go \ # not needed for store diff --git a/store/pkg/proto/v0/store.proto b/store/pkg/proto/v0/store.proto index 5dfde7a37..d40c20bf5 100644 --- a/store/pkg/proto/v0/store.proto +++ b/store/pkg/proto/v0/store.proto @@ -1,6 +1,34 @@ syntax = "proto3"; -package proto; +option go_package = "pkg/proto/v0;proto"; + +package store; + +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "ownCloud Infinite Scale store"; + version: "1.0.0"; + contact: { + name: "ownCloud GmbH"; + url: "https://github.com/owncloud/ocis"; + email: "support@owncloud.com"; + }; + license: { + name: "Apache-2.0"; + url: "https://github.com/owncloud/ocis/blob/master/LICENSE"; + }; + }; + schemes: HTTP; + schemes: HTTPS; + consumes: "application/json"; + produces: "application/json"; + external_docs: { + description: "Developer Manual"; + url: "https://owncloud.github.io/extensions/store/"; + }; +}; service Store { rpc Read(ReadRequest) returns (ReadResponse) {}; diff --git a/store/templates/GRPC.tmpl b/store/templates/GRPC.tmpl new file mode 100644 index 000000000..545ab202d --- /dev/null +++ b/store/templates/GRPC.tmpl @@ -0,0 +1,75 @@ +--- +title: "GRPC API" +date: 2018-05-02T00:00:00+00:00 +weight: 50 +geekdocRepo: https://github.com/owncloud/ocis-thumbnails +geekdocEditPath: edit/master/docs +geekdocFilePath: grpc.md +--- + +{{`{{< toc >}}`}} + +{{ range .Files -}} +## {{ .Name }} + +{{ .Description }} +{{- range .Messages -}} +{{- /* remove newline */}}### {{ .LongName }} + +{{ .Description }} + +{{ if .HasFields -}} +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +{{ range .Fields -}} +| {{.Name}} | [{{.LongType}}](#{{.LongType | lower | replace "." "" }}) | {{.Label}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end }} | +{{ end -}} +{{ end }} +{{ if .HasExtensions -}} +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +{{ range .Extensions -}} +| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | +{{ end -}} +{{ end -}} +{{ end -}} +{{- range .Enums -}} +### {{ .LongName }} + +{{ .Description }} + +| Name | Number | Description | +| ---- | ------ | ----------- | +{{range .Values -}} +| {{.Name}} | {{.Number}} | {{nobr .Description}} | +{{ end -}} +{{ end -}} + +{{ if .HasExtensions }} + +### File-level Extensions +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +{{ range .Extensions -}} +| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} | +{{ end -}} +{{ end -}} +{{- range .Services }} +### {{ .Name }} + +{{ .Description }} + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +{{ range .Methods -}} +| {{.Name}} | [{{.RequestLongType}}](#{{.RequestLongType | lower | replace "." "" }}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}](#{{.ResponseLongType | lower | replace "." "" }}){{if .ResponseStreaming}} stream{{end}} | {{nobr .Description}} | +{{ end -}} +{{ end -}} +{{ end }} +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | +| ----------- | ----- | --- | ---- | +{{ range .Scalars -}} +| {{`{{< div id="`}}{{.ProtoType}}{{`" content="`}}{{.ProtoType}}{{`" >}}`}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | +{{ end }} \ No newline at end of file diff --git a/accounts/third_party/google/api/annotations.proto b/third_party/google/api/annotations.proto similarity index 100% rename from accounts/third_party/google/api/annotations.proto rename to third_party/google/api/annotations.proto diff --git a/accounts/third_party/google/api/field_behavior.proto b/third_party/google/api/field_behavior.proto similarity index 100% rename from accounts/third_party/google/api/field_behavior.proto rename to third_party/google/api/field_behavior.proto diff --git a/accounts/third_party/google/api/http.proto b/third_party/google/api/http.proto similarity index 100% rename from accounts/third_party/google/api/http.proto rename to third_party/google/api/http.proto diff --git a/accounts/third_party/google/protobuf/descriptor.proto b/third_party/google/protobuf/descriptor.proto similarity index 100% rename from accounts/third_party/google/protobuf/descriptor.proto rename to third_party/google/protobuf/descriptor.proto diff --git a/accounts/third_party/google/protobuf/empty.proto b/third_party/google/protobuf/empty.proto similarity index 100% rename from accounts/third_party/google/protobuf/empty.proto rename to third_party/google/protobuf/empty.proto diff --git a/accounts/third_party/google/protobuf/field_mask.proto b/third_party/google/protobuf/field_mask.proto similarity index 100% rename from accounts/third_party/google/protobuf/field_mask.proto rename to third_party/google/protobuf/field_mask.proto diff --git a/accounts/third_party/google/protobuf/timestamp.proto b/third_party/google/protobuf/timestamp.proto similarity index 100% rename from accounts/third_party/google/protobuf/timestamp.proto rename to third_party/google/protobuf/timestamp.proto diff --git a/thumbnails/Makefile b/thumbnails/Makefile index 5c511015d..87eb9ebb2 100644 --- a/thumbnails/Makefile +++ b/thumbnails/Makefile @@ -3,8 +3,9 @@ NAME := thumbnails IMPORT := github.com/owncloud/ocis/$(NAME) BIN := bin DIST := dist +HUGO := hugo PROTO_VERSION := v0 -PROTO_SRC := pkg/proto/$(PROTO_VERSION)/*.proto +PROTO_SRC := pkg/proto/$(PROTO_VERSION) ifeq ($(OS), Windows_NT) EXECUTABLE := $(NAME).exe @@ -26,6 +27,11 @@ GENERATE ?= $(PACKAGES) TAGS ?= +ifndef GOPATH + export GOPATH := $(shell go env GOPATH) +endif +export PATH := $(PATH):$(GOPATH)/bin + ifndef OUTPUT ifneq ($(DRONE_TAG),) OUTPUT ?= $(subst v,,$(DRONE_TAG)) @@ -81,10 +87,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -141,19 +143,94 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: proto-docs-build -proto-docs-build: - go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc; \ - protoc --doc_out=./docs --doc_opt=./templates/grpc.tmpl,grpc.md $(PROTO_SRC) +.PHONY: watch +watch: + go run github.com/cespare/reflex -c reflex.conf + +############ docs generate ############ + +.PHONY: docs-generate +docs-generate: config-docs-generate \ + grpc-docs-generate .PHONY: config-docs-generate config-docs-generate: go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -.PHONY: watch -watch: - go run github.com/cespare/reflex -c reflex.conf +.PHONY: grpc-docs-generate +grpc-docs-generate: ../docs/extensions/${NAME}/grpc.md -.PHONY: pb -pb: - protoc --go_out=. --micro_out=. $(PROTO_SRC) +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate + +.PHONY: ci-go-generate +ci-go-generate: protobuf # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) + +.PHONY: ci-node-generate +ci-node-generate: + +############ protobuf ############ +$(GOPATH)/bin/protoc-gen-go: + GO111MODULE=off go get -v google.golang.org/protobuf/cmd/protoc-gen-go + +$(GOPATH)/bin/protoc-gen-micro: + GO111MODULE=on go get -v github.com/micro/protoc-gen-micro/v2 + +$(GOPATH)/bin/protoc-gen-microweb: + GO111MODULE=off go get -v github.com/owncloud/protoc-gen-microweb + +$(GOPATH)/bin/protoc-gen-openapiv2: + GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-openapiv2 + +$(GOPATH)/bin/protoc-gen-doc: + GO111MODULE=off go get -v github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc + +.PHONY: $(PROTO_SRC)/${NAME}.pb.go +$(PROTO_SRC)/${NAME}.pb.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-go + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --go_out=. ${NAME}.proto + +.PHONY: $(PROTO_SRC)/${NAME}.pb.micro.go +$(PROTO_SRC)/${NAME}.pb.micro.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-micro + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --micro_out=. ${NAME}.proto + +.PHONY: $(PROTO_SRC)/${NAME}.pb.web.go +$(PROTO_SRC)/${NAME}.pb.web.go: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-microweb + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --microweb_out=. ${NAME}.proto + +.PHONY: $(PROTO_SRC)/${NAME}.swagger.json +$(PROTO_SRC)/${NAME}.swagger.json: $(GOPATH)/bin/protoc-gen-openapiv2 + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --openapiv2_out=$(PROTO_SRC)/ ${NAME}.proto + +.PHONY: ../docs/extensions/${NAME}/grpc.md +../docs/extensions/${NAME}/grpc.md: $(GOPATH)/bin/protoc-gen-openapiv2 $(GOPATH)/bin/protoc-gen-doc + protoc \ + -I=../third_party/ \ + -I=$(PROTO_SRC)/ \ + -I=$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/ \ + --doc_opt=./templates/GRPC.tmpl,grpc.md \ + --doc_out=../docs/extensions/${NAME} $(PROTO_SRC)/${NAME}.proto + +.PHONY: protobuf +protobuf: $(PROTO_SRC)/${NAME}.pb.go \ + $(PROTO_SRC)/${NAME}.pb.micro.go \ + $(PROTO_SRC)/${NAME}.swagger.json \ + ../docs/extensions/${NAME}/grpc.md + #$(PROTO_SRC)/${NAME}.pb.web.go \ # not needed for thumbnails diff --git a/thumbnails/pkg/proto/v0/thumbnails.pb_test.go b/thumbnails/pkg/proto/v0/thumbnails.pb_test.go new file mode 100644 index 000000000..59a79ae93 --- /dev/null +++ b/thumbnails/pkg/proto/v0/thumbnails.pb_test.go @@ -0,0 +1,121 @@ +package proto_test + +import ( + "testing" + + "github.com/owncloud/ocis/thumbnails/pkg/proto/v0" + "github.com/stretchr/testify/assert" +) + +type TestRequest struct { + testDataName string + filepath string + filetype proto.GetRequest_FileType + etag string + width int32 + height int32 + authorization string + expected proto.GetRequest +} + +type TestResponse struct { + testDataName string + img []byte + mimetype string + expected proto.GetResponse +} + +func TestRequestString(t *testing.T) { + + var tests = []*TestRequest{ + { + "ASCII", + "Foo.jpg", + proto.GetRequest_JPG, + "33a64df551425fcc55e4d42a148795d9f25f89d4", + 24, + 24, + "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", + proto.GetRequest{ + Filepath: "Foo.jpg", + Filetype: proto.GetRequest_JPG, + Etag: "33a64df551425fcc55e4d42a148795d9f25f89d4", + Width: 24, + Height: 24, + Authorization: "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", + }, + }, + { + "UTF", + "मिलन.jpg", + proto.GetRequest_JPG, + "33a64df551425fcc55e4d42a148795d9f25f89d4", + 24, + 24, + "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", + proto.GetRequest{ + Filepath: "\340\244\256\340\244\277\340\244\262\340\244\250.jpg", + Filetype: proto.GetRequest_JPG, + Etag: "33a64df551425fcc55e4d42a148795d9f25f89d4", + Width: 24, + Height: 24, + Authorization: "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", + }, + }, + { + "PNG", + "Foo.png", + proto.GetRequest_PNG, + "33a64df551425fcc55e4d42a148795d9f25f89d4", + 24, + 24, + "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", + proto.GetRequest{ + Filepath: "Foo.png", + Etag: "33a64df551425fcc55e4d42a148795d9f25f89d4", + Width: 24, + Height: 24, + Authorization: "Basic SGVXaG9SZWFkc1RoaXM6SXNTdHVwaWQK", + }, + }, + } + + for _, testCase := range tests { + t.Run(testCase.testDataName, func(t *testing.T) { + req := proto.GetRequest{ + Filepath: testCase.filepath, + Filetype: testCase.filetype, + Etag: testCase.etag, + Height: testCase.height, + Width: testCase.width, + Authorization: testCase.authorization, + } + assert.Equal(t, testCase.expected.String(), req.String()) + }) + } +} + +func TestResponseString(t *testing.T) { + var tests = []*TestResponse{ + { + "ASCII", + []byte("image data"), + "image/png", + proto.GetResponse{ + Thumbnail: []byte("image data"), + Mimetype: "image/png", + }, + }, + } + + for _, testCase := range tests { + t.Run(testCase.testDataName, func(t *testing.T) { + response := proto.GetResponse{ + Thumbnail: testCase.img, + Mimetype: testCase.mimetype, + } + + assert.Equal(t, testCase.expected.String(), response.String()) + }) + } +} diff --git a/thumbnails/pkg/proto/v0/thumbnails.proto b/thumbnails/pkg/proto/v0/thumbnails.proto index 3573456ff..75a48fa73 100644 --- a/thumbnails/pkg/proto/v0/thumbnails.proto +++ b/thumbnails/pkg/proto/v0/thumbnails.proto @@ -1,7 +1,34 @@ syntax = "proto3"; +option go_package = "pkg/proto/v0;proto"; + package com.owncloud.ocis.thumbnails.v0; -option go_package = "proto"; + +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "ownCloud Infinite Scale thumbnails"; + version: "1.0.0"; + contact: { + name: "ownCloud GmbH"; + url: "https://github.com/owncloud/ocis"; + email: "support@owncloud.com"; + }; + license: { + name: "Apache-2.0"; + url: "https://github.com/owncloud/ocis/blob/master/LICENSE"; + }; + }; + schemes: HTTP; + schemes: HTTPS; + consumes: "application/json"; + produces: "application/json"; + external_docs: { + description: "Developer Manual"; + url: "https://owncloud.github.io/extensions/thumbnails/"; + }; +}; // A Service for handling thumbnail generation service ThumbnailService { diff --git a/thumbnails/templates/GRPC.tmpl b/thumbnails/templates/GRPC.tmpl new file mode 100644 index 000000000..545ab202d --- /dev/null +++ b/thumbnails/templates/GRPC.tmpl @@ -0,0 +1,75 @@ +--- +title: "GRPC API" +date: 2018-05-02T00:00:00+00:00 +weight: 50 +geekdocRepo: https://github.com/owncloud/ocis-thumbnails +geekdocEditPath: edit/master/docs +geekdocFilePath: grpc.md +--- + +{{`{{< toc >}}`}} + +{{ range .Files -}} +## {{ .Name }} + +{{ .Description }} +{{- range .Messages -}} +{{- /* remove newline */}}### {{ .LongName }} + +{{ .Description }} + +{{ if .HasFields -}} +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +{{ range .Fields -}} +| {{.Name}} | [{{.LongType}}](#{{.LongType | lower | replace "." "" }}) | {{.Label}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end }} | +{{ end -}} +{{ end }} +{{ if .HasExtensions -}} +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +{{ range .Extensions -}} +| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | +{{ end -}} +{{ end -}} +{{ end -}} +{{- range .Enums -}} +### {{ .LongName }} + +{{ .Description }} + +| Name | Number | Description | +| ---- | ------ | ----------- | +{{range .Values -}} +| {{.Name}} | {{.Number}} | {{nobr .Description}} | +{{ end -}} +{{ end -}} + +{{ if .HasExtensions }} + +### File-level Extensions +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +{{ range .Extensions -}} +| {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} | +{{ end -}} +{{ end -}} +{{- range .Services }} +### {{ .Name }} + +{{ .Description }} + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +{{ range .Methods -}} +| {{.Name}} | [{{.RequestLongType}}](#{{.RequestLongType | lower | replace "." "" }}){{if .RequestStreaming}} stream{{end}} | [{{.ResponseLongType}}](#{{.ResponseLongType | lower | replace "." "" }}){{if .ResponseStreaming}} stream{{end}} | {{nobr .Description}} | +{{ end -}} +{{ end -}} +{{ end }} +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | +| ----------- | ----- | --- | ---- | +{{ range .Scalars -}} +| {{`{{< div id="`}}{{.ProtoType}}{{`" content="`}}{{.ProtoType}}{{`" >}}`}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | +{{ end }} \ No newline at end of file diff --git a/web/Makefile b/web/Makefile index c19e63b44..08bb1a437 100644 --- a/web/Makefile +++ b/web/Makefile @@ -80,10 +80,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: pull-assets - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -140,52 +136,29 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md - .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf -# $(GOPATH)/bin/protoc-gen-go: -# GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go +############ docs generate ############ -# $(GOPATH)/bin/protoc-gen-micro: -# GO111MODULE=off go get -v github.com/micro/protoc-gen-micro +.PHONY: docs-generate +docs-generate: config-docs-generate -# $(GOPATH)/bin/protoc-gen-microweb: -# GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -# $(GOPATH)/bin/protoc-gen-swagger: -# GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate -# pkg/proto/v0/example.pb.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --go_out=pkg/proto/v0 example.proto +.PHONY: ci-go-generate +ci-go-generate: pull-assets # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) -# pkg/proto/v0/example.pb.micro.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --micro_out=pkg/proto/v0 example.proto - -# pkg/proto/v0/example.pb.web.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --microweb_out=pkg/proto/v0 example.proto - -# pkg/proto/v0/example.swagger.json: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --swagger_out=pkg/proto/v0 example.proto - -# .PHONY: protobuf -# protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger pkg/proto/v0/example.pb.go pkg/proto/v0/example.pb.micro.go pkg/proto/v0/example.pb.web.go pkg/proto/v0/example.swagger.json +.PHONY: ci-node-generate +ci-node-generate: .PHONY: pull-assets pull-assets: diff --git a/webdav/Makefile b/webdav/Makefile index 0a7c637fe..4adaebff3 100644 --- a/webdav/Makefile +++ b/webdav/Makefile @@ -79,10 +79,6 @@ staticcheck: lint: for PKG in $(PACKAGES); do go run golang.org/x/lint/golint -set_exit_status $$PKG || exit 1; done; -.PHONY: generate -generate: - go generate $(GENERATE) - .PHONY: changelog changelog: go run github.com/restic/calens >| CHANGELOG.md @@ -139,49 +135,26 @@ release-check: .PHONY: release-finish release-finish: release-copy release-check -.PHONY: config-docs-generate -config-docs-generate: - go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md - .PHONY: watch watch: go run github.com/cespare/reflex -c reflex.conf -# $(GOPATH)/bin/protoc-gen-go: -# GO111MODULE=off go get -v github.com/golang/protobuf/protoc-gen-go +############ docs generate ############ -# $(GOPATH)/bin/protoc-gen-micro: -# GO111MODULE=off go get -v github.com/micro/protoc-gen-micro +.PHONY: docs-generate +docs-generate: config-docs-generate -# $(GOPATH)/bin/protoc-gen-microweb: -# GO111MODULE=off go get -v github.com/webhippie/protoc-gen-microweb +.PHONY: config-docs-generate +config-docs-generate: + go run github.com/owncloud/flaex >| ../docs/extensions/$(NAME)/configuration.md -# $(GOPATH)/bin/protoc-gen-swagger: -# GO111MODULE=off go get -v github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger +############ generate ############ +.PHONY: generate +generate: ci-node-generate ci-go-generate -# pkg/proto/v0/example.pb.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --go_out=logtostderr=true:pkg/proto/v0 example.proto +.PHONY: ci-go-generate +ci-go-generate: # CI runs ci-node-generate automatically before this target + go generate $(GENERATE) -# pkg/proto/v0/example.pb.micro.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --micro_out=logtostderr=true:pkg/proto/v0 example.proto - -# pkg/proto/v0/example.pb.web.go: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --microweb_out=logtostderr=true:pkg/proto/v0 example.proto - -# pkg/proto/v0/example.swagger.json: pkg/proto/v0/example.proto -# protoc \ -# -I=third_party/ \ -# -I=pkg/proto/v0/ \ -# --swagger_out=logtostderr=true:pkg/proto/v0 example.proto - -# .PHONY: protobuf -# protobuf: $(GOPATH)/bin/protoc-gen-go $(GOPATH)/bin/protoc-gen-micro $(GOPATH)/bin/protoc-gen-microweb $(GOPATH)/bin/protoc-gen-swagger pkg/proto/v0/example.pb.go pkg/proto/v0/example.pb.micro.go pkg/proto/v0/example.pb.web.go pkg/proto/v0/example.swagger.json +.PHONY: ci-node-generate +ci-node-generate: