-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMakefile
211 lines (164 loc) Β· 7.21 KB
/
Makefile
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
203
204
205
206
207
208
209
210
211
SHELL := /bin/bash
COMPOSER_BIN := $(shell command -v composer 2> /dev/null)
NPM := $(shell command -v npm 2> /dev/null)
NODE_PREFIX=$(shell pwd)
# bin file definitions
PHPUNIT=php -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit"
PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "$(PWD)/../../lib/composer/bin/phpunit"
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
PHP_CODESNIFFER=vendor-bin/php_codesniffer/vendor/bin/phpcs
PHAN=php -d zend.enable_gc=0 vendor-bin/phan/vendor/bin/phan
PHPSTAN=php -d zend.enable_gc=0 vendor-bin/phpstan/vendor/bin/phpstan
BEHAT_BIN=vendor-bin/behat/vendor/bin/behat
BOWER=$(NODE_PREFIX)/node_modules/bower/bin/bower
JSDOC=$(NODE_PREFIX)/node_modules/.bin/jsdoc
app_name=$(notdir $(CURDIR))
ldap_doc_files=LICENSE README.md CHANGELOG.md
ldap_src_dirs=appinfo css img js lib l10n templates vendor
ldap_all_src=$(ldap_src_dirs) $(ldap_doc_files)
build_dir=$(CURDIR)/build
dist_dir=$(build_dir)/dist
# internal aliases
composer_deps=
acceptance_test_deps=vendor-bin/behat/vendor
nodejs_deps=node_modules
bower_deps=vendor/ui-multiselect
occ=$(CURDIR)/../../occ
private_key=$(HOME)/.owncloud/certificates/$(app_name).key
certificate=$(HOME)/.owncloud/certificates/$(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)))
ifneq (,$(wildcard $(certificate)))
ifneq (,$(wildcard $(occ)))
CAN_SIGN=true
endif
endif
endif
#
# Catch-all rules
#
.DEFAULT_GOAL := help
# start with displaying help
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | sed -e 's/ */ /' | column -t -s :
.PHONY: all
all: $(bower_deps)
.PHONY: clean
clean: clean-composer-deps clean-dist clean-build
.PHONY: clean-composer-deps
clean-composer-deps:
rm -Rf vendor
rm -Rf vendor-bin/**/vendor vendor-bin/**/composer.lock
#
# Node JS dependencies for tools
#
$(nodejs_deps): package.json
$(NPM) install --prefix $(NODE_PREFIX) && touch $@
$(BOWER): $(nodejs_deps)
$(JSDOC): $(nodejs_deps)
$(bower_deps): $(BOWER)
$(BOWER) install --allow-root && touch $@
#
# dist
#
$(dist_dir)/user_ldap: $(bower_deps)
rm -Rf $@; mkdir -p $@
cp -R $(ldap_all_src) $@
find $@/vendor -type d -iname Test? -print | xargs rm -Rf
find $@/vendor -name travis -print | xargs rm -Rf
find $@/vendor -name doc -print | xargs rm -Rf
find $@/vendor -iname \*.sh -delete
find $@/vendor -iname \*.exe -delete
ifdef CAN_SIGN
$(sign) --path="$(dist_dir)/user_ldap"
else
@echo $(sign_skip_msg)
endif
tar -czf $(dist_dir)/user_ldap.tar.gz -C $(dist_dir) $(app_name)
.PHONY: dist
dist: $(dist_dir)/user_ldap
.PHONY: clean-dist
clean-dist:
rm -Rf $(dist_dir)
.PHONY: clean-build
clean-build:
rm -Rf $(build_dir)
.PHONY: test-php-phan
test-php-phan: ## Run phan
test-php-phan: vendor-bin/phan/vendor
$(PHAN) --config-file .phan/config.php --require-config-exists -p
.PHONY: test-php-phpstan
test-php-phpstan: ## Run phpstan
test-php-phpstan: vendor-bin/phpstan/vendor
$(PHPSTAN) analyse --memory-limit=4G --configuration=./phpstan.neon --no-progress --level=5 appinfo lib
.PHONY: test-php-style
test-php-style: ## Run php-cs-fixer and check owncloud code-style
test-php-style: vendor-bin/owncloud-codestyle/vendor vendor-bin/php_codesniffer/vendor
$(PHP_CS_FIXER) fix -v --diff --dry-run --allow-risky yes
$(PHP_CODESNIFFER) --runtime-set ignore_warnings_on_exit --standard=phpcs.xml tests/acceptance
.PHONY: test-php-style-fix
test-php-style-fix: ## Run php-cs-fixer and fix code-style issues
test-php-style-fix: vendor-bin/owncloud-codestyle/vendor
$(PHP_CS_FIXER) fix -v --diff --allow-risky yes
.PHONY: test-php-unit
test-php-unit: ## Run php unit tests
test-php-unit: $(composer_dev_deps)
$(PHPUNIT) --configuration ./phpunit.xml --testsuite unit
.PHONY: test-php-unit-dbg
test-php-unit-dbg: ## Run php unit tests using phpdbg
test-php-unit-dbg: $(composer_dev_deps)
$(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit
.PHONY: test-acceptance-core-api
test-acceptance-core-api: ## Run core API acceptance tests
test-acceptance-core-api: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type api --tags "~@skipOnLDAP&&~@skip&&${BEHAT_FILTER_TAGS}" -c ../../tests/acceptance/config/behat.yml
.PHONY: test-acceptance-core-cli
test-acceptance-core-cli: ## Run core CLI acceptance tests
test-acceptance-core-cli: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type cli --tags "~@skipOnLDAP&&~@skip&&${BEHAT_FILTER_TAGS}" -c ../../tests/acceptance/config/behat.yml
.PHONY: test-acceptance-core-webui
test-acceptance-core-webui: ## Run core webUI acceptance tests
test-acceptance-core-webui: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type webui --tags "~@skipOnLDAP&&~@skip&&${BEHAT_FILTER_TAGS}" -c ../../tests/acceptance/config/behat.yml
.PHONY: test-acceptance-api
test-acceptance-api: ## Run LDAP API acceptance tests
test-acceptance-api: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type api
.PHONY: test-acceptance-cli
test-acceptance-cli: ## Run LDAP CLI acceptance tests
test-acceptance-cli: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type cli
.PHONY: test-acceptance-webui
test-acceptance-webui: ## Run LDAP webUI acceptance tests
test-acceptance-webui: $(acceptance_test_deps)
BEHAT_BIN=$(BEHAT_BIN) ../../tests/acceptance/run.sh --remote --type webui
#
# Dependency management
#--------------------------------------
composer.lock: composer.json
@echo composer.lock is not up to date.
vendor: composer.lock
composer install --no-dev
vendor/bamarni/composer-bin-plugin: composer.lock
composer install
vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock
composer bin owncloud-codestyle install --no-progress
vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json
@echo owncloud-codestyle composer.lock is not up to date.
vendor-bin/php_codesniffer/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/php_codesniffer/composer.lock
composer bin php_codesniffer install --no-progress
vendor-bin/php_codesniffer/composer.lock: vendor-bin/php_codesniffer/composer.json
@echo php_codesniffer composer.lock is not up to date.
vendor-bin/phan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phan/composer.lock
composer bin phan install --no-progress
vendor-bin/phan/composer.lock: vendor-bin/phan/composer.json
@echo phan composer.lock is not up to date.
vendor-bin/phpstan/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/phpstan/composer.lock
composer bin phpstan install --no-progress
vendor-bin/phpstan/composer.lock: vendor-bin/phpstan/composer.json
@echo phpstan composer.lock is not up to date.
vendor-bin/behat/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/behat/composer.lock
composer bin behat install --no-progress
vendor-bin/behat/composer.lock: vendor-bin/behat/composer.json
@echo behat composer.lock is not up to date.