Use wrapped PlatformRepository only in the Solver
parent
28369ea623
commit
c8cfa15f52
|
@ -13,9 +13,7 @@ use Composer\Console\Application as ComposerApplication;
|
|||
|
||||
// initialize repository manager
|
||||
$rm = new Repository\RepositoryManager();
|
||||
$rm->setLocalRepository(new Repository\PlatformRepository(
|
||||
new Repository\FilesystemRepository(new JsonFile('.composer/installed.json'))
|
||||
));
|
||||
$rm->setLocalRepository(new Repository\FilesystemRepository(new JsonFile('.composer/installed.json')));
|
||||
$rm->setRepository('Packagist', new Repository\ComposerRepository('http://packagist.org'));
|
||||
|
||||
// initialize download manager
|
||||
|
@ -33,7 +31,6 @@ $im->setInstaller('symfony-bundle', new Installer\LibraryInstaller('vendor/bundl
|
|||
$loader = new Package\Loader\JsonLoader();
|
||||
$package = $loader->load(new JsonFile('composer.json'));
|
||||
|
||||
|
||||
// init locker
|
||||
$locker = new Package\Locker(new JsonFile('composer.lock'), $rm);
|
||||
|
||||
|
|
|
@ -74,8 +74,9 @@ EOT
|
|||
// prepare solver
|
||||
$installationManager = $composer->getInstallationManager();
|
||||
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
|
||||
$installedRepo = new Repository\PlatformRepository($localRepo);
|
||||
$policy = new DependencyResolver\DefaultPolicy();
|
||||
$solver = new DependencyResolver\Solver($policy, $pool, $localRepo);
|
||||
$solver = new DependencyResolver\Solver($policy, $pool, $installedRepo);
|
||||
|
||||
// solve dependencies
|
||||
$operations = $solver->solve($request);
|
||||
|
@ -111,8 +112,6 @@ EOT
|
|||
$localRepo->write();
|
||||
|
||||
$output->writeln('> Generating autoload.php');
|
||||
$localRepo = new \Composer\Repository\FilesystemRepository(
|
||||
new \Composer\Json\JsonFile('.composer/installed.json'));
|
||||
$generator = new AutoloadGenerator($localRepo, $composer->getPackage(), $installationManager);
|
||||
$generator->dump('.composer/autoload.php');
|
||||
|
||||
|
|
|
@ -88,10 +88,6 @@ class Locker
|
|||
$name = $package->getName();
|
||||
$version = $package->getVersion();
|
||||
|
||||
if ('php' === $name || preg_match('{^ext-[a-z0-9_-]+$}', $name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$name || !$version) {
|
||||
throw new \LogicException(sprintf(
|
||||
'Package "%s" has no version or name and can not be locked', $package
|
||||
|
|
|
@ -20,11 +20,11 @@ use Composer\Package\Version\VersionParser;
|
|||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
*/
|
||||
class PlatformRepository extends ArrayRepository implements WritableRepositoryInterface
|
||||
class PlatformRepository extends ArrayRepository
|
||||
{
|
||||
private $localRepository;
|
||||
|
||||
public function __construct(WritableRepositoryInterface $localRepository)
|
||||
public function __construct(RepositoryInterface $localRepository)
|
||||
{
|
||||
$this->localRepository = $localRepository;
|
||||
}
|
||||
|
@ -65,28 +65,4 @@ class PlatformRepository extends ArrayRepository implements WritableRepositoryIn
|
|||
{
|
||||
return array_merge(parent::getPackages(), $this->localRepository->getPackages());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function addPackage(PackageInterface $package)
|
||||
{
|
||||
$this->localRepository->addPackage($package);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function removePackage(PackageInterface $package)
|
||||
{
|
||||
$this->localRepository->removePackage($package);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function write()
|
||||
{
|
||||
$this->localRepository->write();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue