mirror of https://github.com/go-gitea/gitea.git
commit
b58b634e0e
@ -1,19 +1,37 @@
|
|||||||
.DS_Store
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
_obj
|
||||||
|
_test
|
||||||
|
|
||||||
|
# Architecture specific extensions/prefixes
|
||||||
|
*.[568vq]
|
||||||
|
[568vq].out
|
||||||
|
|
||||||
|
*.cgo1.go
|
||||||
|
*.cgo2.c
|
||||||
|
_cgo_defun.c
|
||||||
|
_cgo_gotypes.go
|
||||||
|
_cgo_export.*
|
||||||
|
|
||||||
|
_testmain.go
|
||||||
|
|
||||||
|
*.exe
|
||||||
|
*.test
|
||||||
|
*.prof
|
||||||
|
|
||||||
|
coverage.out
|
||||||
|
gitea
|
||||||
|
|
||||||
*.db
|
*.db
|
||||||
*.log
|
*.log
|
||||||
log/
|
|
||||||
custom/
|
/bin
|
||||||
data/
|
/dist
|
||||||
.vendor/
|
/custom
|
||||||
.idea/
|
/data
|
||||||
*.iml
|
/log
|
||||||
public/img/avatar/
|
/public/img/avatar
|
||||||
*.exe
|
|
||||||
*.exe~
|
|
||||||
/gogs
|
|
||||||
profile/
|
|
||||||
*.pem
|
|
||||||
output*
|
|
||||||
gogs.sublime-project
|
|
||||||
gogs.sublime-workspace
|
|
||||||
/release
|
|
||||||
|
@ -1,74 +1,132 @@
|
|||||||
LDFLAGS += -X "github.com/go-gitea/gitea/modules/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
|
DIST := dist
|
||||||
LDFLAGS += -X "github.com/go-gitea/gitea/modules/setting.BuildGitHash=$(shell git rev-parse HEAD)"
|
BIN := bin
|
||||||
|
|
||||||
DATA_FILES := $(shell find conf | sed 's/ /\\ /g')
|
EXECUTABLE := gitea
|
||||||
LESS_FILES := $(wildcard public/less/gogs.less public/less/_*.less)
|
IMPORT := github.com/go-gitea/gitea
|
||||||
GENERATED := modules/bindata/bindata.go public/css/index.css
|
|
||||||
|
|
||||||
TAGS = ""
|
SHA := $(shell git rev-parse --short HEAD)
|
||||||
BUILD_FLAGS = "-v"
|
DATE := $(shell date -u '+%Y-%m-%d %I:%M:%S %Z')
|
||||||
|
|
||||||
RELEASE_ROOT = "release"
|
BINDATA := $(shell find conf | sed 's/ /\\ /g')
|
||||||
RELEASE_GOGS = "release/gogs"
|
STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
|
||||||
NOW = $(shell date -u '+%Y%m%d%I%M%S')
|
JAVASCRIPTS :=
|
||||||
GOVET = go tool vet -composites=false -methods=false -structtags=false
|
|
||||||
|
|
||||||
.PHONY: build pack release bindata clean
|
LDFLAGS += -X "github.com/go-gitea/gitea/modules/setting.BuildTime=$(DATE)"
|
||||||
|
LDFLAGS += -X "github.com/go-gitea/gitea/modules/setting.BuildGitHash=$(SHA)"
|
||||||
|
|
||||||
.IGNORE: public/css/index.css
|
TARGETS ?= linux/*,darwin/*,windows/*
|
||||||
|
PACKAGES ?= $(shell go list ./... | grep -v /vendor/)
|
||||||
|
|
||||||
all: build
|
TAGS ?=
|
||||||
|
|
||||||
check: test
|
ifneq ($(TRAVIS_TAG),)
|
||||||
|
VERSION ?= $(TRAVIS_TAG)
|
||||||
|
else
|
||||||
|
ifneq ($(TRAVIS_BRANCH),)
|
||||||
|
VERSION ?= $(TRAVIS_BRANCH)
|
||||||
|
else
|
||||||
|
VERSION ?= master
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
dist: release
|
.PHONY: all
|
||||||
|
all: clean test build
|
||||||
|
|
||||||
govet:
|
.PHONY: clean
|
||||||
$(GOVET) main.go
|
clean:
|
||||||
$(GOVET) models modules routers
|
go clean -i ./...
|
||||||
|
rm -rf $(BIN) $(DIST)
|
||||||
|
|
||||||
|
.PHONY: deps
|
||||||
|
deps:
|
||||||
|
@which go-bindata > /dev/null; if [ $$? -ne 0 ]; then \
|
||||||
|
go get -u github.com/jteeuwen/go-bindata/...; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
.PHONY: fmt
|
||||||
|
fmt:
|
||||||
|
go fmt $(PACKAGES)
|
||||||
|
|
||||||
|
.PHONY: vet
|
||||||
|
vet:
|
||||||
|
go vet $(PACKAGES)
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint:
|
||||||
|
@which golint > /dev/null; if [ $$? -ne 0 ]; then \
|
||||||
|
go get -u github.com/golang/lint/golint; \
|
||||||
|
fi
|
||||||
|
for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
|
||||||
|
|
||||||
build: $(GENERATED)
|
.PHONY: install
|
||||||
go install $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
|
install: $(BIN)/$(EXECUTABLE)
|
||||||
cp '$(GOPATH)/bin/gogs' .
|
cp $< $(GOPATH)/bin/
|
||||||
|
|
||||||
build-dev: $(GENERATED) govet
|
.PHONY: build
|
||||||
go install $(BUILD_FLAGS) -tags '$(TAGS)'
|
build: $(BIN)/$(EXECUTABLE)
|
||||||
cp '$(GOPATH)/bin/gogs' .
|
|
||||||
|
|
||||||
build-dev-race: $(GENERATED) govet
|
$(BIN)/$(EXECUTABLE): $(wildcard *.go)
|
||||||
go install $(BUILD_FLAGS) -race -tags '$(TAGS)'
|
go build -v -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
||||||
cp '$(GOPATH)/bin/gogs' .
|
|
||||||
|
|
||||||
pack:
|
.PHONY: release
|
||||||
rm -rf $(RELEASE_GOGS)
|
release: release-build release-copy release-check
|
||||||
mkdir -p $(RELEASE_GOGS)
|
|
||||||
cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
|
|
||||||
rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
|
|
||||||
cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
|
|
||||||
|
|
||||||
release: build pack
|
.PHONY: release-build
|
||||||
|
release-build:
|
||||||
|
@which xgo > /dev/null; if [ $$? -ne 0 ]; then \
|
||||||
|
go get -u github.com/karalabe/xgo; \
|
||||||
|
fi
|
||||||
|
xgo -dest $(BIN) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -targets '$(TARGETS)' -out $(EXECUTABLE)-$(VERSION) $(IMPORT)
|
||||||
|
|
||||||
bindata: modules/bindata/bindata.go
|
.PHONY: release-copy
|
||||||
|
release-copy:
|
||||||
|
mkdir -p $(DIST)/release
|
||||||
|
$(foreach file,$(wildcard $(BIN)/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
|
||||||
|
|
||||||
modules/bindata/bindata.go: $(DATA_FILES)
|
.PHONY: release-check
|
||||||
go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS" -pkg=bindata conf/...
|
release-check:
|
||||||
|
cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
|
||||||
|
|
||||||
less: public/css/index.css
|
.PHONY: latest
|
||||||
|
latest: release-build latest-copy latest-check
|
||||||
|
|
||||||
public/css/index.css: $(LESS_FILES)
|
.PHONY: latest-copy
|
||||||
lessc $< $@
|
latest-copy:
|
||||||
|
mkdir -p $(DIST)/latest
|
||||||
|
$(foreach file,$(wildcard $(BIN)/$(EXECUTABLE)-*),cp $(file) $(DIST)/latest/$(subst $(EXECUTABLE)-$(VERSION),$(EXECUTABLE)-latest,$(notdir $(file)));)
|
||||||
|
|
||||||
clean:
|
.PHONY: latest-check
|
||||||
go clean -i ./...
|
latest-check:
|
||||||
|
cd $(DIST)/latest; $(foreach file,$(wildcard $(DIST)/latest/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
|
||||||
|
|
||||||
clean-mac: clean
|
.PHONY: publish
|
||||||
find . -name ".DS_Store" -print0 | xargs -0 rm
|
publish: release latest
|
||||||
|
|
||||||
test:
|
.PHONY: bindata
|
||||||
go test -cover -race ./...
|
bindata: modules/bindata/bindata.go
|
||||||
|
|
||||||
|
.IGNORE: modules/bindata/bindata.go
|
||||||
|
modules/bindata/bindata.go: $(BINDATA)
|
||||||
|
go-bindata -o=$@ -ignore="\\.go|README.md|TRANSLATORS" -pkg=bindata conf/...
|
||||||
|
go fmt $@
|
||||||
|
|
||||||
|
.PHONY: javascripts
|
||||||
|
javascripts: public/js/index.js
|
||||||
|
|
||||||
fixme:
|
.IGNORE: public/js/index.js
|
||||||
grep -rnw "FIXME" routers models modules
|
public/js/index.js: $(JAVASCRIPTS)
|
||||||
|
cat $< >| $@
|
||||||
|
|
||||||
|
.PHONY: stylesheets
|
||||||
|
stylesheets: public/css/index.css
|
||||||
|
|
||||||
|
.IGNORE: public/css/index.css
|
||||||
|
public/css/index.css: $(STYLESHEETS)
|
||||||
|
lessc $< $@
|
||||||
|
|
||||||
todo:
|
.PHONY: generate
|
||||||
grep -rnw "TODO" routers models modules
|
generate: bindata javascripts stylesheets
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
outPath=./output
|
|
||||||
|
|
||||||
rm -rf $outPath
|
|
||||||
mkdir $outPath
|
|
||||||
|
|
||||||
go build ../main.go -o gitea
|
|
||||||
PLATFORM=`uname | cut -d _ -f 1`
|
|
||||||
if [ $PLATFORM = "MINGW32" ] || [ $PLATFORM = "MINGW64" ] || [ $PLATFORM = "CYGWIN" ]; then
|
|
||||||
GOGS_EXE=gogs.exe
|
|
||||||
else
|
|
||||||
GOGS_EXE=gogs
|
|
||||||
fi
|
|
||||||
chmod +x $GOGS_EXE
|
|
||||||
mv $GOGS_EXE $outPath/
|
|
||||||
|
|
||||||
cp -r ../conf/ $outPath/conf/
|
|
||||||
cp -r ../custom/ $outPath/custom/
|
|
||||||
cp -r dockerfiles/ $outPath/dockerfiles/
|
|
||||||
cp -r ../public/ $outPath/public/
|
|
||||||
cp -r ../templates/ $outPath/templates/
|
|
||||||
cp ../cert.pem $outPath/
|
|
||||||
cp ../CONTRIBUTING.md $outPath/
|
|
||||||
cp gogs_supervisord.sh $outPath/
|
|
||||||
cp ../key.pem $outPath/
|
|
||||||
cp ../LICENSE $outPath/
|
|
||||||
cp ../README.md $outPath/
|
|
||||||
cp ../README_ZH.md $outPath/
|
|
||||||
cp start.bat $outPath/
|
|
||||||
cp start.sh $outPath/
|
|
||||||
cp ../wercker.yml $outPath/
|
|
||||||
cp mysql.sql $outPath/
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
outPlattform=freebsd
|
|
||||||
outArch=amd64
|
|
||||||
outPath=./output_$outPlattform_$outArch
|
|
||||||
|
|
||||||
rm -rf $outPath
|
|
||||||
mkdir $outPath
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=$outPlattform GOARCH=$outArch go build ../main.go -o gitea
|
|
||||||
chmod +x gogs
|
|
||||||
mv gogs $outPath/
|
|
||||||
|
|
||||||
cp -r ../conf/ $outPath/conf/
|
|
||||||
cp -r ../custom/ $outPath/custom/
|
|
||||||
cp -r dockerfiles/ $outPath/dockerfiles/
|
|
||||||
cp -r ../public/ $outPath/public/
|
|
||||||
cp -r ../templates/ $outPath/templates/
|
|
||||||
cp ../cert.pem $outPath/
|
|
||||||
cp ../CONTRIBUTING.md $outPath/
|
|
||||||
cp gogs_supervisord.sh $outPath/
|
|
||||||
cp ../key.pem $outPath/
|
|
||||||
cp ../LICENSE $outPath/
|
|
||||||
cp ../README.md $outPath/
|
|
||||||
cp ../README_ZH.md $outPath/
|
|
||||||
cp start.bat $outPath/
|
|
||||||
cp start.sh $outPath/
|
|
||||||
cp ../wercker.yml $outPath/
|
|
||||||
cp mysql.sql $outPath/
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
outPlattform=linux
|
|
||||||
outArch=amd64
|
|
||||||
outPath=./output_$outPlattform_$outArch
|
|
||||||
|
|
||||||
rm -rf $outPath
|
|
||||||
mkdir $outPath
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=$outPlattform GOARCH=$outArch go build ../main.go -o gitea
|
|
||||||
chmod +x gogs
|
|
||||||
mv gogs $outPath/
|
|
||||||
|
|
||||||
cp -r ../conf/ $outPath/conf/
|
|
||||||
cp -r ../custom/ $outPath/custom/
|
|
||||||
cp -r dockerfiles/ $outPath/dockerfiles/
|
|
||||||
cp -r ../public/ $outPath/public/
|
|
||||||
cp -r ../templates/ $outPath/templates/
|
|
||||||
cp ../cert.pem $outPath/
|
|
||||||
cp ../CONTRIBUTING.md $outPath/
|
|
||||||
cp gogs_supervisord.sh $outPath/
|
|
||||||
cp ../key.pem $outPath/
|
|
||||||
cp ../LICENSE $outPath/
|
|
||||||
cp ../README.md $outPath/
|
|
||||||
cp ../README_ZH.md $outPath/
|
|
||||||
cp start.bat $outPath/
|
|
||||||
cp start.sh $outPath/
|
|
||||||
cp ../wercker.yml $outPath/
|
|
||||||
cp mysql.sql $outPath/
|
|
Loading…
Reference in New Issue