Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Makefile - github.com/nextcloud/tasks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a197bb75f0f62221e2335c298719ad2ea4f0887d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# This file is licensed under the Affero General Public License version 3 or
# later. See the COPYING file.
# @author Bernhard Posselt <dev@bernhard-posselt.com>
# @copyright Bernhard Posselt 2017
# @author Georg Ehrke <oc.list@georgehrke.com>
# @copyright Georg Ehrke 2017
# @author Raimund Schlüßler
# @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>

# Generic Makefile for building and packaging a Nextcloud app which uses npm and
# Composer.
#
# Dependencies:
# * make
# * which
# * curl: used if phpunit and composer are not installed to fetch them from the web
# * tar: for building the archive
# * npm: for building and testing everything JS
#
# The npm command by launches the npm build script:
#
#    npm run build
#
# The npm test command launches the npm test script:
#
#    npm run test
#

app_name=$(notdir $(CURDIR))
build_directory=$(CURDIR)/build
appstore_build_directory=$(CURDIR)/build/appstore/$(app_name)
appstore_artifact_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_artifact_directory)/$(app_name)
npm=$(shell which npm 2> /dev/null)
gcp=$(shell which gcp 2> /dev/null)

ifeq (, $(gcp))
	copy_command=cp
else
	copy_command=gcp
endif

# code signing
# assumes the following:
# * the app is inside the nextcloud/apps folder
# * the private key is located in ~/.nextcloud/tasks.key
# * the certificate is located in ~/.nextcloud/tasks.crt
occ=$(CURDIR)/../../occ
configdir=$(CURDIR)/../../config
private_key=$(HOME)/.nextcloud/$(app_name).key
certificate=$(HOME)/.nextcloud/$(app_name).crt
sign=php -f $(occ) integrity:sign-app --privateKey="$(private_key)" --certificate="$(certificate)"
sign_skip_msg="Skipping signing, either no key and certificate found in $(private_key) and $(certificate) or occ can not be found at $(occ)"
ifneq ("$(wildcard $(private_key))","") #(,$(wildcard $(private_key)))
	ifneq ("$(wildcard $(certificate))","")#(,$(wildcard $(certificate)))
		ifneq ("$(wildcard $(occ))","")#(,$(wildcard $(occ)))
			CAN_SIGN=true
		endif
	endif
endif

.PHONY: all
all: dev-setup build-svg-sprite build-js-production

# cleanup and generate a clean developement setup
dev-setup: clean clean-dev npm-init

npm-init:
	npm install

npm-update:
	npm update

# Runs the development build
build-js:
	npm run dev

# Runs the production build
build-js-production:
	npm run build

# Runs the development build and keep watching
watch-js:
	npm run watch

# Build the svg sprite
build-svg-sprite:
	npm run svg_sprite

composer.phar:
	curl -sS https://getcomposer.org/installer | php

install-composer-deps-dev: composer.phar
	php composer.phar install -o

update-composer: composer.phar
	rm -f composer.lock
	php composer.phar install --prefer-dist

# Removes the build directory and the compiled files
.PHONY: clean
clean:
	rm -f ./css/sprites.scss
	rm -f ./css/sprites-bw.scss
	rm -f ./css/sprites-color.scss
	rm -f ./img/sprites.svg
	rm -f ./img/bw.svg
	rm -f ./img/color.svg
	rm -f ./js/tasks.js
	rm -f ./js/tasks.js.map
	rm -rf $(build_directory)

# Same as clean but also removes dependencies installed by npm
.PHONY: clean-dev
clean-dev:
	rm -rf node_modules

# Builds the source package for the app store
.PHONY: appstore
appstore: clean build-svg-sprite build-js-production
	mkdir -p $(appstore_build_directory) $(appstore_artifact_directory)
	rsync -av .	$(appstore_build_directory) \
	--exclude=/.git \
	--exclude=/.github \
	--exclude=/.babelrc \
	--exclude=/.babelrc.js \
	--exclude=/.codecov.yml \
	--exclude=/.editorconfig \
	--exclude=/.eslintrc.js \
	--exclude=/.gitattributes \
	--exclude=/.gitignore \
	--exclude=/.phpunit.result.cache \
	--exclude=/.php_cs.cache \
	--exclude=/.php_cs.dist \
	--exclude=/.gitlab-ci.yml \
	--exclude=/.prettierrc.js \
	--exclude=/.scrutinizer.yml \
	--exclude=/.stylelintrc \
	--exclude=/.travis.yml \
	--exclude=/.tx \
	--exclude=/.v8flags*.json \
	--exclude=/build.xml \
	--exclude=/composer.json \
	--exclude=/composer.lock \
	--exclude=/composer.phar \
	--exclude=/CONTRIBUTING.md \
	--exclude=/issue_template.md \
	--exclude=/gulpfile.js \
	--exclude=/Makefile \
	--exclude=/package-lock.json \
	--exclude=/package.json \
	--exclude=/phpunit.xml \
	--exclude=/phpunit.integration.xml \
	--exclude=/README.md \
	--exclude=/svg-sprite-bw.json \
	--exclude=/svg-sprite-bw.tmpl \
	--exclude=/svg-sprite-color.json \
	--exclude=/svg-sprite-color.tmpl \
	--exclude=/webpack.common.js \
	--exclude=/webpack.prod.js \
	--exclude=/webpack.dev.js \
	--exclude=/build \
	--exclude=/coverage \
	--exclude=/img/src \
	--exclude=/src \
	--exclude=/node_modules \
	--exclude=/screenshots/ \
	--exclude=/test \
	--exclude=/tests \
	--exclude=/vendor
ifdef CAN_SIGN
	mv $(configdir)/config.php $(configdir)/config-2.php
	$(sign) --path="$(appstore_build_directory)"
	mv $(configdir)/config-2.php $(configdir)/config.php
else
	@echo $(sign_skip_msg)
endif
	cd $(appstore_build_directory)/../; \
	zip -r $(appstore_package_name).zip $(app_name)
	tar -czf $(appstore_package_name).tar.gz -C $(appstore_build_directory)/../ $(app_name)
# create hash
ifdef CAN_SIGN
	openssl dgst -sha512 -sign $(private_key) $(appstore_package_name).tar.gz | openssl base64 -out $(appstore_artifact_directory)/$(app_name).sha512
else
	@echo "Skipping hashing, no key found in $(private_key)."
endif

# Command for running VUE tests
.PHONY: test
test:
	$(npm) run test

test-php:
	phpunit -c phpunit.xml
	phpunit -c phpunit.integration.xml

test-php-coverage:
	phpunit -c phpunit.xml --coverage-clover=coverage-unit.xml
	phpunit -c phpunit.integration.xml --coverage-clover=coverage-integration.xml

lint-php:
	php composer.phar run-script cs:check