diff options
author | silverwind <me@silverwind.io> | 2020-03-03 20:51:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-03 13:51:11 -0600 |
commit | fa6ea60c556eeaaba3f90ef8ccb1c68b1b568d01 (patch) | |
tree | af81d04853d6c8d1c3d132263f2c1f72b19eb356 /Makefile | |
parent | aa4a297c164b7fc6df6efe0666e119f904f148f3 (diff) | |
download | gitea-fa6ea60c556eeaaba3f90ef8ccb1c68b1b568d01.tar.gz gitea-fa6ea60c556eeaaba3f90ef8ccb1c68b1b568d01.zip |
Frontend build improvements, fix Fomantic build (#10576)
- add package-lock.json to webpack/fomantic prereqs making them always rebuild when dependencies change.
- remove FOMANTIC_EVIDENCE. It seemed better to just track a few output files instead.
- delete fomantic output files before build to prevent possible bugs in fomantic's build.
- resolve WEBPACK_SOURCES only once for performance
- reorder variables for clarity
- use clean-all in Dockerfile
- detect busybox for find syntax
Fixes: https://github.com/go-gitea/gitea/issues/10569
Fixes: https://github.com/go-gitea/gitea/issues/10565
Fixes: https://github.com/go-gitea/gitea/issues/10570
Fixes: https://github.com/go-gitea/gitea/issues/10568
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -21,6 +21,7 @@ else EXECUTABLE ?= gitea UNAME_S := $(shell uname -s) FIND_PWD_REGEXP := find . -regextype posix-egrep + BUSYBOX := $(shell find --help 2>&1 | grep -o BusyBox) ifeq ($(UNAME_S),Darwin) SED_INPLACE := sed -i '' FIND_PWD_REGEXP := find -E . @@ -29,6 +30,9 @@ else SED_INPLACE := sed -i '' FIND_PWD_REGEXP := find -E . endif + ifeq ($(BUSYBOX),BusyBox) + FIND_PWD_REGEXP := find . + endif endif GOFMT ?= gofmt -s @@ -70,18 +74,17 @@ PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filte GO_SOURCES ?= $(shell $(FIND_PWD_REGEXP) -regex '\./(node_modules|docs|public|options|contrib|data)' -prune -o -name "*.go" -type f -print) GO_SOURCES_OWN := $(filter-out ./vendor/% %/bindata.go, $(GO_SOURCES)) -WEBPACK_SOURCES ?= $(shell find web_src/js web_src/less -type f) +WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f) WEBPACK_CONFIGS := webpack.config.js .eslintrc .stylelintrc - WEBPACK_DEST := public/js/index.js public/css/index.css +WEBPACK_DEST_DIRS := public/js public/css + BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST)) -WEBPACK_DEST_DIRS := public/js public/css - -FOMANTIC_SOURCES ?= web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables +FOMANTIC_CONFIGS := semantic.json web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables +FOMANTIC_DEST := public/fomantic/semantic.min.js public/fomantic/semantic.min.css FOMANTIC_DEST_DIR := public/fomantic -FOMANTIC_EVIDENCE := $(MAKE_EVIDENCE_DIR)/fomantic TAGS ?= TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags @@ -164,7 +167,7 @@ node-check: .PHONY: clean-all clean-all: clean - rm -rf $(WEBPACK_DEST_DIRS) $(FOMANTIC_DEST_DIR) $(FOMANTIC_EVIDENCE) + rm -rf $(WEBPACK_DEST_DIRS) $(FOMANTIC_DEST_DIR) .PHONY: clean clean: @@ -453,7 +456,7 @@ install: $(wildcard *.go) build: frontend backend .PHONY: frontend -frontend: node-check $(FOMANTIC_EVIDENCE) $(WEBPACK_DEST) +frontend: node-check $(FOMANTIC_DEST) $(WEBPACK_DEST) .PHONY: backend backend: go-check generate $(EXECUTABLE) @@ -543,18 +546,19 @@ css: $(MAKE) webpack .PHONY: fomantic -fomantic: $(FOMANTIC_EVIDENCE) +fomantic: $(FOMANTIC_DEST) -$(FOMANTIC_EVIDENCE): semantic.json $(FOMANTIC_SOURCES) | node_modules +$(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) package-lock.json | node_modules + rm -rf $(FOMANTIC_DEST_DIR) cp web_src/fomantic/theme.config.less node_modules/fomantic-ui/src/theme.config cp web_src/fomantic/_site/globals/* node_modules/fomantic-ui/src/_site/globals/ npx gulp -f node_modules/fomantic-ui/gulpfile.js build - @mkdir -p $(MAKE_EVIDENCE_DIR) && touch $(FOMANTIC_EVIDENCE) + @touch $(FOMANTIC_DEST) .PHONY: webpack webpack: $(WEBPACK_DEST) -$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) | node_modules +$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json | node_modules npx eslint web_src/js webpack.config.js npx stylelint web_src/less npx webpack --hide-modules --display-entrypoints=false |