1
0
Fork 0

Add a way to retrieve the Loop instance from Composer to be able to wait on promises to integrate things

pull/8860/head
Jordi Boggiano 2020-05-01 09:54:41 +02:00
parent 3c593b0d12
commit 557fb873ee
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 38 additions and 15 deletions

View File

@ -14,6 +14,7 @@ namespace Composer;
use Composer\Package\RootPackageInterface; use Composer\Package\RootPackageInterface;
use Composer\Package\Locker; use Composer\Package\Locker;
use Composer\Util\Loop;
use Composer\Repository\RepositoryManager; use Composer\Repository\RepositoryManager;
use Composer\Installer\InstallationManager; use Composer\Installer\InstallationManager;
use Composer\Plugin\PluginManager; use Composer\Plugin\PluginManager;
@ -82,7 +83,7 @@ class Composer
} }
/** /**
* @var Package\RootPackageInterface * @var RootPackageInterface
*/ */
private $package; private $package;
@ -91,6 +92,11 @@ class Composer
*/ */
private $locker; private $locker;
/**
* @var Loop
*/
private $loop;
/** /**
* @var Repository\RepositoryManager * @var Repository\RepositoryManager
*/ */
@ -132,7 +138,7 @@ class Composer
private $archiveManager; private $archiveManager;
/** /**
* @param Package\RootPackageInterface $package * @param RootPackageInterface $package
* @return void * @return void
*/ */
public function setPackage(RootPackageInterface $package) public function setPackage(RootPackageInterface $package)
@ -141,7 +147,7 @@ class Composer
} }
/** /**
* @return Package\RootPackageInterface * @return RootPackageInterface
*/ */
public function getPackage() public function getPackage()
{ {
@ -165,7 +171,7 @@ class Composer
} }
/** /**
* @param Package\Locker $locker * @param Locker $locker
*/ */
public function setLocker(Locker $locker) public function setLocker(Locker $locker)
{ {
@ -173,7 +179,7 @@ class Composer
} }
/** /**
* @return Package\Locker * @return Locker
*/ */
public function getLocker() public function getLocker()
{ {
@ -181,7 +187,23 @@ class Composer
} }
/** /**
* @param Repository\RepositoryManager $manager * @param Loop $loop
*/
public function setLoop(loop $loop)
{
$this->loop = $loop;
}
/**
* @return Loop
*/
public function getLoop()
{
return $this->loop;
}
/**
* @param RepositoryManager $manager
*/ */
public function setRepositoryManager(RepositoryManager $manager) public function setRepositoryManager(RepositoryManager $manager)
{ {
@ -189,7 +211,7 @@ class Composer
} }
/** /**
* @return Repository\RepositoryManager * @return RepositoryManager
*/ */
public function getRepositoryManager() public function getRepositoryManager()
{ {
@ -197,7 +219,7 @@ class Composer
} }
/** /**
* @param Downloader\DownloadManager $manager * @param DownloadManager $manager
*/ */
public function setDownloadManager(DownloadManager $manager) public function setDownloadManager(DownloadManager $manager)
{ {
@ -205,7 +227,7 @@ class Composer
} }
/** /**
* @return Downloader\DownloadManager * @return DownloadManager
*/ */
public function getDownloadManager() public function getDownloadManager()
{ {
@ -229,7 +251,7 @@ class Composer
} }
/** /**
* @param Installer\InstallationManager $manager * @param InstallationManager $manager
*/ */
public function setInstallationManager(InstallationManager $manager) public function setInstallationManager(InstallationManager $manager)
{ {
@ -237,7 +259,7 @@ class Composer
} }
/** /**
* @return Installer\InstallationManager * @return InstallationManager
*/ */
public function getInstallationManager() public function getInstallationManager()
{ {
@ -245,7 +267,7 @@ class Composer
} }
/** /**
* @param Plugin\PluginManager $manager * @param PluginManager $manager
*/ */
public function setPluginManager(PluginManager $manager) public function setPluginManager(PluginManager $manager)
{ {
@ -253,7 +275,7 @@ class Composer
} }
/** /**
* @return Plugin\PluginManager * @return PluginManager
*/ */
public function getPluginManager() public function getPluginManager()
{ {
@ -277,7 +299,7 @@ class Composer
} }
/** /**
* @param Autoload\AutoloadGenerator $autoloadGenerator * @param AutoloadGenerator $autoloadGenerator
*/ */
public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator) public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
{ {
@ -285,7 +307,7 @@ class Composer
} }
/** /**
* @return Autoload\AutoloadGenerator * @return AutoloadGenerator
*/ */
public function getAutoloadGenerator() public function getAutoloadGenerator()
{ {

View File

@ -336,6 +336,7 @@ class Factory
$httpDownloader = self::createHttpDownloader($io, $config); $httpDownloader = self::createHttpDownloader($io, $config);
$loop = new Loop($httpDownloader); $loop = new Loop($httpDownloader);
$composer->setLoop($loop);
// initialize event dispatcher // initialize event dispatcher
$dispatcher = new EventDispatcher($composer, $io); $dispatcher = new EventDispatcher($composer, $io);