Skip to content

--ignore-platform-reqs not respected on second Installer run during initial plugin install #159

@theofidry

Description

@theofidry

Hi,

I'm using this plugin via composer-inheritance-plugin for FidryAliceDataFixture. composer-inheritance-plugin is a very simple plugin allowing one to automatically merge the composer.json of a sub package installed with composer-bin-plugin with the root composer.json.

To summarise, bamarni/composer-bin-plugin allows you to interact with a composer.json of another directory, e.g.:

composer require --dev bamarni/composer-bin-plugin # Install the plugin for the project

# Command with bamarni plugin:
composer bin phpcs require --dev friendsofphp/php-cs-fixer

# Which is strictly equivalent to:
composer --working-dir=vendor-bin/phpcs require --dev friendsofphp/php-cs-fixer

I'm using the merge plugin in the case of a mono-repository management to test different bridges for my library. For example the library above has a Symfony bridge, but Symfony may not be compatible with other bridges, so I do:

  • test the core library alone
  • install Symfony with my lib in another directory to test my library with Symfony

which is done by requiring Symfony as a dev package and composer-inheritance-plugin is here to use the composer-merge-plugin with minimum code:

composer bin symfony require symfony/symfony # Install Symfony
composer bin symfony require theofidry/composer-inheritance-plugin # merge the root composer.json which is of the lib with the one in the sub directory

Ok now that's with the context. My actual issue: the installation fails due to --ignore-platform-reqs not passed properly. The way I install the deps is:

composer install # to install the bamarni plugin
composer bin symfony update --ignore-platform-reqs

During the second command, the first install works fine thanks to the --ignore-platform-reqs option. However the merge plugin then merge the deps and run an install/update again, and this one fails for a missing PHP extension which should not happen with --ignore-platform-reqs.

I tried to dig into it but after 30min search I couldn't find anything. I'll try to reproduce a minimal case but otherwise you can reproduce it by doing:

vendor-bin/symfony/vendor/phpunit: vendor-bin/symfony/composer.lock
	composer bin symfony update --ignore-platform-reqs $(COMPOSER_FLAGS) || true
	composer bin symfony update --ignore-platform-reqs $(COMPOSER_FLAGS)

bin/console: vendor-bin/symfony/composer.lock
	composer bin symfony update --ignore-platform-reqs $(COMPOSER_FLAGS) || true
	composer bin symfony update --ignore-platform-reqs $(COMPOSER_FLAGS)

Replace it by:

vendor-bin/symfony/vendor/phpunit: vendor-bin/symfony/composer.lock
	composer bin symfony update --ignore-platform-reqs $(COMPOSER_FLAGS)

bin/console: vendor-bin/symfony/composer.lock
	composer bin symfony update --ignore-platform-reqs $(COMPOSER_FLAGS)
  • run make test_symfony_bridge

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions