-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
149 lines (122 loc) · 3.56 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
# This file is licensed under the Affero General Public License version 3 or
# later. See the COPYING file.
app_name=$(notdir $(CURDIR))
project_dir=$(CURDIR)/../$(app_name)
build_tools_directory=$(CURDIR)/build/tools
build_dir=$(CURDIR)/build/artifacts
cert_dir=$(HOME)/.nextcloud/certificates
composer=$(shell which composer 2> /dev/null)
.PHONY: composer
all: dev-setup lint build-js-production assemble
# Dev env management
dev-setup: clean clean-dev composer npm-init
# Installs and updates the composer dependencies. If composer is not installed
# a copy is fetched from the web
composer:
ifeq (, $(composer))
@echo "No composer command available, downloading a copy from the web"
mkdir -p $(build_tools_directory)
curl -sS https://getcomposer.org/installer | php
mv composer.phar $(build_tools_directory)
php $(build_tools_directory)/composer.phar install --prefer-dist
php $(build_tools_directory)/composer.phar update --prefer-dist
else
$(composer) install --prefer-dist
$(composer) update --prefer-dist
endif
# Install translationtool from https://github.com/nextcloud/docker-ci/tree/master/translations/translationtool
translationtool:
curl -sSO https://raw.githubusercontent.com/nextcloud/docker-ci/master/translations/translationtool/translationtool.phar
mv translationtool.phar $(build_tools_directory)
# Generate po files to perform translation
generate-po-translation:
php $(build_tools_directory)/translationtool.phar create-pot-files
# Generate nextcloud translation files
generate-nc-translation:
php $(build_tools_directory)/translationtool.phar convert-po-files
npm-init:
npm ci
npm-update:
npm update
# Building
build-js:
npm run dev
build-js-production:
npm run build
watch-js:
npm run watch
serve-js:
npm run serve
# Linting
lint:
npm run lint
lint-fix:
npm run lint:fix
# Style linting
stylelint:
npm run stylelint
stylelint-fix:
npm run stylelint:fix
# Tests
test:
./vendor/phpunit/phpunit/phpunit -c phpunit.xml
# ./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml
##### Building #####
build-test: clean test build-js-production assemble
build: clean build-js-production assemble
appstore: build
@echo "Signing…"
php ../../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 -m \
--exclude=babel.config.js \
--exclude=build \
--exclude=composer.* \
--exclude=CONTRIBUTING.md \
--exclude=.editorconfig \
--exclude=.eslintrc.js \
--exclude=.l10nignore \
--exclude=tsconfig.json \
--exclude=.git \
--exclude=.github \
--exclude=.gitignore \
--exclude=.gitattributes \
--exclude=l10n/no-php \
--exclude=l10n/.gitkeep \
--exclude=Makefile \
--exclude=node_modules \
--exclude=package*.json \
--exclude=.php_cs.* \
--exclude=phpunit*xml \
--exclude=.scrutinizer.yml \
--exclude=src/main.js \
--exclude=src/redirect.js \
--exclude=src/Redirect.vue \
--exclude=src/App.vue \
--exclude=src/components/OIDCItem.vue\
--exclude=.stylelintrc.js \
--exclude=tests \
--exclude=.travis.yml \
--exclude=.tx \
--exclude=.idea \
--exclude=.vscode \
--exclude=webpack*.js \
--exclude=translationfiles \
--exclude=docs \
--exclude=.phpunit.result.cache \
--exclude=stylelint.config.js \
$(project_dir) $(build_dir)
##### Cleaning #####
clean:
rm -rf js/
rm -rf $(build_dir)
clean-dev:
rm -rf node_modules
rm -rf vendor