aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mike <mtalexan@users.noreply.github.com> 2024-10-17 13:31:58 +0000
committerGravatar GitHub <noreply@github.com> 2024-10-17 15:31:58 +0200
commitb184dc26988dfedb88bca178013e1d1f211f14de (patch)
tree5e66d2066867ad39f135bc1cd9ff2d26d3ee0abd
parent1a9d24d0dd4186a4f322926a6b152c13a1c3707a (diff)
Fix the Makefile for test and fix targets. (#6913)
The bin/composer dependency was missing from half the targets that needed it. The vendor/bin/* targets are all created by a single call to composer, but were all duplicating the composer call. The php* tools defined a vendor/bin/php* target, but then proceeded to create the bin/php* target instead by symlinking from an incorrect path. php* tools were referenced as vendor/bin/php* even though they were symlinked to bin/php*.
-rw-r--r--Makefile34
1 files changed, 14 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index ab16788a2..d8b33824a 100644
--- a/Makefile
+++ b/Makefile
@@ -59,32 +59,29 @@ stop: ## Stop FreshRSS container if any
## Tests and linter ##
######################
.PHONY: test
-test: vendor/bin/phpunit ## Run the test suite
- $(PHP) vendor/bin/phpunit --bootstrap ./tests/bootstrap.php ./tests
+test: bin/phpunit ## Run the test suite
+ $(PHP) bin/phpunit --bootstrap ./tests/bootstrap.php ./tests
.PHONY: lint
-lint: vendor/bin/phpcs ## Run the linter on the PHP files
- $(PHP) vendor/bin/phpcs . -p -s
+lint: bin/phpcs ## Run the linter on the PHP files
+ $(PHP) bin/phpcs . -p -s
.PHONY: lint-fix
-lint-fix: vendor/bin/phpcbf ## Fix the errors detected by the linter
- $(PHP) vendor/bin/phpcbf . -p -s
+lint-fix: bin/phpcbf ## Fix the errors detected by the linter
+ $(PHP) bin/phpcbf . -p -s
bin/composer:
mkdir -p bin/
wget 'https://raw.githubusercontent.com/composer/getcomposer.org/1a26c0dcb361332cb504e4861ed0f758281575aa/web/installer' -O - -q | php -- --quiet --install-dir='./bin/' --filename='composer'
-vendor/bin/phpunit: bin/composer
+# building any of these builds them all
+vendor/bin/phpunit vendor/bin/phpcs vendor/bin/phpcbf vendor/bin/phpstan &: bin/composer
bin/composer install --prefer-dist --no-progress
- ln -s ../vendor/bin/phpunit bin/phpunit
-vendor/bin/phpcs: bin/composer
- bin/composer install --prefer-dist --no-progress
- ln -s ../vendor/bin/phpcs bin/phpcs
-
-vendor/bin/phpcbf: bin/composer
- bin/composer install --prefer-dist --no-progress
- ln -s ../vendor/bin/phpcbf bin/phpcbf
+# Any of these depend on the vendor/ target, and then symlink the vendor/bin/ to the bin/.
+# use -sf so if the symlink already exists it won't error out. Running this from a container often won't properly detect it already exists
+bin/phpunit bin/phpcs bin/phpcbf bin/phpstan : % : vendor/%
+ ln -sf $< $@
bin/typos:
mkdir -p bin/
@@ -101,9 +98,6 @@ node_modules/.bin/eslint:
node_modules/.bin/rtlcss:
npm install
-vendor/bin/phpstan: bin/composer
- bin/composer install --prefer-dist --no-progress
-
##########
## I18N ##
##########
@@ -198,11 +192,11 @@ refresh: ## Refresh feeds by fetching new messages
# TODO: Add composer install
.PHONY: composer-test
-composer-test: vendor/bin/phpstan
+composer-test: bin/phpstan bin/composer
bin/composer run-script test
.PHONY: composer-fix
-composer-fix:
+composer-fix: bin/composer
bin/composer run-script fix
.PHONY: npm-test