Merge pull request #773 from influxdata/feature/build-assets
build(chronograf): add conditional build tags for asset generationpull/10616/head
commit
dec5ece85c
12
Makefile
12
Makefile
|
@ -50,7 +50,8 @@ UTILS := \
|
||||||
#
|
#
|
||||||
# This target sets up the dependencies to correctly build all go commands.
|
# This target sets up the dependencies to correctly build all go commands.
|
||||||
# Other targets must depend on this target to correctly builds CMDS.
|
# Other targets must depend on this target to correctly builds CMDS.
|
||||||
all: vendor node_modules $(UTILS) subdirs $(CMDS)
|
all: GO_ARGS=-tags 'assets $(GO_TAGS)'
|
||||||
|
all: vendor node_modules $(UTILS) subdirs generate $(CMDS)
|
||||||
|
|
||||||
# Target to build subdirs.
|
# Target to build subdirs.
|
||||||
# Each subdirs must support the `all` target.
|
# Each subdirs must support the `all` target.
|
||||||
|
@ -109,11 +110,10 @@ vendor/github.com/kevinburke/go-bindata/go-bindata/main.go: vendor
|
||||||
fmt: $(SOURCES_NO_VENDOR)
|
fmt: $(SOURCES_NO_VENDOR)
|
||||||
goimports -w $^
|
goimports -w $^
|
||||||
|
|
||||||
# generate:
|
generate:
|
||||||
# TODO: re-enable these after we decide on a strategy for building without running `go generate`.
|
$(GO_GENERATE) ./chronograf/dist/...
|
||||||
# $(GO_GENERATE) ./chronograf/dist/...
|
$(GO_GENERATE) ./chronograf/server/...
|
||||||
# $(GO_GENERATE) ./chronograf/server/...
|
$(GO_GENERATE) ./chronograf/canned/...
|
||||||
# $(GO_GENERATE) ./chronograf/canned/...
|
|
||||||
|
|
||||||
test-js: node_modules
|
test-js: node_modules
|
||||||
cd chronograf/ui && yarn test --runInBand
|
cd chronograf/ui && yarn test --runInBand
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
|
// +build !assets
|
||||||
|
|
||||||
package canned
|
package canned
|
||||||
|
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
// The functions defined in this file are placeholders
|
// The functions defined in this file are placeholders when the binary is compiled
|
||||||
// until we decide how to get the finalized Chronograf assets in platform.
|
// without assets.
|
||||||
|
|
||||||
var errTODO = errors.New("TODO: decide how to handle chronograf assets in platform")
|
|
||||||
|
|
||||||
|
// Asset returns an error stating no assets were included in the binary.
|
||||||
func Asset(string) ([]byte, error) {
|
func Asset(string) ([]byte, error) {
|
||||||
return nil, errTODO
|
return nil, errors.New("no assets included in binary")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AssetNames returns nil because there are no assets included in the binary.
|
||||||
func AssetNames() []string {
|
func AssetNames() []string {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/influxdata/platform/chronograf"
|
"github.com/influxdata/platform/chronograf"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate go-bindata -o bin_gen.go -ignore README|apps|.sh|go -pkg canned .
|
//go:generate go-bindata -o bin_gen.go -tags assets -ignore README|apps|.sh|go -pkg canned .
|
||||||
|
|
||||||
// BinLayoutsStore represents a layout store using data generated by go-bindata
|
// BinLayoutsStore represents a layout store using data generated by go-bindata
|
||||||
type BinLayoutsStore struct {
|
type BinLayoutsStore struct {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build !assets
|
||||||
|
|
||||||
package dist
|
package dist
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -6,18 +8,21 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// The functions defined in this file are placeholders
|
// The functions defined in this file are placeholders
|
||||||
// until we decide how to get the finalized Chronograf assets in platform.
|
// when the binary is compiled without assets.
|
||||||
|
|
||||||
var errTODO = errors.New("TODO: decide how to handle chronograf assets in platform")
|
var errNoAssets = errors.New("no assets included in binary")
|
||||||
|
|
||||||
|
// Asset returns an error stating no assets were included in the binary.
|
||||||
func Asset(string) ([]byte, error) {
|
func Asset(string) ([]byte, error) {
|
||||||
return nil, errTODO
|
return nil, errNoAssets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AssetInfo returns an error stating no assets were included in the binary.
|
||||||
func AssetInfo(name string) (os.FileInfo, error) {
|
func AssetInfo(name string) (os.FileInfo, error) {
|
||||||
return nil, errTODO
|
return nil, errNoAssets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AssetDir returns nil because there are no assets included in the binary.
|
||||||
func AssetDir(name string) ([]string, error) {
|
func AssetDir(name string) ([]string, error) {
|
||||||
return nil, errTODO
|
return nil, errNoAssets
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package dist
|
package dist
|
||||||
|
|
||||||
//go:generate go-bindata -o dist_gen.go -ignore 'map|go' -pkg dist ../ui/build/...
|
//go:generate go-bindata -o dist_gen.go -ignore 'map|go' -tags assets -pkg dist ../ui/build/...
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
|
// +build !assets
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The functions defined in this file are placeholders
|
// The functions defined in this file are placeholders when the binary is compiled
|
||||||
// until we decide how to get the finalized Chronograf assets in platform.
|
// without assets.
|
||||||
|
|
||||||
var errTODO = errors.New("You didn't generate assets for the chronograf/server folder, using placeholders")
|
|
||||||
|
|
||||||
|
// Asset returns an error stating no assets were included in the binary.
|
||||||
func Asset(string) ([]byte, error) {
|
func Asset(string) ([]byte, error) {
|
||||||
return nil, errTODO
|
return nil, errors.New("no assets included in binary")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
//go:generate go-bindata -o swagger_gen.go -ignore go -nocompress -pkg server .
|
//go:generate go-bindata -o swagger_gen.go -tags assets -ignore go -nocompress -pkg server .
|
||||||
|
|
||||||
import "net/http"
|
import "net/http"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue