@@ -4,13 +4,14 @@ export GO111MODULE=off
4
4
5
5
GO ?= go
6
6
SED_INPLACE := sed -i
7
+ SHASUM ?= shasum -a 256
7
8
8
9
export PATH := $($(GO ) env GOPATH) /bin:$(PATH )
9
10
10
11
ifeq ($(OS ) , Windows_NT)
11
- EXECUTABLE : = gitea.exe
12
+ EXECUTABLE ? = gitea.exe
12
13
else
13
- EXECUTABLE : = gitea
14
+ EXECUTABLE ? = gitea
14
15
UNAME_S := $(shell uname -s)
15
16
ifeq ($(UNAME_S),Darwin)
16
17
SED_INPLACE := sed -i ''
@@ -24,6 +25,8 @@ GOFMT ?= gofmt -s
24
25
GOFLAGS := -i -v
25
26
EXTRA_GOFLAGS ?=
26
27
28
+ MAKE_VERSION := $(shell make -v | head -n 1)
29
+
27
30
ifneq ($(DRONE_TAG ) ,)
28
31
VERSION ?= $(subst v,,$(DRONE_TAG))
29
32
GITEA_VERSION ?= $(VERSION)
36
39
GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
37
40
endif
38
41
39
- LDFLAGS := -X "main.Version=$(GITEA_VERSION ) " -X "main.Tags=$(TAGS ) "
42
+ LDFLAGS := $( LDFLAGS ) -X "main.MakeVersion= $( MAKE_VERSION ) " -X "main.Version=$(GITEA_VERSION ) " -X "main.Tags=$(TAGS ) "
40
43
41
44
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO ) list ./... | grep -v /vendor/) ) )
42
45
SOURCES ?= $(shell find . -name "* .go" -type f)
@@ -46,8 +49,9 @@ TAGS ?=
46
49
TMPDIR := $(shell mktemp -d 2>/dev/null || mktemp -d -t 'gitea-temp')
47
50
48
51
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
49
- SWAGGER_SPEC_S_TMPL := s|"basePath":\s*"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g
50
- SWAGGER_SPEC_S_JSON := s|"basePath":\s*"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g
52
+ SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g
53
+ SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g
54
+ SWAGGER_NEWLINE_COMMAND := -e '$$a\'
51
55
52
56
TEST_MYSQL_HOST ?= mysql:3306
53
57
TEST_MYSQL_DBNAME ?= testgitea
@@ -66,12 +70,6 @@ TEST_MSSQL_DBNAME ?= gitea
66
70
TEST_MSSQL_USERNAME ?= sa
67
71
TEST_MSSQL_PASSWORD ?= MwantsaSecurePassword1
68
72
69
- ifeq ($(OS ) , Windows_NT)
70
- EXECUTABLE := gitea.exe
71
- else
72
- EXECUTABLE := gitea
73
- endif
74
-
75
73
# $(call strip-suffix,filename)
76
74
strip-suffix = $(firstword $(subst ., ,$(1 ) ) )
77
75
@@ -111,6 +109,7 @@ generate-swagger:
111
109
fi
112
110
swagger generate spec -o ' ./$(SWAGGER_SPEC)'
113
111
$(SED_INPLACE ) ' $(SWAGGER_SPEC_S_TMPL)' ' ./$(SWAGGER_SPEC)'
112
+ $(SED_INPLACE ) $(SWAGGER_NEWLINE_COMMAND ) ' ./$(SWAGGER_SPEC)'
114
113
115
114
.PHONY : swagger-check
116
115
swagger-check : generate-swagger
@@ -149,7 +148,7 @@ misspell-check:
149
148
@hash misspell > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
150
149
$(GO ) get -u github.com/client9/misspell/cmd/misspell; \
151
150
fi
152
- misspell -error -i unknwon $(GOFILES )
151
+ misspell -error -i unknwon,destory $(GOFILES )
153
152
154
153
.PHONY : misspell
155
154
misspell :
@@ -200,6 +199,10 @@ test-vendor: vendor
200
199
test-sqlite : integrations.sqlite.test
201
200
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
202
201
202
+ .PHONY : test-sqlite\# %
203
+ test-sqlite\#% : integrations.sqlite.test
204
+ GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.run $*
205
+
203
206
.PHONY : test-sqlite-migration
204
207
test-sqlite-migration : migrations.sqlite.test
205
208
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
@@ -324,7 +327,7 @@ release-windows:
324
327
fi
325
328
xgo -dest $(DIST ) /binaries -tags ' netgo $(TAGS)' -ldflags ' -linkmode external -extldflags "-static" $(LDFLAGS)' -targets ' windows/*' -out gitea-$(VERSION ) .
326
329
ifeq ($(CI ) ,drone)
327
- mv /build/* $(DIST)/binaries
330
+ cp /build/* $(DIST)/binaries
328
331
endif
329
332
330
333
.PHONY : release-linux
@@ -334,7 +337,7 @@ release-linux:
334
337
fi
335
338
xgo -dest $(DIST ) /binaries -tags ' netgo $(TAGS)' -ldflags ' -linkmode external -extldflags "-static" $(LDFLAGS)' -targets ' linux/*' -out gitea-$(VERSION ) .
336
339
ifeq ($(CI ) ,drone)
337
- mv /build/* $(DIST)/binaries
340
+ cp /build/* $(DIST)/binaries
338
341
endif
339
342
340
343
.PHONY : release-darwin
@@ -344,23 +347,23 @@ release-darwin:
344
347
fi
345
348
xgo -dest $(DIST ) /binaries -tags ' netgo $(TAGS)' -ldflags ' $(LDFLAGS)' -targets ' darwin/*' -out gitea-$(VERSION ) .
346
349
ifeq ($(CI ) ,drone)
347
- mv /build/* $(DIST)/binaries
350
+ cp /build/* $(DIST)/binaries
348
351
endif
349
352
350
353
.PHONY : release-copy
351
354
release-copy :
352
- $( foreach file, $( wildcard $( DIST )/binaries/ $( EXECUTABLE ) - * ) , cp $( file ) $( DIST ) /release/$( notdir $( file ) ) ;)
355
+ cd $( DIST ); for file in ` find /build -type f -name " * " ` ; do cp $$ { file} . /release/; done ;
353
356
354
357
.PHONY : release-check
355
358
release-check :
356
- cd $(DIST ) /release; $( foreach file, $( wildcard $( DIST ) /release/ $( EXECUTABLE ) - * ) ,sha256sum $( notdir $( file ) ) > $( notdir $( file ) ) .sha256;)
359
+ cd $(DIST ) /release/ ; for file in ` find . -type f -name " * " ` ; do echo " checksumming $$ {file} " && $( SHASUM ) ` echo $$ {file} | sed ' s/^..// ' ` > $$ { file} .sha256; done ;
357
360
358
361
.PHONY : release-compress
359
362
release-compress :
360
363
@hash gxz > /dev/null 2>&1 ; if [ $$ ? -ne 0 ]; then \
361
364
$(GO ) get -u github.com/ulikunitz/xz/cmd/gxz; \
362
365
fi
363
- cd $(DIST ) /release; $( foreach file, $( wildcard $( DIST ) /binaries/ $( EXECUTABLE ) - * ) , gxz -k -9 $( notdir $( file ) ) ;)
366
+ cd $(DIST ) /release/ ; for file in ` find . -type f -name " * " ` ; do echo " compressing $$ {file} " && gxz -k -9 $$ { file} ; done ;
364
367
365
368
.PHONY : javascripts
366
369
javascripts : public/js/index.js
0 commit comments