From d414fa42efc629d92c382b0292b4766bc6c4e33f Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Sun, 19 May 2019 10:49:00 -0700 Subject: [PATCH] Add windows build script Signed-off-by: Ana Hobden --- build.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 build.ps1 diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 00000000000..b6b8d2e7983 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,16 @@ +# For `--version` +$PD_PKG = "github.com/pingcap/pd" +$GO_LDFLAGS = "-X `"$PD_PKG/server.PDReleaseVersion=$(git describe --tags --dirty)`"" +$GO_LDFLAGS += " -X `"$PD_PKG/server.PDBuildTS=$(date -u '+%Y-%m-%d_%I:%M:%S')`"" +$GO_LDFLAGS += " -X `"$PD_PKG/server.PDGitHash=$(git rev-parse HEAD)`"" +$GO_LDFLAGS += " -X `"$PD_PKG/server.PDGitBranch=$(git rev-parse --abbrev-ref HEAD)`"" + +# Output binaries +go build -ldflags $GO_LDFLAGS -o bin/pd-server.exe cmd/pd-server/main.go +echo "bin/pd-server.exe" +go build -ldflags $GO_LDFLAGS -o bin/pd-ctl.exe tools/pd-ctl/main.go +echo "bin/pd-ctl.exe" +go build -o bin/pd-tso-bench.exe tools/pd-tso-bench/main.go +echo "bin/pd-tso-bench.exe" +go build -o bin/pd-recover.exe tools/pd-recover/main.go +echo "bin/pd-recover.exe" \ No newline at end of file