-
Notifications
You must be signed in to change notification settings - Fork 65
/
Makefile
174 lines (142 loc) · 4.7 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
# This file is licensed under the Affero General Public License version 3 or
# later. See the COPYING file.
# @author Ilja Neumann <ineumann@owncloud.com>
COMPOSER_BIN := $(shell command -v composer 2> /dev/null)
app_name=$(notdir $(CURDIR))
project_directory=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build
build_tools_directory=$(CURDIR)/build/tools
source_build_directory=$(CURDIR)/build/artifacts/source
source_package_name=$(source_build_directory)/$(app_name)
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_build_directory)/$(app_name)
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
# composer
composer_deps=
composer_dev_deps=
#
# Basic required tools
#
#
.PHONY: all
all: $(composer_dev_deps)
# Removes the appstore build
.PHONY: clean
clean: clean-deps
rm -rf ./build/artifacts
.PHONY: clean-deps
clean-deps:
rm -Rf vendor
rm -Rf vendor-bin/**/vendor vendor-bin/**/composer.lock
# Builds the source and appstore package
.PHONY: dist
dist:
make source
make vendor
make appstore
# Builds the source package
.PHONY: source
source:
rm -rf $(source_build_directory)
mkdir -p $(source_build_directory)
tar cvzf $(source_package_name).tar.gz \
--exclude-vcs \
--exclude="../$(app_name)/build" \
--exclude="../$(app_name)/js/node_modules" \
--exclude="../$(app_name)/node_modules" \
--exclude="../$(app_name)/*.log" \
--exclude="../$(app_name)/js/*.log" \
../$(app_name)
# Builds the source package for the app store, ignores php and js tests
.PHONY: appstore
appstore:
rm -rf $(appstore_build_directory)
mkdir -p $(appstore_package_name)
cp --parents -r \
appinfo \
controller \
config \
css \
environment \
http \
img \
l10n \
middleware \
preview \
service \
utility \
templates \
vendor \
js \
README.md \
CHANGELOG.md \
COPYING \
$(appstore_package_name)
ifdef CAN_SIGN
$(sign) --path="$(appstore_package_name)"
else
@echo $(sign_skip_msg)
endif
tar -czf $(appstore_package_name).tar.gz -C $(appstore_package_name)/../ $(app_name)
# bin file definitions
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer
PHPUNIT=php -d zend.enable_gc=0 vendor/bin/phpunit
PHPUNITDBG=phpdbg -qrr -d memory_limit=4096M -d zend.enable_gc=0 "./vendor/bin/phpunit"
.PHONY: test-php-style
test-php-style: ## Run php-cs-fixer and check owncloud code-style
test-php-style: vendor-bin/owncloud-codestyle/vendor
$(PHP_CS_FIXER) fix -v --diff --allow-risky yes --dry-run
.PHONY: test-php-integration
test-php-integration:
test-php-integration: vendor/bin/codecept
php vendor/bin/codecept run integration
.PHONY: test-acceptance
test-acceptance:
test-acceptance: vendor/bin/codecept
php vendor/bin/codecept run 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: vendor/bin/phpunit
$(PHPUNIT) --configuration ./phpunit.xml --testsuite unit
.PHONY: test-php-unit-dbg
test-php-unit-dbg: ## Run php unit tests with php dbg
test-php-unit-dbg: vendor/bin/phpunit
$(PHPUNITDBG) --configuration ./phpunit.xml --testsuite unit
.PHONY: test-php-lint
test-php-lint:
test-php-lint: vendor/bin/parallel-lint
php vendor/bin/parallel-lint --exclude vendor/composer/autoload_static.php --exclude travis --exclude vendor --exclude vendor-bin . vendor/composer vendor/symfony/yaml vendor/autoload.php
#
# Dependency management
#--------------------------------------
composer.lock: composer.json
@echo composer.lock is not up to date.
vendor: composer.lock
composer install --no-dev
vendor/bin/phpunit: composer.lock
composer install
vendor/bin/codecept: composer.lock
composer install
vendor/bin/parallel-lint: composer.lock
composer install
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.