symfony / flex

Composer plugin for Symfony
MIT License
4.16k stars 183 forks source link

Flex is writing `symfony.lock` / executing scripts on `composer install` #934

Closed lostfocus closed 2 years ago

lostfocus commented 2 years ago

I'm trying to use the SYMFONY_REQUIRE environment variable to run a test matrix job in a CI job when developing a bundle. Basically the commands look like this:

export SYMFONY_REQUIRE=4.4
composer install -n
vendor/bin/phpunit
export SYMFONY_REQUIRE=5.4
composer install -n
vendor/bin/phpunit
export SYMFONY_REQUIRE=6.0
composer install -n
vendor/bin/phpunit

I don't have a composer.lock or symfony.lock in my repo at this point. When executing the CI job Flex tries to create the symfony.lock and run the recipes for the required libraries, which is not optimal. Even if the composer.json only requires phpunit/phpunit as dev requirement, it will install a bootstrap.php which needs the Symfony Dotenv component to work. (I do not have the Symfony Dotenv component in my composer.json.)
Is there a way to run composer install and use Flex/SYMFONY_REQUIRE to set the version for Symfony components without running the recipes?

lostfocus commented 2 years ago

Okay, I guess this is a duplicate of #881, sorry. I'm still a bit weirded out by the behavior of Flex running the recipes on composer install though.