mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Autogenerate Version on build (#190)
* 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
This commit is contained in:
		
				
					committed by
					
						
						Lunny Xiao
					
				
			
			
				
	
			
			
			
						parent
						
							f0a989c1d0
						
					
				
				
					commit
					1d1c01875d
				
			
							
								
								
									
										5
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
									
									
									
									
								
							@@ -9,8 +9,9 @@ BINDATA := $(shell find conf | sed 's/ /\\ /g')
 | 
				
			|||||||
STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
 | 
					STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
 | 
				
			||||||
JAVASCRIPTS :=
 | 
					JAVASCRIPTS :=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildTime=$(DATE)"
 | 
					VERSION = $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
 | 
				
			||||||
LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildGitHash=$(SHA)"
 | 
					
 | 
				
			||||||
 | 
					LDFLAGS += -X "main.Version=$(VERSION)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TARGETS ?= linux/*,darwin/*,windows/*
 | 
					TARGETS ?= linux/*,darwin/*,windows/*
 | 
				
			||||||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
 | 
					PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.go
									
									
									
									
									
								
							@@ -18,7 +18,7 @@ import (
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Version holds the current Gitea version
 | 
					// Version holds the current Gitea version
 | 
				
			||||||
const Version = "0.9.99.0915"
 | 
					var Version = "1.0.0+dev"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
						runtime.GOMAXPROCS(runtime.NumCPU())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,10 +53,6 @@ const (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// settings
 | 
					// settings
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	// BuildTime information should only be set by -ldflags.
 | 
					 | 
				
			||||||
	BuildTime    string
 | 
					 | 
				
			||||||
	BuildGitHash string
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// AppVer settings
 | 
						// AppVer settings
 | 
				
			||||||
	AppVer         string
 | 
						AppVer         string
 | 
				
			||||||
	AppName        string
 | 
						AppName        string
 | 
				
			||||||
@@ -642,11 +638,6 @@ var logLevels = map[string]string{
 | 
				
			|||||||
func newLogService() {
 | 
					func newLogService() {
 | 
				
			||||||
	log.Info("%s %s", AppName, AppVer)
 | 
						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.
 | 
						// Get and check log mode.
 | 
				
			||||||
	LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
 | 
						LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
 | 
				
			||||||
	LogConfigs = make([]string, len(LogModes))
 | 
						LogConfigs = make([]string, len(LogModes))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user