Commit cec54c5a authored by catch's avatar catch
Browse files

Issue #3284420 by longwave, Gábor Hojtsy, Spokje: Remove Composer 1 specific...

Issue #3284420 by longwave, Gábor Hojtsy, Spokje: Remove Composer 1 specific code paths from Drupal 10

(cherry picked from commit 6c6f6a3f)
parent f2639f9f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -681,10 +681,10 @@
            "dist": {
                "type": "path",
                "url": "composer/Plugin/ProjectMessage",
                "reference": "b4efdbe26634b41a1b89e4f3770a8074769088a6"
                "reference": "56ffb5a4a8cab53a97554862ce1003541af3438d"
            },
            "require": {
                "composer-plugin-api": "^1.1 || ^2",
                "composer-plugin-api": "^2",
                "php": ">=7.3.0"
            },
            "type": "composer-plugin",
@@ -714,10 +714,10 @@
            "dist": {
                "type": "path",
                "url": "composer/Plugin/VendorHardening",
                "reference": "d54f0b3cc8b4237f3a41a0860a808db242f9da9e"
                "reference": "db4c3ed9b83937aa292951593a8e35176ef5f907"
            },
            "require": {
                "composer-plugin-api": "^1.1 || ^2",
                "composer-plugin-api": "^2",
                "php": ">=7.3.0"
            },
            "type": "composer-plugin",
+2 −2
Original line number Diff line number Diff line
@@ -91,8 +91,8 @@ protected static function setTemplateProjectStability(string $root, string $vers
  public static function ensureComposerVersion(): void {
    $composerVersion = method_exists(ComposerApp::class, 'getVersion') ?
      ComposerApp::getVersion() : ComposerApp::VERSION;
    if (Comparator::lessThan($composerVersion, '1.9.0')) {
      throw new \RuntimeException("Drupal core development requires Composer 1.9.0, but Composer $composerVersion is installed. Please run 'composer self-update'.");
    if (Comparator::lessThan($composerVersion, '2.0.0')) {
      throw new \RuntimeException("Drupal core development requires Composer 2.0.0, but Composer $composerVersion is installed. Please run 'composer self-update'.");
    }
  }

+1 −1
Original line number Diff line number Diff line
@@ -15,6 +15,6 @@
  },
  "require": {
    "php": ">=7.3.0",
    "composer-plugin-api": "^1.1 || ^2"
    "composer-plugin-api": "^2"
  }
}
+1 −23
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Drupal\Composer\Plugin\Scaffold;

use Composer\Composer;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Installer\PackageEvent;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
@@ -101,8 +100,7 @@ public function event(PackageEvent $event) {
    // which of the newly-installed packages have scaffold operations, and
    // whether or not they are allowed to scaffold by the allowed-packages
    // option in the root-level composer.json file.
    $operationType = $this->getOperationType($operation);
    $package = $operationType === 'update' ? $operation->getTargetPackage() : $operation->getPackage();
    $package = $operation->getOperationType() === 'update' ? $operation->getTargetPackage() : $operation->getPackage();
    if (ScaffoldOptions::hasOptions($package->getExtra())) {
      $this->newPackages[$package->getName()] = $package;
    }
@@ -181,26 +179,6 @@ protected function evaluateNewPackages(array $allowed_packages) {
    return $allowed_packages;
  }

  /**
   * Determine the type of the provided operation.
   *
   * Adjusts API used for Composer 1 or Composer 2.
   *
   * @param \Composer\DependencyResolver\Operation\OperationInterface $operation
   *   The operation object.
   *
   * @return string
   *   The operation type.
   */
  protected function getOperationType(OperationInterface $operation) {
    // Use Composer 2 method.
    if (method_exists($operation, 'getOperationType')) {
      return $operation->getOperationType();
    }
    // Fallback to Composer 1 method.
    return $operation->getJobType();
  }

  /**
   * Retrieves a package from the current composer process.
   *
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
  "homepage": "https://www.drupal.org/project/drupal",
  "license": "GPL-2.0-or-later",
  "require": {
    "composer-plugin-api": "^1 || ^2",
    "composer-plugin-api": "^2",
    "php": ">=7.3.0"
  },
  "conflict": {
Loading