diff --git a/Makefile b/Makefile index 367e4aed6e..ee895f8f8b 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ test: build go test ./utility/... $(GO_TEST_FLAGS) go test ./web/... $(GO_TEST_FLAGS) -web: preparation +web: preparation model $(MAKE) -C web .PHONY: advice binary build clean documentation format model package preparation run search_index source_path test diff --git a/model/Makefile b/model/Makefile index 2382a6a2bb..328b33f5ef 100644 --- a/model/Makefile +++ b/model/Makefile @@ -11,14 +11,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +all: generated + +SUFFIXES: + MAKE_ARTIFACTS = generated-stamp -all: generated +include ../Makefile.INCLUDE generated: generated-stamp generated-stamp: data.proto - protoc --go_out=generated/ data.proto + protoc --proto_path=$(PREFIX)/include:. --go_out=generated/ --descriptor_set_out=generated/descriptor.blob data.proto touch $@ clean: diff --git a/model/data.proto b/model/data.proto index ce6cff9209..1678da4737 100644 --- a/model/data.proto +++ b/model/data.proto @@ -11,7 +11,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package dto; +package io.prometheus; + +import "google/protobuf/descriptor.proto"; message LabelPair { optional string name = 1; diff --git a/model/generated/.gitignore b/model/generated/.gitignore index cd6d21b5f9..01d8818eb2 100644 --- a/model/generated/.gitignore +++ b/model/generated/.gitignore @@ -1,4 +1,2 @@ -*.cc -*.go -*.h -*.o +data.pb.go +descriptor.blob diff --git a/web/Makefile b/web/Makefile index 4f3cf0980d..ba0e5a7d8f 100644 --- a/web/Makefile +++ b/web/Makefile @@ -13,10 +13,16 @@ all: blob -blob: +blob: static/generated/protocol_buffer.descriptor $(MAKE) -C blob clean: $(MAKE) -C blob clean +static/generated: + mkdir -vp static/generated + +static/generated/protocol_buffer.descriptor: static/generated ../model/generated/descriptor.blob + cp ../model/generated/descriptor.blob -f $@ + .PHONY: blob clean diff --git a/web/blob/Makefile b/web/blob/Makefile index 891010d56a..5c64fa1925 100644 --- a/web/blob/Makefile +++ b/web/blob/Makefile @@ -13,10 +13,13 @@ all: files.go +SUFFIXES: + files.go: $(shell find ../templates/ ../static/ -type f) ../../utility/embed-static.sh ../static ../templates | gofmt > $@ clean: -rm files.go + -rm -rf generated .PHONY: clean diff --git a/web/blob/blob.go b/web/blob/blob.go index 5ba0b0ee27..2edd278b9f 100644 --- a/web/blob/blob.go +++ b/web/blob/blob.go @@ -16,8 +16,9 @@ const ( ) var mimeMap = map[string]string{ - "css": "text/css", - "js": "text/javascript", + "css": "text/css", + "js": "text/javascript", + "descriptor": "application/vnd.google.protobuf;proto=google.protobuf.FileDescriptorSet", } func GetFile(bucket string, name string) ([]byte, error) {