@ -24,6 +24,7 @@ TSDB_BENCHMARK_DATASET ?= ./tsdb/testdata/20kseries.json
TSDB_BENCHMARK_OUTPUT_DIR ?= ./benchout
TSDB_BENCHMARK_OUTPUT_DIR ?= ./benchout
GOLANGCI_LINT_OPTS ?= --timeout 4m
GOLANGCI_LINT_OPTS ?= --timeout 4m
GOYACC_VERSION ?= v0.6.0
i n c l u d e M a k e f i l e . c o m m o n
i n c l u d e M a k e f i l e . c o m m o n
@ -78,24 +79,42 @@ assets-tarball: assets
@echo '>> packaging assets'
@echo '>> packaging assets'
scripts/package_assets.sh
scripts/package_assets.sh
# We only want to generate the parser when there's changes to the grammar.
.PHONY : parser
.PHONY : parser
parser :
parser :
@echo ">> running goyacc to generate the .go file."
@echo ">> running goyacc to generate the .go file."
i f e q ( , $( shell command -v goyacc 2> /dev /null ) )
i f e q ( , $( shell command -v goyacc 2> /dev /null ) )
@echo "goyacc not installed so skipping"
@echo "goyacc not installed so skipping"
@echo " To install: go install golang.org/x/tools/cmd/goyacc@v0.6.0 "
@echo " To install: \"go install golang.org/x/tools/cmd/goyacc@ $( GOYACC_VERSION) \" or run \"make install-goyacc\" "
e l s e
e l s e
goyacc -l -o promql/parser/generated_parser.y.go promql/parser/generated_parser.y
$( MAKE) promql/parser/generated_parser.y.go
e n d i f
e n d i f
promql/parser/generated_parser.y.go : promql /parser /generated_parser .y
@echo ">> running goyacc to generate the .go file."
@goyacc -l -o promql/parser/generated_parser.y.go promql/parser/generated_parser.y
.PHONY : clean -parser
clean-parser :
@echo ">> cleaning generated parser"
@rm -f promql/parser/generated_parser.y.go
.PHONY : check -generated -parser
check-generated-parser : clean -parser promql /parser /generated_parser .y .go
@echo ">> checking generated parser"
@git diff --exit-code -- promql/parser/generated_parser.y.go || ( echo "Generated parser is out of date. Please run 'make parser' and commit the changes." && false )
.PHONY : install -goyacc
install-goyacc :
@echo " >> installing goyacc $( GOYACC_VERSION) "
@go install golang.org/x/tools/cmd/goyacc@$( GOYACC_VERSION)
.PHONY : test
.PHONY : test
# If we only want to only test go code we have to change the test target
# If we only want to only test go code we have to change the test target
# which is called by all.
# which is called by all.
i f e q ( $( GO_ONLY ) , 1 )
i f e q ( $( GO_ONLY ) , 1 )
test : common -test check -go -mod -version
test : common -test check -go -mod -version
e l s e
e l s e
test : common -test ui -build -module ui -test ui -lint check -go -mod -version
test : c heck-generated -parser c ommon-test ui -build -module ui -test ui -lint check -go -mod -version
e n d i f
e n d i f
.PHONY : npm_licenses
.PHONY : npm_licenses