From 2932042a6d6dcf8d4f74de0abce688190f2925b9 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Thu, 1 Dec 2016 08:28:43 +0100 Subject: [PATCH] Get rid of bin folder within makefile, enabled TiDB (#319) * Get rid of the bin folder within the build process Signed-off-by: Thomas Boerger * Dropped latest make task, it is unused Signed-off-by: Thomas Boerger * Added tidb tag to drone config Signed-off-by: Thomas Boerger * Dropped the cert build tag Signed-off-by: Thomas Boerger * Dropped useless minwinsvc build tag Signed-off-by: Thomas Boerger * Dropped the useless build tags from drone config Signed-off-by: Thomas Boerger --- .drone.yml | 4 ++-- .drone.yml.sig | 2 +- Makefile | 23 +++-------------------- cmd/cert.go | 3 +-- cmd/cert_stub.go | 30 ------------------------------ modules/setting/miniwinsvc.go | 15 --------------- modules/setting/setting.go | 2 +- routers/init.go | 3 --- 8 files changed, 8 insertions(+), 74 deletions(-) delete mode 100644 cmd/cert_stub.go delete mode 100644 modules/setting/miniwinsvc.go diff --git a/.drone.yml b/.drone.yml index dd5052567..f99a9e413 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ pipeline: pull: true environment: CGO_ENABLED: 1 - TAGS: cert sqlite pam miniwinsvc + TAGS: sqlite tidb pam commands: - apk -U add linux-pam-dev openssh-client - make clean @@ -45,7 +45,7 @@ pipeline: image: karalabe/xgo-latest:latest pull: true commands: - - make publish + - make release when: event: [ push, tag ] branch: [ master, refs/tags/* ] diff --git a/.drone.yml.sig b/.drone.yml.sig index d86400e99..d57e6fdba 100644 --- a/.drone.yml.sig +++ b/.drone.yml.sig @@ -1 +1 @@ -eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9zcnYvYXBwCiAgcGF0aDogc3JjL2NvZGUuZ2l0ZWEuaW8vZ2l0ZWEKCnBpcGVsaW5lOgogIHRlc3Q6CiAgICBpbWFnZTogd2ViaGlwcGllL2dvbGFuZzplZGdlCiAgICBwdWxsOiB0cnVlCiAgICBlbnZpcm9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DLkmLqNK-PDWEBN4QLKraak \ No newline at end of file diff --git a/Makefile b/Makefile index 5676a836b..b0f6f7079 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,4 @@ DIST := dist -BIN := bin - EXECUTABLE := gitea IMPORT := code.gitea.io/gitea @@ -35,7 +33,7 @@ all: build .PHONY: clean clean: go clean -i ./... - rm -rf $(BIN) $(DIST) + rm -rf $(EXECUTABLE) $(DIST) .PHONY: fmt fmt: @@ -99,32 +97,17 @@ 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) + xgo -dest $(DIST)/binaries -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -targets '$(TARGETS)' -out $(EXECUTABLE)-$(VERSION) $(IMPORT) .PHONY: release-copy release-copy: mkdir -p $(DIST)/release - $(foreach file,$(wildcard $(BIN)/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));) + $(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));) .PHONY: release-check release-check: cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;) -.PHONY: latest -latest: release-build latest-copy latest-check - -.PHONY: latest-copy -latest-copy: - mkdir -p $(DIST)/latest - $(foreach file,$(wildcard $(BIN)/$(EXECUTABLE)-*),cp $(file) $(DIST)/latest/$(subst $(EXECUTABLE)-$(VERSION),$(EXECUTABLE)-latest,$(notdir $(file)));) - -.PHONY: latest-check -latest-check: - cd $(DIST)/latest; $(foreach file,$(wildcard $(DIST)/latest/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;) - -.PHONY: publish -publish: release latest - .PHONY: bindata bindata: modules/bindata/bindata.go diff --git a/cmd/cert.go b/cmd/cert.go index c30d4ddb7..4d05f86b4 100644 --- a/cmd/cert.go +++ b/cmd/cert.go @@ -1,7 +1,6 @@ -// +build cert - // Copyright 2009 The Go Authors. All rights reserved. // Copyright 2014 The Gogs Authors. All rights reserved. +// Copyright 2016 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. diff --git a/cmd/cert_stub.go b/cmd/cert_stub.go deleted file mode 100644 index 75536f5a7..000000000 --- a/cmd/cert_stub.go +++ /dev/null @@ -1,30 +0,0 @@ -// +build !cert - -// Copyright 2009 The Go Authors. All rights reserved. -// Copyright 2014 The Gogs Authors. All rights reserved. -// Use of this source code is governed by a MIT-style -// license that can be found in the LICENSE file. - -package cmd - -import ( - "fmt" - "os" - - "github.com/urfave/cli" -) - -// CmdCert represents the available cert sub-command. -var CmdCert = cli.Command{ - Name: "cert", - Usage: "Generate self-signed certificate", - Description: `Please use build tags "cert" to rebuild Gogs in order to have this ability`, - Action: runCert, -} - -func runCert(*cli.Context) error { - fmt.Println("Command cert not available, please use build tags 'cert' to rebuild.") - os.Exit(1) - - return nil -} diff --git a/modules/setting/miniwinsvc.go b/modules/setting/miniwinsvc.go deleted file mode 100644 index 02e8eb91f..000000000 --- a/modules/setting/miniwinsvc.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build miniwinsvc - -// Copyright 2015 The Gogs Authors. All rights reserved. -// Use of this source code is governed by a MIT-style -// license that can be found in the LICENSE file. - -package setting - -import ( - _ "github.com/kardianos/minwinsvc" -) - -func init() { - SupportMiniWinService = true -} diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 12025a27b..2ee8ce94d 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -22,6 +22,7 @@ import ( _ "github.com/go-macaron/cache/redis" "github.com/go-macaron/session" _ "github.com/go-macaron/session/redis" // redis plugin for store session + _ "github.com/kardianos/minwinsvc" // import minwinsvc for windows services "gopkg.in/ini.v1" "strk.kbt.io/projects/go/libravatar" @@ -259,7 +260,6 @@ var ( ShowFooterBranding bool ShowFooterVersion bool ShowFooterTemplateLoadTime bool - SupportMiniWinService bool // Global setting objects Cfg *ini.File diff --git a/routers/init.go b/routers/init.go index 07f84a25f..b6b9911c8 100644 --- a/routers/init.go +++ b/routers/init.go @@ -70,9 +70,6 @@ func GlobalInit() { if models.EnableTiDB { log.Info("TiDB Supported") } - if setting.SupportMiniWinService { - log.Info("Builtin Windows Service Supported") - } checkRunMode() if setting.InstallLock && setting.SSH.StartBuiltinServer {