diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index fbd1b9f19..934d22f0c 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -12,6 +12,7 @@ namespace Composer\DependencyResolver; +use Composer\IO\IOInterface; use Composer\Repository\RepositoryInterface; use Composer\Repository\PlatformRepository; @@ -56,13 +57,18 @@ class Solver /** @var array */ protected $learnedWhy = array(); + /** @var IOInterface */ + protected $io; + /** * @param PolicyInterface $policy * @param Pool $pool * @param RepositoryInterface $installed + * @param IOInterface $io */ - public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed) + public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io) { + $this->io = $io; $this->policy = $policy; $this->pool = $pool; $this->installed = $installed; @@ -217,7 +223,10 @@ class Solver /* make decisions based on job/update assertions */ $this->makeAssertionRuleDecisions(); + $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG); + $before = microtime(true); $this->runSat(true); + $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE); // decide to remove everything that's installed and undecided foreach ($this->installedMap as $packageId => $void) { diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index ec2191d5f..939d7c5b3 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -287,7 +287,7 @@ class Installer } $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request); - $solver = new Solver($policy, $pool, $installedRepo); + $solver = new Solver($policy, $pool, $installedRepo, $this->io); $ops = $solver->solve($request, $this->ignorePlatformReqs); $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops); foreach ($ops as $op) { @@ -493,7 +493,7 @@ class Installer // solve dependencies $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request); - $solver = new Solver($policy, $pool, $installedRepo); + $solver = new Solver($policy, $pool, $installedRepo, $this->io); try { $operations = $solver->solve($request, $this->ignorePlatformReqs); $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations); diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index 63de2973f..f2b080ef3 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -12,6 +12,7 @@ namespace Composer\Test\DependencyResolver; +use Composer\IO\NullIO; use Composer\Repository\ArrayRepository; use Composer\DependencyResolver\DefaultPolicy; use Composer\DependencyResolver\Pool; @@ -38,7 +39,7 @@ class SolverTest extends TestCase $this->request = new Request($this->pool); $this->policy = new DefaultPolicy; - $this->solver = new Solver($this->policy, $this->pool, $this->repoInstalled); + $this->solver = new Solver($this->policy, $this->pool, $this->repoInstalled, new NullIO()); } public function testSolverInstallSingle()