@@ -5,41 +5,47 @@ PSALM := php build/psalm.phar
55CMDS = $(wildcard src/Command/* .php)
66
77.PHONY :test
8- test : test-fixer psalm test-phpunit check-docs
8+ test : check-init test-fixer psalm test-phpunit check-docs
99
1010.PHONY :test-fixer
11- test-fixer : build/php-cs-fixer.phar
11+ test-fixer : check-init
1212 $(FIXER ) fix -v || true
1313
1414.PHONY :test-phpunit
15- test-phpunit : vendor/autoload.php
16- $(PHPUNIT )
15+ test-phpunit : check-init
16+ $(PHPUNIT ) --verbose
1717
1818.PHONY :validate
19- validate : build/php-cs-fixer.phar vendor/autoload.php psalm check-docs
19+ validate : check-init psalm check-docs
2020 $(FIXER ) fix --dry-run --stop-on-violation
2121 $(COMPOSER ) validate
22+ phpdbg --version
2223 phpdbg -d memory_limit=-1 -qrr $(PHPUNIT ) --coverage-text
2324
25+ .PHONY :build
26+ build : build/moodle-plugin-ci.phar
27+
2428.PHONY :psalm
25- psalm : build/psalm.phar
29+ psalm : check-init
2630 $(PSALM )
2731
2832.PHONY :psalm-update-baseline
29- psalm-update-baseline : build/psalm.phar
33+ psalm-update-baseline : check-init
3034 $(PSALM ) --update-baseline
3135
3236.PHONY :check-docs
3337check-docs : docs/CLI.md
3438 @echo " CHECKING if 'docs/CLI.md' needs to be committed due to changes. If this fails, simply commit the changes."
3539 git diff-files docs/CLI.md
3640
37- # Downloads everything we need for testing, used by Travis .
41+ # Setup for testing.
3842.PHONY : init
39- init : vendor/autoload.php build/php-cs-fixer.phar build/psalm.phar
43+ init : build/php-cs-fixer.phar build/psalm.phar composer.lock composer.json
44+ $(COMPOSER ) selfupdate
45+ $(COMPOSER ) install --no-suggest --no-progress
4046
4147.PHONY : update
42- update : build/php-cs-fixer.phar
48+ update : check-init build/php-cs-fixer.phar build/psalm .phar
4349 $(COMPOSER ) selfupdate
4450 $(FIXER ) selfupdate
4551 $(COMPOSER ) update
@@ -51,6 +57,12 @@ clean:
5157 rm -rf vendor
5258 rm -f .php_cs.cache
5359
60+ # Output error if not initialised.
61+ check-init :
62+ ifeq (, $(wildcard vendor) )
63+ $(error Run 'make init' first)
64+ endif
65+
5466# Update download URL from https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases
5567build/php-cs-fixer.phar :
5668 curl -LSs https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.14.2/php-cs-fixer.phar -o build/php-cs-fixer.phar
@@ -64,14 +76,9 @@ build/box.phar:
6476
6577build/moodle-plugin-ci.phar : build/box.phar
6678 $(COMPOSER ) install --no-dev --prefer-dist --classmap-authoritative --quiet
67- php -d phar.readonly=false build/box.phar build
79+ php -d memory_limit=-1 -d phar.readonly=false build/box.phar build
6880 $(COMPOSER ) install --prefer-dist --quiet
6981
70- vendor/autoload.php : composer.lock composer.json
71- $(COMPOSER ) self-update
72- $(COMPOSER ) install --no-suggest --no-progress
73- touch $@
74-
7582docs/CLI.md : $(CMDS )
7683 @rm -f $@
7784 @echo " ---" >> $@
0 commit comments