2016-06-05 16:07:47 +03:00
|
|
|
app_name=$(notdir $(CURDIR))
|
|
|
|
build_tools_directory=$(CURDIR)/build/tools
|
2017-01-31 11:59:23 +03:00
|
|
|
build_dir=$(CURDIR)/build/artifacts
|
2016-06-05 16:07:47 +03:00
|
|
|
source_build_directory=$(CURDIR)/build/artifacts/source
|
|
|
|
source_package_name=$(source_build_directory)/$(app_name)
|
|
|
|
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
|
|
|
|
appstore_package_name=$(appstore_build_directory)/$(app_name)
|
|
|
|
npm=$(shell which npm 2> /dev/null)
|
|
|
|
composer=$(shell which composer 2> /dev/null)
|
|
|
|
|
2017-01-31 11:59:23 +03:00
|
|
|
sign_dir=$(build_dir)/sign
|
|
|
|
cert_dir=$(HOME)/.nextcloud/certificates
|
2016-06-05 16:07:47 +03:00
|
|
|
|
|
|
|
|
2018-07-10 17:15:51 +03:00
|
|
|
default: package
|
2016-06-05 16:07:47 +03:00
|
|
|
|
2017-01-31 11:59:23 +03:00
|
|
|
clean-build:
|
|
|
|
rm -rf $(build_dir)
|
2016-06-05 16:07:47 +03:00
|
|
|
|
2017-01-31 11:59:23 +03:00
|
|
|
clean-dist:
|
2016-06-05 16:07:47 +03:00
|
|
|
rm -rf js/node_modules
|
|
|
|
|
2018-09-07 17:12:23 +03:00
|
|
|
install-deps: install-deps-js
|
2018-09-07 16:36:14 +03:00
|
|
|
composer install
|
2018-09-07 17:12:23 +03:00
|
|
|
|
|
|
|
install-deps-js:
|
2018-01-22 16:19:02 +03:00
|
|
|
cd js && npm install
|
2017-01-31 11:59:23 +03:00
|
|
|
|
2018-09-07 17:12:23 +03:00
|
|
|
build: install-deps build-js
|
2016-06-05 16:07:47 +03:00
|
|
|
|
2018-09-07 17:12:23 +03:00
|
|
|
build-js: install-deps-js
|
2018-05-12 13:06:45 +03:00
|
|
|
cd js && npm run build
|
|
|
|
|
|
|
|
build-js-dev: install-deps
|
|
|
|
cd js && npm run dev
|
2017-01-31 11:59:23 +03:00
|
|
|
|
2017-01-31 18:16:48 +03:00
|
|
|
watch:
|
2018-05-12 13:06:45 +03:00
|
|
|
cd js && npm run watch
|
2017-01-31 18:16:48 +03:00
|
|
|
|
2017-01-31 11:59:23 +03:00
|
|
|
# appstore: clean install-deps
|
|
|
|
appstore: clean-build build
|
2016-06-05 16:07:47 +03:00
|
|
|
rm -rf $(appstore_build_directory)
|
|
|
|
mkdir -p $(appstore_build_directory)
|
2017-01-31 11:59:23 +03:00
|
|
|
tar cvzf $(appstore_package_name).tar.gz \
|
2016-06-05 16:07:47 +03:00
|
|
|
--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" \
|
2017-10-08 12:51:04 +03:00
|
|
|
--exclude="../$(app_name)/js/package-lock.json" \
|
2016-06-05 16:07:47 +03:00
|
|
|
--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)/.*" \
|
2017-10-08 12:51:04 +03:00
|
|
|
--exclude="../$(app_name)/*.lock" \
|
2017-11-11 14:12:32 +03:00
|
|
|
--exclude="../$(app_name)/run-eslint.sh" \
|
2016-06-05 16:07:47 +03:00
|
|
|
--exclude="../$(app_name)/js/.*" \
|
2017-10-08 12:51:04 +03:00
|
|
|
--exclude="../$(app_name)/vendor" \
|
2017-01-31 11:59:23 +03:00
|
|
|
--exclude-vcs \
|
|
|
|
../$(app_name)
|
|
|
|
|
|
|
|
|
|
|
|
@if [ -f $(cert_dir)/$(app_name).key ]; then \
|
|
|
|
echo "Signing package…"; \
|
|
|
|
openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name).tar.gz | openssl base64; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $(appstore_package_name).tar.gz
|
|
|
|
|
2017-03-04 14:22:49 +03:00
|
|
|
test: test-unit test-integration
|
2016-06-05 16:07:47 +03:00
|
|
|
|
2017-03-04 14:22:49 +03:00
|
|
|
test-unit:
|
2017-01-31 13:11:59 +03:00
|
|
|
mkdir -p build/
|
2016-06-05 16:07:47 +03:00
|
|
|
ifeq (, $(shell which phpunit 2> /dev/null))
|
|
|
|
@echo "No phpunit command available, downloading a copy from the web"
|
|
|
|
mkdir -p $(build_tools_directory)
|
2017-03-20 10:53:17 +03:00
|
|
|
curl -sSL https://phar.phpunit.de/phpunit-5.7.phar -o $(build_tools_directory)/phpunit.phar
|
2017-01-31 13:11:59 +03:00
|
|
|
php $(build_tools_directory)/phpunit.phar -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
|
|
|
php $(build_tools_directory)/phpunit.phar -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
2016-06-05 16:07:47 +03:00
|
|
|
else
|
2017-01-31 13:11:59 +03:00
|
|
|
phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
|
|
|
|
phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml
|
2016-08-16 19:47:22 +03:00
|
|
|
endif
|
2017-02-28 17:20:29 +03:00
|
|
|
|
2017-03-04 14:22:49 +03:00
|
|
|
test-integration:
|
|
|
|
cd tests/integration && ./run.sh
|
|
|
|
|
|
|
|
test-js: install-deps
|
|
|
|
cd js && run test
|
2017-02-28 17:20:29 +03:00
|
|
|
|
2018-07-10 17:15:51 +03:00
|
|
|
package:
|
|
|
|
krankerl package
|