Loading composer/Plugin/RecipeUnpack/UnpackCommand.php +9 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use Composer\Command\BaseCommand; use Composer\Package\PackageInterface; use Composer\Repository\PlatformRepository; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; Loading Loading @@ -54,7 +55,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int // root package. if (empty($package_names)) { foreach ($composer->getPackage()->getRequires() as $link) { $package = $local_repo->findPackage($link->getTarget(), $link->getConstraint()); $target = $link->getTarget(); // Skip platform requirements, since those don't resolve to a real // package. // @see https://getcomposer.org/doc/articles/composer-platform-dependencies.md if (PlatformRepository::isPlatformPackage($target)) { continue; } $package = $local_repo->findPackage($target, $link->getConstraint()); if ($package->getType() === Plugin::RECIPE_PACKAGE_TYPE) { $package_names[] = $package->getName(); } Loading core/tests/Drupal/BuildTests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php +8 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ public function testRecursiveUnpacking(): void { $this->assertSame("fixtures/recipe-c unpacked.\nfixtures/recipe-a unpacked.\nfixtures/recipe-b unpacked.\n", $stdOut); $root_composer_json = $this->getFileContents($root_project_path . '/composer.json'); $this->assertSame([ 'ext-json', 'composer/installers', 'drupal/core-recipe-unpack', 'fixtures/module-a', Loading Loading @@ -159,7 +160,7 @@ public function testNoAutomaticDevUnpack(): void { // Assert the state of the root composer.json as no unpacking has occurred. $this->assertSame(['fixtures/recipe-a'], array_keys($root_composer_json['require-dev'])); $this->assertSame(['composer/installers', 'drupal/core-recipe-unpack', 'fixtures/module-a'], array_keys($root_composer_json['require'])); $this->assertSame(['composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/module-a'], array_keys($root_composer_json['require'])); // Ensure the resulting Composer files are valid. $this->runComposer('validate'); Loading Loading @@ -418,6 +419,7 @@ public function testRemoveRecipe(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/recipe-a', ], array_keys($root_composer_json['require'])); Loading @@ -427,6 +429,7 @@ public function testRemoveRecipe(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', ], array_keys($root_composer_json['require'])); // Ensure the resulting Composer files are valid. Loading @@ -452,6 +455,7 @@ public function testIgnoreRecipe(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/recipe-a', ], array_keys($root_composer_json['require'])); Loading Loading @@ -487,6 +491,7 @@ public function testIgnoreDependentRecipe(): void { $this->assertStringContainsString("fixtures/recipe-a unpacked.", $stdOut); $this->assertSame([ 'ext-json', 'composer/installers', 'drupal/core-recipe-unpack', 'fixtures/module-b', Loading Loading @@ -543,6 +548,7 @@ public function testRecipeNotUnpackedIfInstallIsDeferred(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/recipe-a', ], array_keys($root_composer_json['require'])); $this->assertFileDoesNotExist($root_project_path . '/recipes/recipe-a/recipe.yml'); Loading @@ -554,6 +560,7 @@ public function testRecipeNotUnpackedIfInstallIsDeferred(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/recipe-a', ], array_keys($root_composer_json['require'])); $this->assertFileExists($root_project_path . '/recipes/recipe-a/recipe.yml'); Loading core/tests/Drupal/Tests/Composer/Plugin/Unpack/fixtures/composer-root/composer.json.tmpl +2 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ }, "require": { "composer/installers": "*", "drupal/core-recipe-unpack": "*" "drupal/core-recipe-unpack": "*", "ext-json": "*" }, "extra": { "installer-paths": { Loading Loading
composer/Plugin/RecipeUnpack/UnpackCommand.php +9 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use Composer\Command\BaseCommand; use Composer\Package\PackageInterface; use Composer\Repository\PlatformRepository; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; Loading Loading @@ -54,7 +55,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int // root package. if (empty($package_names)) { foreach ($composer->getPackage()->getRequires() as $link) { $package = $local_repo->findPackage($link->getTarget(), $link->getConstraint()); $target = $link->getTarget(); // Skip platform requirements, since those don't resolve to a real // package. // @see https://getcomposer.org/doc/articles/composer-platform-dependencies.md if (PlatformRepository::isPlatformPackage($target)) { continue; } $package = $local_repo->findPackage($target, $link->getConstraint()); if ($package->getType() === Plugin::RECIPE_PACKAGE_TYPE) { $package_names[] = $package->getName(); } Loading
core/tests/Drupal/BuildTests/Composer/Plugin/Unpack/Functional/UnpackRecipeTest.php +8 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ public function testRecursiveUnpacking(): void { $this->assertSame("fixtures/recipe-c unpacked.\nfixtures/recipe-a unpacked.\nfixtures/recipe-b unpacked.\n", $stdOut); $root_composer_json = $this->getFileContents($root_project_path . '/composer.json'); $this->assertSame([ 'ext-json', 'composer/installers', 'drupal/core-recipe-unpack', 'fixtures/module-a', Loading Loading @@ -159,7 +160,7 @@ public function testNoAutomaticDevUnpack(): void { // Assert the state of the root composer.json as no unpacking has occurred. $this->assertSame(['fixtures/recipe-a'], array_keys($root_composer_json['require-dev'])); $this->assertSame(['composer/installers', 'drupal/core-recipe-unpack', 'fixtures/module-a'], array_keys($root_composer_json['require'])); $this->assertSame(['composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/module-a'], array_keys($root_composer_json['require'])); // Ensure the resulting Composer files are valid. $this->runComposer('validate'); Loading Loading @@ -418,6 +419,7 @@ public function testRemoveRecipe(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/recipe-a', ], array_keys($root_composer_json['require'])); Loading @@ -427,6 +429,7 @@ public function testRemoveRecipe(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', ], array_keys($root_composer_json['require'])); // Ensure the resulting Composer files are valid. Loading @@ -452,6 +455,7 @@ public function testIgnoreRecipe(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/recipe-a', ], array_keys($root_composer_json['require'])); Loading Loading @@ -487,6 +491,7 @@ public function testIgnoreDependentRecipe(): void { $this->assertStringContainsString("fixtures/recipe-a unpacked.", $stdOut); $this->assertSame([ 'ext-json', 'composer/installers', 'drupal/core-recipe-unpack', 'fixtures/module-b', Loading Loading @@ -543,6 +548,7 @@ public function testRecipeNotUnpackedIfInstallIsDeferred(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/recipe-a', ], array_keys($root_composer_json['require'])); $this->assertFileDoesNotExist($root_project_path . '/recipes/recipe-a/recipe.yml'); Loading @@ -554,6 +560,7 @@ public function testRecipeNotUnpackedIfInstallIsDeferred(): void { $this->assertSame([ 'composer/installers', 'drupal/core-recipe-unpack', 'ext-json', 'fixtures/recipe-a', ], array_keys($root_composer_json['require'])); $this->assertFileExists($root_project_path . '/recipes/recipe-a/recipe.yml'); Loading
core/tests/Drupal/Tests/Composer/Plugin/Unpack/fixtures/composer-root/composer.json.tmpl +2 −1 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ }, "require": { "composer/installers": "*", "drupal/core-recipe-unpack": "*" "drupal/core-recipe-unpack": "*", "ext-json": "*" }, "extra": { "installer-paths": { Loading