-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Makefile
149 lines (115 loc) · 3.69 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
# Makefile for building the project
app_name=facerecognition
project_dir=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build/artifacts
build_tools_dir=$(CURDIR)/build/tools
sign_dir=$(build_dir)/sign
appstore_dir=$(build_dir)/appstore
source_dir=$(build_dir)/source
package_name=$(app_name)
cert_dir=$(HOME)/.nextcloud/certificates
composer=$(shell which composer 2> /dev/null)
# Default rule
default: build
# Some utils rules
test-bin-deps:
@echo "================================================================================"
@echo "Checking binaries needed to build the application."
@echo "Testing node, npm, and curl. If one is missing, install it with the tools of "
@echo "your system."
@echo "================================================================================"
node -v
npm -v
curl -V
composer:
ifeq (,$(composer))
@echo "No composer command available, downloading a copy from the web"
mkdir -p $(build_tools_dir)
curl -sS https://getcomposer.org/installer | php
mv composer.phar $(build_tools_dir)
php $(build_tools_dir)/composer.phar install --prefer-dist
php $(build_tools_dir)/composer.phar update --prefer-dist
else
composer install --prefer-dist
composer update --prefer-dist
endif
# Dependencies of the application
npm-deps:
npm i
js/vendor/handlebars.js: npm-deps
mkdir -p js/vendor
cp node_modules/handlebars/dist/handlebars.js -f js/vendor/handlebars.js
js/vendor/lozad.js: npm-deps
mkdir -p js/vendor
cp node_modules/lozad/dist/lozad.js -f js/vendor/lozad.js
js/vendor/autocomplete.js:
mkdir -p js/vendor
wget https://raw.githubusercontent.com/realsuayip/autocomplete/master/dist/autocomplete.js -O js/vendor/autocomplete.js
js/vendor/egg.js:
mkdir -p js/vendor
wget https://raw.githubusercontent.com/mikeflynn/egg.js/master/egg.js -O js/vendor/egg.js
js/vendor/facerecognition-dialogs.js:
cp src/dialogs.js -f js/facerecognition-dialogs.js
javascript-deps: js/vendor/handlebars.js js/vendor/autocomplete.js js/vendor/lozad.js js/vendor/egg.js js/vendor/facerecognition-dialogs.js
vendor-deps: composer javascript-deps
# L10N Rules
l10n-update-pot:
php translationtool.phar create-pot-files
l10n-transifex-pull:
tx pull -s -a
l10n-transifex-push:
tx push -s -t
l10n-transifex-apply:
php translationtool.phar convert-po-files
l10n-clean:
rm -rf translationfiles
rm -f translationtool.phar
l10n-deps:
@echo "Checking transifex client."
tx --version
@echo "Downloading translationtool.phar"
curl -L https://github.com/nextcloud/docker-ci/raw/master/translations/translationtool/translationtool.phar -o translationtool.phar
# Build Rules
build-dev:
npm run dev
build-vue:
npm run build
js-templates:
node_modules/handlebars/bin/handlebars src/templates -f js/facerecognition-templates.js
build: test-bin-deps build-vue vendor-deps js-templates
@echo ""
@echo "Build done. You can enable the application in Nextcloud."
appstore:
mkdir -p $(sign_dir)
rsync -a \
--exclude='.*' \
--exclude=build \
--exclude=cli \
--exclude=composer* \
--exclude=translation* \
--exclude=node_modules \
--exclude=Makefile \
--exclude=package*json \
--exclude=phpunit*xml \
--exclude=psalm.xml \
--exclude=screenshots \
--exclude=src \
--exclude=tests \
--exclude=webpack* \
--exclude=js/*map \
--exclude=js/templates \
--include=js/vendor \
--exclude=vendor \
$(project_dir) $(sign_dir)
@echo "Signing…"
tar -czf $(build_dir)/$(app_name).tar.gz \
-C $(sign_dir) $(app_name)
openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name).tar.gz | openssl base64
test: composer
./vendor/bin/phpunit --coverage-clover clover.xml -c phpunit.xml
clean: l10n-clean
rm -rf js/vendor
rm -f js/*.map
rm -rf build
rm -rf vendor
rm -rf node_modules