Skip to content

Commit 124ff3d

Browse files
authored
Update Makefile
1 parent 8e4ae0a commit 124ff3d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Makefile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ COMMA := ,
2626

2727
XGO_VERSION := go-1.18.x
2828

29-
MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2)
30-
MIN_GO_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' '))
31-
32-
MIN_NODE_VERSION_STR := $(shell grep -Eo '"node":.*[0-9.]+"' package.json | sed -n 's/.*[^0-9.]\([0-9.]*\)"/\1/p')
33-
MIN_NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_NODE_VERSION_STR)' | tr '.' ' '))
34-
3529
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.29.0
3630
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.4.0
3731
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.0
@@ -207,12 +201,13 @@ help:
207201

208202
.PHONY: go-check
209203
go-check:
204+
$(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
205+
$(eval MIN_GO_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' ')))
210206
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');))
211207
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
212208
echo "Gitea requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \
213209
exit 1; \
214210
fi
215-
@echo "checked go matches min version: $(MIN_GO_VERSION_STR)"
216211

217212
.PHONY: git-check
218213
git-check:
@@ -223,13 +218,14 @@ git-check:
223218

224219
.PHONY: node-check
225220
node-check:
221+
$(eval MIN_NODE_VERSION_STR := $(shell grep -Eo '"node":.*[0-9.]+"' package.json | sed -n 's/.*[^0-9.]\([0-9.]*\)"/\1/p'))
222+
$(eval MIN_NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_NODE_VERSION_STR)' | tr '.' ' ')))
226223
$(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | tr '.' ' ');))
227224
$(eval NPM_MISSING := $(shell hash npm > /dev/null 2>&1 || echo 1))
228225
@if [ "$(NODE_VERSION)" -lt "$(MIN_NODE_VERSION)" -o "$(NPM_MISSING)" = "1" ]; then \
229226
echo "Gitea requires Node.js $(MIN_NODE_VERSION_STR) or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \
230227
exit 1; \
231228
fi
232-
@echo "checked nodejs matches min version: $(MIN_NODE_VERSION_STR)"
233229

234230
.PHONY: clean-all
235231
clean-all: clean

0 commit comments

Comments
 (0)