1313# * tar: for building the archive
1414# * npm: for building and testing everything JS
1515#
16- # If no composer.json is in the app root directory, the Composer step
17- # will be skipped. The same goes for the package.json which can be located in
18- # the app root or the js/ directory.
19- #
2016# The npm command by launches the npm build script:
2117#
2218# npm run build
2319#
24- # The npm test command launches the npm test script:
25- #
26- # npm run test
27- #
2820# The idea behind this is to be completely testing and build tool agnostic. All
2921# build tools and additional package managers should be installed locally in
3022# your project, since this won't pollute people's global namespace.
@@ -48,23 +40,19 @@ appstore_package_name=$(appstore_build_directory)/$(app_name)
4840npm =$(shell which npm 2> /dev/null)
4941composer =$(shell which composer 2> /dev/null)
5042
43+ ifeq (, $(composer ) )
44+ composer_bin:=php $(build_tools_directory)/composer.phar
45+ else
46+ composer_bin:=composer
47+ endif
48+
5149all : build appinfo/info.xml
5250
5351# Fetches the PHP and JS dependencies and compiles the JS. If no composer.json
5452# is present, the composer step is skipped, if no package.json or js/package.json
5553# is present, the npm step is skipped
5654.PHONY : build
57- build :
58- ifneq (,$(wildcard $(CURDIR ) /composer.json) )
59- $(MAKE) composer
60- endif
61- ifneq (,$(wildcard $(CURDIR ) /package.json) )
62- $(MAKE) npm
63- endif
64- ifneq (,$(wildcard $(CURDIR ) /js/package.json) )
65- $(MAKE) npm
66- endif
67-
55+ build : prepare_phpunit composer npm
6856
6957.PHONY : install_composer
7058install_composer :
@@ -75,34 +63,25 @@ ifeq (, $(composer))
7563 mv composer.phar $(build_tools_directory)
7664endif
7765
66+ .PHONY : prepare_phpunit
67+ prepare_phpunit : install_composer
68+ cd tests/phpunit && $(composer_bin ) install --prefer-dist
69+
7870# Installs and updates the composer dependencies. If composer is not installed
7971# a copy is fetched from the web
8072.PHONY : composer
8173composer : install_composer
82- ifeq (, $(composer ) )
83- php $(build_tools_directory)/composer.phar install --prefer-dist
84- php $(build_tools_directory)/composer.phar update --prefer-dist
85- else
86- composer install --prefer-dist
87- composer update --prefer-dist
88- endif
74+ $(composer_bin ) install --prefer-dist
75+ $(composer_bin ) update --prefer-dist
8976
9077.PHONY : composer_dist
9178composer_dist : install_composer
92- ifeq (, $(composer ) )
93- php $(build_tools_directory)/composer.phar install --prefer-dist --no-dev
94- else
95- composer install --prefer-dist --no-dev
96- endif
79+ $(composer_bin ) install --prefer-dist --no-dev
9780
9881# Installs npm dependencies
9982.PHONY : npm
10083npm :
101- ifeq (,$(wildcard $(CURDIR ) /package.json) )
102- cd js && $(npm) run build
103- else
10484 npm run build
105- endif
10685
10786# Removes the appstore build
10887.PHONY : clean
@@ -113,10 +92,7 @@ clean:
11392# npm
11493.PHONY : distclean
11594distclean : clean
116- rm -rf vendor
117- rm -rf node_modules
118- rm -rf js/vendor
119- rm -rf js/node_modules
95+ rm -rf vendor node_modules tests/phpunit/vendor
12096
12197# Builds the source and appstore package
12298.PHONY : dist
@@ -137,6 +113,8 @@ source: appinfo/info.xml
137113 --exclude=" ../$( app_name) /*.log" \
138114 --exclude=" ../$( app_name) /js/*.log" \
139115 --exclude=" ../$( app_name) /.hooks" \
116+ --exclude=" ../$( app_name) /.github/actions/run-tests/volumes" \
117+ --exclude=" ../$( app_name) /cookbook.code-workspace" \
140118 ../$(app_name )
141119
142120# Builds the source package for the app store, ignores php and js tests
@@ -147,20 +125,13 @@ appstore: appinfo/info.xml
147125 tar cvzf $(appstore_package_name ) .tar.gz \
148126 --exclude-vcs \
149127 --exclude=" ../$( app_name) /build" \
128+ --exclude=" ../$( app_name) /docs" \
150129 --exclude=" ../$( app_name) /documentation" \
151130 --exclude=" ../$( app_name) /tests" \
152131 --exclude=" ../$( app_name) /Makefile" \
153132 --exclude=" ../$( app_name) /*.log" \
154133 --exclude=" ../$( app_name) /phpunit*xml" \
155134 --exclude=" ../$( app_name) /composer.*" \
156- --exclude=" ../$( app_name) /js/node_modules" \
157- --exclude=" ../$( app_name) /js/tests" \
158- --exclude=" ../$( app_name) /js/test" \
159- --exclude=" ../$( app_name) /js/*.log" \
160- --exclude=" ../$( app_name) /js/package.json" \
161- --exclude=" ../$( app_name) /js/bower.json" \
162- --exclude=" ../$( app_name) /js/karma.*" \
163- --exclude=" ../$( app_name) /js/protractor.*" \
164135 --exclude=" ../$( app_name) /node_modules" \
165136 --exclude=" ../$( app_name) /src" \
166137 --exclude=" ../$( app_name) /translationfiles" \
@@ -172,13 +143,21 @@ appstore: appinfo/info.xml
172143 --exclude=" ../$( app_name) /protractor\.*" \
173144 --exclude=" ../$( app_name) /.*" \
174145 --exclude=" ../$( app_name) /webpack.*.js" \
146+ --exclude=" ../$( app_name) /stylelint.config.js" \
175147 --exclude=" ../$( app_name) /js/.*" \
176148 --exclude=" ../$( app_name) /.hooks" \
149+ --exclude=" ../$( app_name) /cookbook.code-workspace" \
177150 ../$(app_name )
178151
179152.PHONY : test
180153test : composer
181154 @echo " This functionality has been move to the file .github/acrions/run-tests/run-locally.sh. See its output with parameter --help."
182155
156+ .PHONY : code_style
157+ code_style :
158+ $(composer_bin ) cs:fix
159+ npm run stylelint-fix
160+ npm run prettier-fix
161+
183162appinfo/info.xml : .github/actions/deploy/patch .github/actions/deploy/minor .github/actions/deploy/major .github/actions/deploy/appinfo/info.xml.dist
184163 .github/actions/deploy/update-data.sh
0 commit comments