aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMichael Li <alimy@gility.net>2020-02-17 22:48:24 +0800
committerGitHub <noreply@github.com>2020-02-17 22:48:24 +0800
commit4d83fd4238e177d9327c760a5386bc53f25dedbb (patch)
tree4c730773e80d0110a449392513b88d70cf1e85fe /Makefile
parentfd14ad6ce9bfe14e2a551845f27058ecf3853d74 (diff)
Use go-bindata to embed `public` and `templates` files into binary (#5920)
* fixed private repositories are hidden in the organization's view * use go-bindata integrate public and templates files to gogs binary * optimize Dockerfile don't COPY public and templates files * use kevinburke's go-bindata to generate assets code * reset develepment as default run mode in configure file * optimize generated assets code relayout and help function * fixed code format * Update conf/app.ini * assets: add LICENSE headers * Some housekeeping * assets/public: simplify code logic * assets/templates: simplify code logic * cmd/web: more concise variable names * Minor changes * Add custom public and templates support back Co-authored-by: ᴜɴᴋɴᴡᴏɴ <u@gogs.io>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 23 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 8fab9b1b..b221e5de 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,12 @@
LDFLAGS += -X "gogs.io/gogs/internal/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
-LDFLAGS += -X "gogs.io/gogs/internal/setting.BuildGitHash=$(shell git rev-parse HEAD)"
+LDFLAGS += -X "gogs.io/gogs/internal/setting.BuildCommit=$(shell git rev-parse HEAD)"
-DATA_FILES := $(shell find conf | sed 's/ /\\ /g')
+CONF_FILES := $(shell find conf | sed 's/ /\\ /g')
+TEMPLATES_FILES := $(shell find templates | sed 's/ /\\ /g')
+PUBLIC_FILES := $(shell find public | sed 's/ /\\ /g')
LESS_FILES := $(wildcard public/less/gogs.less public/less/_*.less)
-GENERATED := internal/bindata/bindata.go public/css/gogs.css
+ASSETS_GENERATED := internal/assets/conf/conf_gen.go internal/assets/templates/templates_gen.go internal/assets/public/public_gen.go
+GENERATED := $(ASSETS_GENERATED) public/css/gogs.css
OS := $(shell uname)
@@ -15,7 +18,7 @@ RELEASE_GOGS = "release/gogs"
NOW = $(shell date -u '+%Y%m%d%I%M%S')
GOVET = go tool vet -composites=false -methods=false -structtags=false
-.PHONY: build pack release bindata clean
+.PHONY: build pack release generate clean
.IGNORE: public/css/gogs.css
@@ -45,16 +48,27 @@ build-dev-race: $(GENERATED) govet
pack:
rm -rf $(RELEASE_GOGS)
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
+ cp -r gogs LICENSE README.md README_ZH.md scripts $(RELEASE_GOGS)
cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
release: build pack
-bindata: internal/bindata/bindata.go
+generate: $(ASSETS_GENERATED)
-internal/bindata/bindata.go: $(DATA_FILES)
- go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS|auth.d" -pkg=bindata conf/...
+internal/assets/conf/conf_gen.go: $(CONF_FILES)
+ -rm -f $@
+ go generate internal/assets/conf/conf.go
+ gofmt -s -w $@
+
+internal/assets/templates/templates_gen.go: $(TEMPLATES_FILES)
+ -rm -f $@
+ go generate internal/assets/templates/templates.go
+ gofmt -s -w $@
+
+internal/assets/public/public_gen.go: $(PUBLIC_FILES)
+ -rm -f $@
+ go generate internal/assets/public/public.go
+ gofmt -s -w $@
less: public/css/gogs.css