-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autogenerate Version on build #190
Changes from 9 commits
61ea91e
3861150
c4eb96e
0cf782b
49200cc
e8b92b6
921c627
016de4d
d8b0115
5b15952
c3a01a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/) | ||
|
@@ -84,11 +85,15 @@ 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 $@ | ||
|
||
.PHONY: templates/.VERSION | ||
templates/.VERSION: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO we should drop this version file. People that build from source should update the templates on their own. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was leaving that to your PR (#74) so you wouldn't get conflicts 😛 |
||
echo -n $(VERSION) > $@ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we should change this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, it should be without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I run
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO we should anyway trim the result within the version check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the HELL apple, stop fucking around with my flags! 😆 I'll trim it instead... maybe I should drop it? I think that @tboerger PR for removing it is merged no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you can drop it and wait until he's PR merged. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bkcsoft, just drop it. I think this could be merged. |
||
|
||
.PHONY: release | ||
release: release-build release-copy release-check | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ import ( | |
) | ||
|
||
// Version holds the current Gitea version | ||
const Version = "0.9.99.0915" | ||
var Version = "1.0.0+dev" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can either generate it, OR set it, otherwise generating it is pointless There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I do in other projects is always set the target version for each branch (ie: |
||
|
||
func init() { | ||
runtime.GOMAXPROCS(runtime.NumCPU()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.9.99.0915 | ||
1.0.0+dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking, you should be able to group the sed calls:
sed 's/^v//;s/-/+/'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strk that depends entirely on the version of
sed
unfortunately... FreeBSD for example doesn't handle that 😒There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just keep it like it is. The
v
replacement can even be done with plain bash ;)