diff --git a/cmd/log2sql/main.go b/cmd/log2sql/main.go index 7ef9d36..bc33775 100644 --- a/cmd/log2sql/main.go +++ b/cmd/log2sql/main.go @@ -25,7 +25,7 @@ import ( "github.com/perforce/p4prometheus/version" p4dlog "github.com/rcowham/go-libp4dlog" - "github.com/rcowham/go-libp4dlog/metrics" + metrics "github.com/rcowham/go-libp4dlog/metrics" ) const statementsPerTransaction = 50 * 1000 @@ -610,7 +610,12 @@ func main() { if writeMetrics { wg.Add(1) logger.Debugf("Main: creating metrics") - mp = metrics.NewP4DMetricsLogParser(mconfig, logger, true) + mver := &metrics.P4DMetricsVersion{ + Revision: version.Revision, + GoVersion: version.GoVersion, + Version: version.Version, + } + mp = metrics.NewP4DMetricsLogParser(mconfig, mver, logger, true) if *debug != 0 { mp.SetDebugMode(*debug) } diff --git a/cmd/p4dpending/Makefile b/cmd/p4dpending/Makefile index 660b3dd..f90e089 100644 --- a/cmd/p4dpending/Makefile +++ b/cmd/p4dpending/Makefile @@ -1,4 +1,4 @@ - +# Build file for p4dpending - useful debugging tool for the library BINARY=p4dpending @@ -19,15 +19,20 @@ LDFLAGS=-ldflags="-w -s -X ${MODULE}/version.Version=${VERSION} -X ${MODULE}/ver build: go build ${LOCAL_LDFLAGS} -# Builds distribution - uses xgo and the docker container for cross platform builds -# See: https://github.com/karalabe/xgo -# Note that this will download and build the latest version of package from github - it won't build the local go -# repo. So you need to have published everything (and ensure tags are as desired) before doing this. +test: + go test + +# Builds distribution - for all supported platforms dist: - ~/go/bin/xgo --targets=linux/amd64,windows/amd64,darwin/amd64 ${LDFLAGS} github.com/rcowham/go-libp4dlog/cmd/p4dpending - rm -f p4dpending*amd64*.gz - -chmod +x p4dpending*amd64* - gzip p4dpending*amd64* + GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o bin/${BINARY}-darwin-amd64 main.go + GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o bin/${BINARY}-darwin-arm64 main.go + GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o bin/${BINARY}-linux-amd64 main.go + GOOS=linux GOARCH=arm64 go build ${LDFLAGS} -o bin/${BINARY}-linux-arm64 main.go + GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o bin/${BINARY}-windows-amd64.exe main.go + GOOS=windows GOARCH=arm64 go build ${LDFLAGS} -o bin/${BINARY}-windows-arm64.exe main.go + rm -f bin/${BINARY}*-a*64*.gz + -chmod +x bin/${BINARY}*-a*64* + gzip bin/${BINARY}*a*64* # Installs our project: copies binaries install: @@ -37,4 +42,4 @@ install: clean: if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi -.PHONY: clean install +.PHONY: clean install test diff --git a/cmd/p4locks/Makefile b/cmd/p4locks/Makefile index ce61967..5674770 100644 --- a/cmd/p4locks/Makefile +++ b/cmd/p4locks/Makefile @@ -1,3 +1,5 @@ +# Makefile for p4locks - to show lock status in a log file. + BINARY=p4locks # These are the values we want to pass for VERSION and BUILD @@ -17,14 +19,17 @@ LDFLAGS=-ldflags="-w -s -X ${MODULE}/version.Version=${VERSION} -X ${MODULE}/ver build: go build ${LOCAL_LDFLAGS} -# Builds distributions +# Builds distribution for other platforms dist: GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o bin/${BINARY}-darwin-amd64 main.go + GOOS=darwin GOARCH=arm64 go build ${LDFLAGS} -o bin/${BINARY}-darwin-arm64 main.go GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o bin/${BINARY}-linux-amd64 main.go + GOOS=linux GOARCH=arm64 go build ${LDFLAGS} -o bin/${BINARY}-linux-arm64 main.go GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o bin/${BINARY}-windows-amd64.exe main.go - rm -f bin/${BINARY}*amd64*.gz - -chmod +x bin/${BINARY}*amd64* - gzip bin/${BINARY}*amd64* + GOOS=windows GOARCH=arm64 go build ${LDFLAGS} -o bin/${BINARY}-windows-arm64.exe main.go + rm -f bin/${BINARY}*-a*64*.gz + -chmod +x bin/${BINARY}*-a*64* + gzip bin/${BINARY}*a*64* # Cleans our project: deletes binaries clean: