refactor Makefile

This commit is contained in:
korelstar 2021-02-03 21:28:15 +01:00
parent f362ea42e3
commit 25ac9aa7db
1 changed files with 54 additions and 45 deletions

View File

@ -1,16 +1,48 @@
### build and sign release
app_name=notes app_name=notes
project_dir=$(CURDIR)/../$(app_name) project_dir=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build/artifacts build_dir=$(CURDIR)/build/artifacts
sign_dir=$(build_dir)/sign
appstore_dir=$(build_dir)/appstore
package_name=$(app_name)
cert_dir=$(HOME)/.nextcloud/certificates cert_dir=$(HOME)/.nextcloud/certificates
appstore: clean lint build-js-production
mkdir -p $(sign_dir) all: dev-setup build
##### Environment ####
dev-setup: clean clean-dev init
init: composer-init npm-init
composer-init:
composer install
npm-init:
npm install
npm-upgrade:
npm-upgrade
npm install
npm-update:
npm update
##### Building #####
appstore: lint build
@echo "Signing…"
php ../server/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
build: clean build-js-production
mkdir -p $(build_dir)
rsync -a \ rsync -a \
--exclude=.babelrc.js \ --exclude=.babelrc.js \
--exclude=build \ --exclude=build \
@ -35,40 +67,8 @@ appstore: clean lint build-js-production
--exclude=.tx \ --exclude=.tx \
--exclude=vendor \ --exclude=vendor \
--exclude=webpack*.js \ --exclude=webpack*.js \
$(project_dir) $(sign_dir) $(project_dir) $(build_dir)
@echo "Signing…"
php ../server/occ integrity:sign-app \
--privateKey=$(cert_dir)/$(app_name).key\
--certificate=$(cert_dir)/$(app_name).crt\
--path=$(sign_dir)/$(app_name)
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
### from vueexample
all: dev-setup build-js-production
# Dev env management
dev-setup: clean clean-dev init
init: composer-init npm-init
composer-init:
composer install
npm-init:
npm install
npm-upgrade:
npm-upgrade
npm install
npm-update:
npm update
# Building
build-js: build-js:
npm run dev npm run dev
@ -78,14 +78,18 @@ build-js-production:
watch-js: watch-js:
npm run watch npm run watch
# Testing
##### Testing #####
test: test-api test: test-api
test-api: test-api:
phpunit --bootstrap vendor/autoload.php --testdox tests/api/ phpunit --bootstrap vendor/autoload.php --testdox tests/api/
# Linting
##### Linting #####
lint: lint-php lint-js lint-css lint-xml lint: lint-php lint-js lint-css lint-xml
@ -125,7 +129,9 @@ lint-xml:
xmllint appinfo/info.xml --schema appinfo/info.xsd --noout xmllint appinfo/info.xml --schema appinfo/info.xsd --noout
# Fix lint
##### Fix lint #####
lint-fix: lint-php-fix lint-js-fix lint-css-fix lint-fix: lint-php-fix lint-js-fix lint-css-fix
lint-php-fix: lint-php-fix:
@ -138,7 +144,10 @@ lint-js-fix:
lint-css-fix: lint-css-fix:
npm run stylelint:fix npm run stylelint:fix
# Cleaning
##### Cleaning #####
clean: clean:
rm -rf js/ rm -rf js/
rm -rf $(build_dir) rm -rf $(build_dir)