/** * Handle an event callback for pre-dependency solving phase of an install * or update by adding any duplicate package dependencies found during * initial merge processing to the request that will be processed by the * dependency solver. * * @param InstallerEvent $event */ public function onDependencySolve(InstallerEvent $event) { $request = $event->getRequest(); foreach ($this->state->getDuplicateLinks('require') as $link) { $this->logger->info("Adding dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } if ($this->state->isDevMode()) { foreach ($this->state->getDuplicateLinks('require-dev') as $link) { $this->logger->info("Adding dev dependency <comment>{$link}</comment>"); $request->install($link->getTarget(), $link->getConstraint()); } } }
/** * Read a JSON file and merge its contents * * @param RootPackageInterface $root * @param string $path */ protected function mergeFile(RootPackageInterface $root, $path) { if (isset($this->loaded[$path]) || isset($this->loadedNoDev[$path]) && !$this->state->isDevMode()) { $this->logger->debug("Already merged <comment>{$path}</comment> completely"); return; } $package = new ExtraPackage($path, $this->composer, $this->logger); if (isset($this->loadedNoDev[$path])) { $this->logger->info("Loading -dev sections of <comment>{$path}</comment>..."); $package->mergeDevInto($root, $this->state); } else { $this->logger->info("Loading <comment>{$path}</comment>..."); $package->mergeInto($root, $this->state); } if ($this->state->isDevMode()) { $this->loaded[$path] = true; } else { $this->loadedNoDev[$path] = true; } if ($this->state->recurseIncludes()) { $this->mergeFiles($package->getIncludes(), false); $this->mergeFiles($package->getRequires(), true); } }