2017-10-09 18:34:25 +03:00
|
|
|
# This file is licensed under the Affero General Public License version 3 or
|
|
|
|
# later. See the COPYING file.
|
|
|
|
# @author Bernhard Posselt <dev@bernhard-posselt.com>
|
2021-05-22 18:13:16 +03:00
|
|
|
# @author Vinzenz Rosenkranz <vinzenz.rosenkranz@gmail.com>
|
|
|
|
# @author René Gieling <github@dartcafe.de>
|
2017-10-09 18:34:25 +03:00
|
|
|
# @copyright Bernhard Posselt 2016
|
|
|
|
|
|
|
|
# Dependencies:
|
|
|
|
# * make
|
|
|
|
# * which
|
2019-01-02 22:59:42 +03:00
|
|
|
# * npm
|
2017-10-09 18:34:25 +03:00
|
|
|
# * curl: used if phpunit and composer are not installed to fetch them from the web
|
|
|
|
# * tar: for building the archive
|
|
|
|
|
2019-01-03 02:29:30 +03:00
|
|
|
app_name=polls
|
|
|
|
|
2019-12-10 09:31:13 +03:00
|
|
|
project_dir=.
|
|
|
|
build_dir=./build
|
2019-01-02 22:59:42 +03:00
|
|
|
build_tools_dir=$(build_dir)/tools
|
|
|
|
build_source_dir=$(build_dir)/source
|
|
|
|
appstore_build_dir=$(build_dir)/artifacts/appstore
|
|
|
|
appstore_package_name=$(appstore_build_dir)/$(app_name)
|
|
|
|
nc_cert_dir=$(HOME)/.nextcloud/certificates
|
2017-10-09 18:34:25 +03:00
|
|
|
composer=$(shell which composer 2> /dev/null)
|
2021-05-22 18:13:16 +03:00
|
|
|
version=$(shell node -p -e "require('./package.json').version")
|
2017-10-09 18:34:25 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
# all steps for an appstore release
|
|
|
|
appstore: setup-build build-js-production package
|
2019-01-02 22:59:42 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
# install deps for release package
|
|
|
|
setup-build: install-composer-build-deps npm-init
|
2019-01-02 22:59:42 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
# install deps for ci (tests and analysis)
|
|
|
|
setup-dev: composer install-composer-dev-deps npm-init
|
|
|
|
|
|
|
|
# install composer deps for ci (tests and analysis)
|
|
|
|
install-composer-build-deps: composer
|
|
|
|
composer install --no-dev -o
|
|
|
|
|
|
|
|
# install composer deps for release package
|
|
|
|
install-composer-dev-deps: composer
|
|
|
|
composer install -o
|
|
|
|
|
|
|
|
# install node deps
|
2019-01-02 22:59:42 +03:00
|
|
|
npm-init:
|
2020-08-31 23:57:17 +03:00
|
|
|
npm ci
|
2019-01-02 22:59:42 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
# remove build dir
|
|
|
|
clean:
|
|
|
|
rm -rf $(build_dir)
|
|
|
|
|
|
|
|
# remove deps
|
|
|
|
clean-dev: clean
|
|
|
|
rm -rf node_modules
|
|
|
|
rm -rf ./vendor
|
2017-10-09 18:34:25 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
# lint js, css and php
|
2019-01-02 22:59:42 +03:00
|
|
|
lint:
|
|
|
|
npm run lint
|
2021-05-22 18:13:16 +03:00
|
|
|
npm run stylelint
|
2020-12-12 13:47:56 +03:00
|
|
|
composer run cs:check
|
2019-01-02 22:59:42 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
# lint fix js, css and php
|
2019-01-02 22:59:42 +03:00
|
|
|
lint-fix:
|
|
|
|
npm run lint:fix
|
2021-05-22 18:13:16 +03:00
|
|
|
npm run stylelint:fix
|
2020-12-12 13:47:56 +03:00
|
|
|
composer run cs:fix
|
2019-01-02 22:59:42 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
# build vue app
|
2019-01-04 07:46:47 +03:00
|
|
|
build-js-production:
|
2021-05-22 18:13:16 +03:00
|
|
|
npm run build
|
|
|
|
|
|
|
|
# install composer, if not installed
|
|
|
|
.PHONY: composer
|
|
|
|
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
|
|
|
|
endif
|
2019-01-02 22:59:42 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
# Builds the source package for the appstore
|
|
|
|
# signs, if certificate is present
|
|
|
|
package: clean
|
2019-01-03 00:01:38 +03:00
|
|
|
mkdir -p $(build_source_dir)
|
|
|
|
mkdir -p $(appstore_build_dir)
|
2021-05-22 18:13:16 +03:00
|
|
|
rsync -zarh \
|
|
|
|
$(project_dir)/appinfo \
|
2021-05-22 20:18:51 +03:00
|
|
|
$(project_dir)/img \
|
2021-05-22 18:13:16 +03:00
|
|
|
$(project_dir)/js \
|
|
|
|
$(project_dir)/l10n \
|
|
|
|
$(project_dir)/lib \
|
|
|
|
$(project_dir)/templates \
|
|
|
|
$(project_dir)/vendor \
|
|
|
|
$(project_dir)/COPYING \
|
|
|
|
$(project_dir)/README.md \
|
|
|
|
$(project_dir)/CHANGELOG.md \
|
|
|
|
$(build_source_dir)/$(app_name)
|
2019-01-03 02:29:30 +03:00
|
|
|
tar -czf $(appstore_package_name).tar.gz \
|
2019-01-02 22:59:42 +03:00
|
|
|
--directory="$(build_source_dir)" $(app_name)
|
|
|
|
@if [ -f $(nc_cert_dir)/$(app_name).key ]; then \
|
2017-10-21 17:47:11 +03:00
|
|
|
echo "Signing package..."; \
|
2019-01-02 22:59:42 +03:00
|
|
|
openssl dgst -sha512 -sign $(nc_cert_dir)/$(app_name).key $(appstore_build_dir)/$(app_name).tar.gz | openssl base64; \
|
2017-10-21 17:47:11 +03:00
|
|
|
fi
|
2017-10-21 16:18:45 +03:00
|
|
|
|
2021-05-22 18:13:16 +03:00
|
|
|
|
2017-10-09 18:34:25 +03:00
|
|
|
.PHONY: test
|
2021-05-22 18:13:16 +03:00
|
|
|
test: composer install-composer-dev-deps
|
2021-02-12 12:13:57 +03:00
|
|
|
$(CURDIR)/vendor/phpunit/phpunit/phpunit --coverage-clover clover.xml -c tests/phpunit.xml
|
2017-10-09 19:34:48 +03:00
|
|
|
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml
|