2024-05-29 16:10:43 +03:00
|
|
|
# SPDX-FileCopyrightText: 2016 Nextcloud contributors
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
2017-10-09 18:34:25 +03:00
|
|
|
|
|
|
|
# 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=.
|
2024-10-01 14:06:16 +03:00
|
|
|
build_dir=$(project_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
|
2021-12-08 17:11:33 +03:00
|
|
|
setup-build: setup-build-composer 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)
|
2021-12-08 17:11:33 +03:00
|
|
|
setup-dev: setup-dev-composer npm-init
|
2021-05-22 18:13:16 +03:00
|
|
|
|
|
|
|
# install composer deps for ci (tests and analysis)
|
2021-12-08 17:11:33 +03:00
|
|
|
setup-build-composer: composer
|
2021-05-22 18:13:16 +03:00
|
|
|
composer install --no-dev -o
|
|
|
|
|
|
|
|
# install composer deps for release package
|
2021-12-08 17:11:33 +03:00
|
|
|
setup-dev-composer: composer
|
2021-05-22 18:13:16 +03:00
|
|
|
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-12-08 17:11:33 +03:00
|
|
|
cs:
|
|
|
|
composer run cs:check
|
|
|
|
|
|
|
|
cs-fix:
|
|
|
|
composer run cs:fix
|
|
|
|
|
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)
|
2024-10-01 14:06:16 +03:00
|
|
|
rsync -zarh $(project_dir)/ --files-from="$(project_dir)/sync_list.txt" --exclude="vendor/bin" $(build_source_dir)/$(app_name)
|
|
|
|
tar -czf $(appstore_package_name).tar.gz --directory="$(build_source_dir)" $(app_name)
|
2019-01-02 22:59:42 +03:00
|
|
|
@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-12-08 17:11:33 +03:00
|
|
|
test: composer setup-dev-composer
|
2022-09-12 14:19:40 +03:00
|
|
|
phpunit --coverage-clover clover.xml -c tests/phpunit.xml
|
|
|
|
phpunit -c phpunit.integration.xml
|