Skip to content

Commit

Permalink
Make it compatible with drupal-composer/preserve-paths
Browse files Browse the repository at this point in the history
Patch taken from SebCorbin@1cb9bac

Composer project tries to apply this patch: https://github.com/drupal-composer/drupal-project/blob/339c81dcfd6881f3f3e1069b8ab3fe4149094e6b/composer.json#L76-L80
But this does not work reliably: drupal-composer/preserve-paths#10 (comment)
So we have to keep it in our own fork. And install composer-patches from the fork.
  • Loading branch information
Leksat committed Mar 11, 2019
1 parent 2ec4f00 commit 307aaca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Patches.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
namespace cweagans\Composer;

use Composer\Composer;
use Composer\DependencyResolver\DefaultPolicy;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Repository\CompositeRepository;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Package\AliasPackage;
Expand Down Expand Up @@ -135,7 +139,9 @@ public function checkPatches(Event $event) {
|| ($has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied'])) {
$uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.');
$this->io->write('<info>Removing package ' . $package_name . ' so that it can be re-installed and re-patched.</info>');
$this->eventDispatcher->dispatchPackageEvent(PackageEvents::PRE_PACKAGE_UNINSTALL, $event->isDevMode(), new DefaultPolicy(), new Pool('dev'), new CompositeRepository([$package->getRepository()]), new Request(), [$uninstallOperation], $uninstallOperation);
$installationManager->uninstall($localRepository, $uninstallOperation);
$this->eventDispatcher->dispatchPackageEvent(PackageEvents::POST_PACKAGE_UNINSTALL, $event->isDevMode(), new DefaultPolicy(), new Pool('dev'), new CompositeRepository([$package->getRepository()]), new Request(), [$uninstallOperation], $uninstallOperation);
}
}
}
Expand Down

0 comments on commit 307aaca

Please sign in to comment.