Skip to content

Commit

Permalink
Merge pull request cockroachdb#8984 from tamird/ui-proto-not-weak
Browse files Browse the repository at this point in the history
*: remove use of `import weak`
  • Loading branch information
tamird authored Aug 31, 2016
2 parents 10a9430 + 2bd4a7d commit 5530d61
Show file tree
Hide file tree
Showing 84 changed files with 7,875 additions and 7,456 deletions.
42 changes: 20 additions & 22 deletions acceptance/cluster/testconfig.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion acceptance/cluster/testconfig.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ syntax = "proto2";
package cockroach.acceptance.cluster;
option go_package = "cluster";

import weak "gogoproto/gogo.proto";
import "gogoproto/gogo.proto";

// StoreConfig holds the configuration of a collection of similar stores.
message StoreConfig {
Expand Down
34 changes: 16 additions & 18 deletions build/info.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ syntax = "proto2";
package cockroach.build;
option go_package = "build";

import weak "gogoproto/gogo.proto";
import "gogoproto/gogo.proto";

// Info describes build information for this CockroachDB binary.
message Info {
Expand Down
23 changes: 8 additions & 15 deletions build/protobuf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ORG_ROOT := .
REPO_ROOT := $(ORG_ROOT)/cockroach
GITHUB_ROOT := $(ORG_ROOT)/..
GOGOPROTO_ROOT := $(GITHUB_ROOT)/gogo/protobuf
PROTOBUF_ROOT := $(GOGOPROTO_ROOT)/protobuf

NATIVE_ROOT := $(REPO_ROOT)/storage/engine/rocksdb

Expand All @@ -34,8 +35,6 @@ PROTOC := $(GOPATH_BIN)/protoc
PLUGIN_SUFFIX := gogoroach
PROTOC_PLUGIN := $(GOPATH_BIN)/protoc-gen-$(PLUGIN_SUFFIX)
GOGOPROTO_PROTO := $(GOGOPROTO_ROOT)/gogoproto/gogo.proto
GOGOPROTO_PATH := $(GOGOPROTO_ROOT):$(GOGOPROTO_ROOT)/protobuf
CPROTOBUF_PATH := $(ORG_ROOT)/c-protobuf/internal/src

COREOS_PATH := $(GITHUB_ROOT)/coreos

Expand All @@ -62,10 +61,6 @@ CPP_PROTOS := $(filter %/roachpb/metadata.proto %/roachpb/data.proto %/roachpb/i
CPP_HEADERS := $(subst ./,$(NATIVE_ROOT)/,$(CPP_PROTOS:%.proto=%.pb.h))
CPP_SOURCES := $(subst ./,$(NATIVE_ROOT)/,$(CPP_PROTOS:%.proto=%.pb.cc))

ENGINE_CPP_PROTOS := $(filter $(NATIVE_ROOT)%,$(GO_PROTOS))
ENGINE_CPP_HEADERS := $(ENGINE_CPP_PROTOS:%.proto=%.pb.h)
ENGINE_CPP_SOURCES := $(ENGINE_CPP_PROTOS:%.proto=%.pb.cc)

.PHONY: protos
protos: $(GO_SOURCES) $(UI_SOURCES) $(CPP_HEADERS) $(CPP_SOURCES) $(ENGINE_CPP_HEADERS) $(ENGINE_CPP_SOURCES) $(GW_SOURCES)

Expand All @@ -75,24 +70,25 @@ IMPORT_PREFIX := github.com/$(REPO_NAME)/
$(GO_SOURCES): $(PROTOC) $(GO_PROTOS) $(GOGOPROTO_PROTO)
(cd $(REPO_ROOT) && git ls-files --exclude-standard --cached --others -- '*.pb.go' | xargs rm -f)
for dir in $(sort $(dir $(GO_PROTOS))); do \
$(PROTOC) -I.:$(GOGOPROTO_PATH):$(COREOS_PATH):$(GRPC_GATEWAY_GOOGLEAPIS_PATH):$(CPROTOBUF_PATH) --plugin=$(PROTOC_PLUGIN) --$(PLUGIN_SUFFIX)_out=$(GRPC_GATEWAY_MAPPING),plugins=grpc,import_prefix=$(IMPORT_PREFIX):$(ORG_ROOT) $$dir/*.proto; \
$(PROTOC) -I.:$(GOGOPROTO_ROOT):$(PROTOBUF_ROOT):$(COREOS_PATH):$(GRPC_GATEWAY_GOOGLEAPIS_PATH) --plugin=$(PROTOC_PLUGIN) --$(PLUGIN_SUFFIX)_out=$(GRPC_GATEWAY_MAPPING),plugins=grpc,import_prefix=$(IMPORT_PREFIX):$(ORG_ROOT) $$dir/*.proto; \
done
sed -i~ -E '/gogoproto/d' $(GO_SOURCES)
sed -i~ -E 's!import (fmt|math) "$(IMPORT_PREFIX)(fmt|math)"! !g' $(GO_SOURCES)
sed -i~ -E 's!$(IMPORT_PREFIX)(errors|fmt|io|github\.com|golang\.org|google\.golang\.org)!\1!g' $(GO_SOURCES)
sed -i~ -E 's!$(REPO_NAME)/(etcd)!coreos/\1!g' $(GO_SOURCES)
gofmt -s -w $(GO_SOURCES)

$(GW_SOURCES) : $(GW_SERVER_PROTOS) $(GW_TS_PROTOS) $(GO_PROTOS) $(GOGOPROTO_PROTO) $(PROTOC)
(cd $(REPO_ROOT) && git ls-files --exclude-standard --cached --others -- '*.pb.gw.go' | xargs rm -f)
$(PROTOC) -I.:$(GOGOPROTO_PATH):$(COREOS_PATH):$(GRPC_GATEWAY_GOOGLEAPIS_PATH):$(CPROTOBUF_PATH) --grpc-gateway_out=logtostderr=true:. $(GW_SERVER_PROTOS)
$(PROTOC) -I.:$(GOGOPROTO_PATH):$(COREOS_PATH):$(GRPC_GATEWAY_GOOGLEAPIS_PATH):$(CPROTOBUF_PATH) --grpc-gateway_out=logtostderr=true:. $(GW_TS_PROTOS)
$(PROTOC) -I.:$(GOGOPROTO_ROOT):$(PROTOBUF_ROOT):$(COREOS_PATH):$(GRPC_GATEWAY_GOOGLEAPIS_PATH) --grpc-gateway_out=logtostderr=true:. $(GW_SERVER_PROTOS)
$(PROTOC) -I.:$(GOGOPROTO_ROOT):$(PROTOBUF_ROOT):$(COREOS_PATH):$(GRPC_GATEWAY_GOOGLEAPIS_PATH) --grpc-gateway_out=logtostderr=true:. $(GW_TS_PROTOS)

$(REPO_ROOT)/build/npm.installed: $(REPO_ROOT)/build/package.json
rm -rf $(REPO_ROOT)/build/node_modules
cd $(REPO_ROOT)/build && npm install --no-progress
touch $@

PBJS_ARGS = --path $(ORG_ROOT) $(GW_PROTOS)
PBJS_ARGS = --path $(ORG_ROOT) --path $(GOGOPROTO_ROOT) --path $(GRPC_GATEWAY_GOOGLEAPIS_PATH) $(GW_PROTOS)

$(REPO_ROOT)/ui/app/js/protos.js: $(REPO_ROOT)/build/npm.installed $(GO_PROTOS)
# Add comment recognized by reviewable.
Expand All @@ -106,10 +102,11 @@ $(REPO_ROOT)/ui/generated/protos.d.ts: $(REPO_ROOT)/ui/generated/protos.json
# Add comment recognized by reviewable.
echo '// GENERATED FILE DO NOT EDIT' > $@
$(REPO_ROOT)/build/node_modules/.bin/proto2ts --file $(REPO_ROOT)/ui/generated/protos.json >> $@
sed -i~ -E '/delete : string/d' $@ # This line produces a duplicate identifier error. Why?

$(CPP_HEADERS) $(CPP_SOURCES): $(PROTOC) $(CPP_PROTOS)
(cd $(REPO_ROOT) && git ls-files --exclude-standard --cached --others -- '*.pb.h' '*.pb.cc' | xargs rm -f)
$(PROTOC) -I.:$(GOGOPROTO_PATH) --cpp_out=lite:$(NATIVE_ROOT) $(CPP_PROTOS)
$(PROTOC) -I.:$(GOGOPROTO_ROOT):$(PROTOBUF_ROOT) --cpp_out=lite:$(NATIVE_ROOT) $(CPP_PROTOS)
sed -i~ -E '/gogoproto/d' $(CPP_HEADERS) $(CPP_SOURCES)
@# For c++, protoc generates a directory structure mirroring the package
@# structure (and these directories must be in the include path), but cgo can
Expand All @@ -119,7 +116,3 @@ $(CPP_HEADERS) $(CPP_SOURCES): $(PROTOC) $(CPP_PROTOS)
@# include deleted files (i.e. these very symlinks) in its output, resulting
@# in recursive symlinks, which is Bad™.
(cd $(NATIVE_ROOT) && find . -name *.pb.cc | xargs -I % ln -sf % .)

$(ENGINE_CPP_HEADERS) $(ENGINE_CPP_SOURCES): $(PROTOC) $(ENGINE_CPP_PROTOS)
$(PROTOC) -I.:$(GOGOPROTO_PATH) --cpp_out=lite:$(ORG_ROOT) $(ENGINE_CPP_PROTOS)
sed -i~ -E '/gogoproto/d' $(ENGINE_CPP_HEADERS) $(ENGINE_CPP_SOURCES)
48 changes: 23 additions & 25 deletions config/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ option go_package = "config";

import "cockroach/roachpb/metadata.proto";
import "cockroach/roachpb/data.proto";
import weak "gogoproto/gogo.proto";
import "gogoproto/gogo.proto";

// GCPolicy defines garbage collection policies which apply to MVCC
// values within a zone.
Expand Down
Loading

0 comments on commit 5530d61

Please sign in to comment.