Skip to content

Commit 00193bb

Browse files
driusanDave MacFarlane
andauthored
[Build/Meta] Make make smarter about installing dependencies (#10004)
This makes the `make` command smarter about when to run `composer install` or `npm ci` instead of constantly doing it every single time you build. `composer install --no-dev` will only be run if the vendor directory is missing or the composer.lock has changed. `composer install` will only be run if the needed tool (phpunit or phan) from dev is required for the target being run and either he composer.lock has been changed or the tool is missing (because `composer install --no-dev` generated the vendor directory.) Similarly, `npm ci` will now only be run if the node_modules directory is missing or the package-lock.json file has been modified. There were a few .PHONY rules which were either no longer used meta-targets relevant or never were used that are removed as a result of these changes. (phpdev, fastdev, jsdev) Co-authored-by: Dave MacFarlane <[email protected]>
1 parent e9d0b58 commit 00193bb

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Makefile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
.PHONY: clean dev all check checkstatic unittests phpdev jslatest testdata fastdev jsdev locales
1+
.PHONY: clean dev all check checkstatic unittests jslatest testdata locales
22

3-
all: locales VERSION
4-
composer install --no-dev
5-
npm ci
3+
all: node_modules locales VERSION vendor
64
npm run build
75

86
# If anything changes, re-generate the VERSION file
97
VERSION: .
108
tools/gen-version.sh
119

12-
phpdev:
10+
vendor/bin/phan: composer.lock
1311
composer install
1412

15-
dev: jsdev locales phpdev fastdev
13+
vendor/bin/phpunit: composer.lock
14+
composer install
15+
16+
vendor: composer.lock
17+
composer install --no-dev
1618

17-
jsdev:
19+
node_modules: package-lock.json
1820
npm ci
1921

20-
fastdev: VERSION
22+
dev: node_modules locales vendor/bin/phan VERSION vendor
2123
npm run compile
2224

2325
jslatest: clean
@@ -35,7 +37,7 @@ clean:
3537
rm -f modules/*/locale/*/LC_MESSAGES/*.mo
3638

3739
# Perform static analysis checks
38-
checkstatic: phpdev
40+
checkstatic: vendor/bin/phan dev
3941
npm run lint:php
4042
vendor/bin/phan
4143
npm run lint:js
@@ -48,7 +50,7 @@ checkstatic: phpdev
4850
make checklanguage:
4951
npx alex --quiet --why --diff
5052

51-
unittests: phpdev
53+
unittests: vendor/bin/phpunit
5254
vendor/bin/phpunit --configuration test/phpunit.xml
5355

5456
# Perform all tests that don't require an install.

0 commit comments

Comments
 (0)