From 61ea91e33aae739628c75a282d926f5a38efc332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Thu, 17 Nov 2016 16:47:23 +0100 Subject: [PATCH 01/11] Autogenerate Version On Build --- Makefile | 3 +++ main.go | 2 +- modules/setting/setting.go | 9 --------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b0f6f7079914..6da76c543b1f 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,9 @@ BINDATA := $(shell find conf | sed 's/ /\\ /g') STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less) JAVASCRIPTS := +VERSION = $(shell git describe --tags --always) + +LDFLAGS += -X "code.gitea.io/gitea.Version=$(VERSION)" LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildTime=$(DATE)" LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildGitHash=$(SHA)" diff --git a/main.go b/main.go index 338340008225..14042c5e8297 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ import ( ) // Version holds the current Gitea version -const Version = "0.9.99.0915" +var Version = "v0.0.0" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 7e3bfb47ba5c..ece149a0ce8d 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -53,10 +53,6 @@ const ( // settings var ( - // BuildTime information should only be set by -ldflags. - BuildTime string - BuildGitHash string - // AppVer settings AppVer string AppName string @@ -642,11 +638,6 @@ var logLevels = map[string]string{ func newLogService() { log.Info("%s %s", AppName, AppVer) - if len(BuildTime) > 0 { - log.Info("Build Time: %s", BuildTime) - log.Info("Build Git Hash: %s", BuildGitHash) - } - // Get and check log mode. LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",") LogConfigs = make([]string, len(LogModes)) From 38611506d5c796493a74f492ddfdce36a11e3f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Thu, 17 Nov 2016 20:55:32 +0100 Subject: [PATCH 02/11] Fixes --- Makefile | 10 ++++++---- templates/.VERSION | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6da76c543b1f..4d2cd5979a94 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,7 @@ JAVASCRIPTS := VERSION = $(shell git describe --tags --always) -LDFLAGS += -X "code.gitea.io/gitea.Version=$(VERSION)" -LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildTime=$(DATE)" -LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildGitHash=$(SHA)" +LDFLAGS += -X "main.Version=$(VERSION)" TARGETS ?= linux/*,darwin/*,windows/* PACKAGES ?= $(shell go list ./... | grep -v /vendor/) @@ -37,6 +35,7 @@ all: build clean: go clean -i ./... rm -rf $(EXECUTABLE) $(DIST) + rm templates/.VERSION .PHONY: fmt fmt: @@ -87,11 +86,14 @@ install: $(wildcard *.go) go install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' .PHONY: build -build: $(EXECUTABLE) +build: $(EXECUTABLE) templates/.VERSION $(EXECUTABLE): $(wildcard *.go) go build -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ +templates/.VERSION: + echo -n $(VERSION) > $@ + .PHONY: release release: release-build release-copy release-check diff --git a/templates/.VERSION b/templates/.VERSION index 927f673c535d..10feaac33bb8 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.99.0915 \ No newline at end of file +v0.9.99-212-g2c92e45 \ No newline at end of file From c4eb96e7ca6bb6426da1c1ffc2ca51233fec8976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Fri, 18 Nov 2016 03:01:15 +0100 Subject: [PATCH 03/11] Changed Version to v0.9.0 --- main.go | 2 +- templates/.VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 14042c5e8297..ccdd4c749e25 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ import ( ) // Version holds the current Gitea version -var Version = "v0.0.0" +var Version "v0.9.0+dev" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/templates/.VERSION b/templates/.VERSION index 10feaac33bb8..1d7ba6e96fc9 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -v0.9.99-212-g2c92e45 \ No newline at end of file +v0.9.0+dev From 0cf782b38cf280baed71a7dfe71da48e3b4667da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Fri, 18 Nov 2016 03:05:20 +0100 Subject: [PATCH 04/11] balls --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index ccdd4c749e25..273702575de2 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ import ( ) // Version holds the current Gitea version -var Version "v0.9.0+dev" +var Version = "v0.9.0+dev" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) From 49200ccd2952c051e1ae88a48e516d8ac0ac8b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Fri, 18 Nov 2016 03:12:28 +0100 Subject: [PATCH 05/11] I hate newlines --- Makefile | 2 +- templates/.VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4d2cd5979a94..bc24ea698919 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ BINDATA := $(shell find conf | sed 's/ /\\ /g') STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less) JAVASCRIPTS := -VERSION = $(shell git describe --tags --always) +VERSION = $(shell git describe --tags --always | sed 's/-/+/') LDFLAGS += -X "main.Version=$(VERSION)" diff --git a/templates/.VERSION b/templates/.VERSION index 1d7ba6e96fc9..9f98d74921e5 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -v0.9.0+dev +v0.9.0+dev \ No newline at end of file From e8b92b610f1f9fb89e5301291dddc06ad7863664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Fri, 18 Nov 2016 03:14:25 +0100 Subject: [PATCH 06/11] Don't remove .VERSION-file on `make clean` --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index bc24ea698919..0e04d101aa06 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,6 @@ all: build clean: go clean -i ./... rm -rf $(EXECUTABLE) $(DIST) - rm templates/.VERSION .PHONY: fmt fmt: From 921c62752d960b10054cb0a2776b0eeab0aba9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Tue, 22 Nov 2016 16:20:03 +0100 Subject: [PATCH 07/11] v0.9.0 => 1.0.0 --- Makefile | 2 +- main.go | 2 +- templates/.VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0e04d101aa06..dd511fee5608 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ BINDATA := $(shell find conf | sed 's/ /\\ /g') STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less) JAVASCRIPTS := -VERSION = $(shell git describe --tags --always | sed 's/-/+/') +VERSION = $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//') LDFLAGS += -X "main.Version=$(VERSION)" diff --git a/main.go b/main.go index 273702575de2..620378491ab7 100644 --- a/main.go +++ b/main.go @@ -18,7 +18,7 @@ import ( ) // Version holds the current Gitea version -var Version = "v0.9.0+dev" +var Version = "1.0.0+dev" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/templates/.VERSION b/templates/.VERSION index 9f98d74921e5..ad41d4c7d31a 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -v0.9.0+dev \ No newline at end of file +1.0.0+dev From 016de4dab1ffa96ddd4bed8d849228f805d36fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Wed, 23 Nov 2016 00:29:28 +0100 Subject: [PATCH 08/11] damn new-lines... --- templates/.VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/.VERSION b/templates/.VERSION index ad41d4c7d31a..c22cb69e16da 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -1.0.0+dev +1.0.0+dev \ No newline at end of file From d8b01158e5de474e5d4c25378aab7c521dea9d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Mon, 5 Dec 2016 12:39:48 +0100 Subject: [PATCH 09/11] Always rebuild templates/.VERSION --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index dd511fee5608..c0eb000d8b31 100644 --- a/Makefile +++ b/Makefile @@ -90,6 +90,7 @@ build: $(EXECUTABLE) templates/.VERSION $(EXECUTABLE): $(wildcard *.go) go build -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ +.PHONY: templates/.VERSION templates/.VERSION: echo -n $(VERSION) > $@ From 5b15952020059a9aca13b387a36c9f804a277378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Mon, 12 Dec 2016 23:27:21 +0100 Subject: [PATCH 10/11] Delete .VERSION --- templates/.VERSION | 1 - 1 file changed, 1 deletion(-) delete mode 100644 templates/.VERSION diff --git a/templates/.VERSION b/templates/.VERSION deleted file mode 100644 index c22cb69e16da..000000000000 --- a/templates/.VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0.0+dev \ No newline at end of file From c3a01a8418aca9e36e4a42ac58815fc306b246c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Mon, 12 Dec 2016 23:28:07 +0100 Subject: [PATCH 11/11] Update Makefile --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c0eb000d8b31..57b5a1e3aa34 100644 --- a/Makefile +++ b/Makefile @@ -85,15 +85,11 @@ install: $(wildcard *.go) go install -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' .PHONY: build -build: $(EXECUTABLE) templates/.VERSION +build: $(EXECUTABLE) $(EXECUTABLE): $(wildcard *.go) go build -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ -.PHONY: templates/.VERSION -templates/.VERSION: - echo -n $(VERSION) > $@ - .PHONY: release release: release-build release-copy release-check