-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
181 lines (135 loc) · 3.83 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
app_name=health
project_dir=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build/artifacts
cert_dir=$(HOME)/.nextcloud/certificates
# php_dirs=appinfo/ lib/ tests/api/
php_dirs=appinfo/ lib/
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_build_directory)/$(app_name)
all: dev-setup build
##### Environment ####
dev-setup: clean clean-dev init
init: composer-init npm-init
composer-init:
composer install
npm-init:
npm install
npm-upgrade:
npm upgrade
npm install
npm-update:
npm update
##### Building #####
build: clean build-js-production assemble
appstore: init build-js-production clean-dist
rm -rf $(appstore_build_directory)
mkdir -p $(appstore_build_directory)
tar cvzf $(appstore_package_name).tar.gz \
--exclude-vcs \
--exclude="../$(app_name)/build" \
--exclude="../$(app_name)/tests" \
--exclude="../$(app_name)/Makefile" \
--exclude="../$(app_name)/*.log" \
--exclude="../$(app_name)/phpunit*xml" \
--exclude="../$(app_name)/composer.*" \
--exclude="../$(app_name)/js/node_modules" \
--exclude="../$(app_name)/js/tests" \
--exclude="../$(app_name)/js/test" \
--exclude="../$(app_name)/js/*.log" \
--exclude="../$(app_name)/js/package.json" \
--exclude="../$(app_name)/js/bower.json" \
--exclude="../$(app_name)/js/karma.*" \
--exclude="../$(app_name)/js/protractor.*" \
--exclude="../$(app_name)/package.json" \
--exclude="../$(app_name)/bower.json" \
--exclude="../$(app_name)/karma.*" \
--exclude="../$(app_name)/protractor\.*" \
--exclude="../$(app_name)/.*" \
--exclude="../$(app_name)/js/.*" \
../$(app_name) \
appstore-local: build
@echo "Signing…"
# php ../server/occ integrity:sign-app \
# --privateKey=$(cert_dir)/$(app_name).key\
# --certificate=$(cert_dir)/$(app_name).crt\
# --path=$(build_dir)/$(app_name)
tar -czf $(build_dir)/$(app_name).tar.gz \
-C $(build_dir) $(app_name)
openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name).tar.gz | openssl base64
assemble:
mkdir -p $(build_dir)
rsync -a \
--exclude=babel.config.js \
--exclude=build \
--exclude=composer.* \
--exclude=CONTRIBUTING.md \
--exclude=.editorconfig \
--exclude=.eslintrc.js \
--exclude=.git \
--exclude=.github \
--exclude=.gitignore \
--exclude=l10n/no-php \
--exclude=Makefile \
--exclude=node_modules \
--exclude=package*.json \
--exclude=.php_cs.* \
--exclude=phpunit*xml \
--exclude=.scrutinizer.yml \
--exclude=src \
--exclude=.stylelintrc.js \
--exclude=tests \
--exclude=.travis.yml \
--exclude=.tx \
--exclude=.idea \
--exclude=vendor \
--exclude=webpack*.js \
$(project_dir) $(build_dir)
build-js:
npm run dev
build-js-production:
npm run build
watch-js:
npm run watch
##### Testing #####
test: test-api
test-api:
phpunit --bootstrap vendor/autoload.php --testdox tests/api/
##### Linting #####
lint: lint-php lint-js lint-css lint-xml
lint-php: lint-php-lint lint-php-cs-fixer lint-php-psalm
lint-php-lint:
# Check PHP syntax errors
@! find $(php_dirs) -name "*.php" | xargs -I{} php -l '{}' | grep -v "No syntax errors detected"
lint-php-cs-fixer:
# PHP Coding Standards Fixer (with Nextcloud coding standards)
vendor/bin/php-cs-fixer fix --dry-run --diff
lint-php-psalm:
composer psalm
lint-js:
npm run lint
lint-css:
npm run stylelint
lint-xml:
# Check info.xml schema validity
wget https://apps.nextcloud.com/schema/apps/info.xsd -P appinfo/ -N --no-verbose || [ -f appinfo/info.xsd ]
xmllint appinfo/info.xml --schema appinfo/info.xsd --noout
##### Fix lint #####
lint-fix: lint-php-fix lint-js-fix lint-css-fix
lint-php-fix:
vendor/bin/php-cs-fixer fix
lint-js-fix:
npm run lint:fix
lint-css-fix:
npm run stylelint:fix
##### Cleaning #####
clean:
rm -rf js/
rm -rf $(build_dir)
clean-dev:
rm -rf node_modules
rm -rf vendor
clean-dist:
make clean-dev
rm -rf ./build
rm -rf js/vendor
rm -rf js/node_modules