Make sure if plugins depend on the root package that the root package is also autoloaded correctly, refs #9530
parent
92b3725765
commit
94076c0bb9
|
@ -21,6 +21,7 @@ use Composer\Package\RootPackage;
|
||||||
use Composer\Package\Version\VersionParser;
|
use Composer\Package\Version\VersionParser;
|
||||||
use Composer\Repository\RepositoryInterface;
|
use Composer\Repository\RepositoryInterface;
|
||||||
use Composer\Repository\InstalledRepository;
|
use Composer\Repository\InstalledRepository;
|
||||||
|
use Composer\Repository\RootPackageRepository;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
use Composer\Package\Link;
|
use Composer\Package\Link;
|
||||||
use Composer\Semver\Constraint\Constraint;
|
use Composer\Semver\Constraint\Constraint;
|
||||||
|
@ -174,7 +175,8 @@ class PluginManager
|
||||||
$localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
|
$localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
|
||||||
$globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
|
$globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
|
||||||
|
|
||||||
$installedRepo = new InstalledRepository(array($localRepo));
|
$rootPackageRepo = new RootPackageRepository($this->composer->getPackage());
|
||||||
|
$installedRepo = new InstalledRepository(array($localRepo, $rootPackageRepo));
|
||||||
if ($globalRepo) {
|
if ($globalRepo) {
|
||||||
$installedRepo->addRepository($globalRepo);
|
$installedRepo->addRepository($globalRepo);
|
||||||
}
|
}
|
||||||
|
@ -185,11 +187,15 @@ class PluginManager
|
||||||
$generator = $this->composer->getAutoloadGenerator();
|
$generator = $this->composer->getAutoloadGenerator();
|
||||||
$autoloads = array();
|
$autoloads = array();
|
||||||
foreach ($autoloadPackages as $autoloadPackage) {
|
foreach ($autoloadPackages as $autoloadPackage) {
|
||||||
|
if ($autoloadPackage === $this->composer->getPackage()) {
|
||||||
|
$downloadPath = '';
|
||||||
|
} else {
|
||||||
$downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
|
$downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
|
||||||
|
}
|
||||||
$autoloads[] = array($autoloadPackage, $downloadPath);
|
$autoloads[] = array($autoloadPackage, $downloadPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
$map = $generator->parseAutoloads($autoloads, new RootPackage('dummy/root-package', '1.0.0.0', '1.0.0'));
|
$map = $generator->parseAutoloads($autoloads, $this->composer->getPackage());
|
||||||
$classLoader = $generator->createLoader($map);
|
$classLoader = $generator->createLoader($map);
|
||||||
$classLoader->register();
|
$classLoader->register();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue