Skip to content

Commit

Permalink
Autogenerate Version on build (#190)
Browse files Browse the repository at this point in the history
* Autogenerate Version On Build

* Fixes

* Changed Version to v0.9.0

* balls

* I hate newlines

* Don't remove .VERSION-file on `make clean`

* v0.9.0 => 1.0.0

* damn new-lines...

* Always rebuild templates/.VERSION

* Delete .VERSION

* Update Makefile
  • Loading branch information
bkcsoft authored and lunny committed Dec 13, 2016
1 parent f0a989c commit 1d1c018
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ BINDATA := $(shell find conf | sed 's/ /\\ /g')
STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
JAVASCRIPTS :=

LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildTime=$(DATE)"
LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildGitHash=$(SHA)"
VERSION = $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')

LDFLAGS += -X "main.Version=$(VERSION)"

TARGETS ?= linux/*,darwin/*,windows/*
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

// Version holds the current Gitea version
const Version = "0.9.99.0915"
var Version = "1.0.0+dev"

func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
Expand Down
9 changes: 0 additions & 9 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 1d1c018

Please sign in to comment.