Add extra logging before and after SAT solving
parent
0a8528c5c7
commit
8e78ce9a43
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer\DependencyResolver;
|
namespace Composer\DependencyResolver;
|
||||||
|
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Repository\RepositoryInterface;
|
use Composer\Repository\RepositoryInterface;
|
||||||
use Composer\Repository\PlatformRepository;
|
use Composer\Repository\PlatformRepository;
|
||||||
|
|
||||||
|
@ -56,13 +57,18 @@ class Solver
|
||||||
/** @var array */
|
/** @var array */
|
||||||
protected $learnedWhy = array();
|
protected $learnedWhy = array();
|
||||||
|
|
||||||
|
/** @var IOInterface */
|
||||||
|
protected $io;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PolicyInterface $policy
|
* @param PolicyInterface $policy
|
||||||
* @param Pool $pool
|
* @param Pool $pool
|
||||||
* @param RepositoryInterface $installed
|
* @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->policy = $policy;
|
||||||
$this->pool = $pool;
|
$this->pool = $pool;
|
||||||
$this->installed = $installed;
|
$this->installed = $installed;
|
||||||
|
@ -217,7 +223,10 @@ class Solver
|
||||||
/* make decisions based on job/update assertions */
|
/* make decisions based on job/update assertions */
|
||||||
$this->makeAssertionRuleDecisions();
|
$this->makeAssertionRuleDecisions();
|
||||||
|
|
||||||
|
$this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
|
||||||
|
$before = microtime(true);
|
||||||
$this->runSat(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
|
// decide to remove everything that's installed and undecided
|
||||||
foreach ($this->installedMap as $packageId => $void) {
|
foreach ($this->installedMap as $packageId => $void) {
|
||||||
|
|
|
@ -287,7 +287,7 @@ class Installer
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
|
$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);
|
$ops = $solver->solve($request, $this->ignorePlatformReqs);
|
||||||
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
|
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
|
||||||
foreach ($ops as $op) {
|
foreach ($ops as $op) {
|
||||||
|
@ -493,7 +493,7 @@ class Installer
|
||||||
|
|
||||||
// solve dependencies
|
// solve dependencies
|
||||||
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
|
$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 {
|
try {
|
||||||
$operations = $solver->solve($request, $this->ignorePlatformReqs);
|
$operations = $solver->solve($request, $this->ignorePlatformReqs);
|
||||||
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
|
$this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace Composer\Test\DependencyResolver;
|
namespace Composer\Test\DependencyResolver;
|
||||||
|
|
||||||
|
use Composer\IO\NullIO;
|
||||||
use Composer\Repository\ArrayRepository;
|
use Composer\Repository\ArrayRepository;
|
||||||
use Composer\DependencyResolver\DefaultPolicy;
|
use Composer\DependencyResolver\DefaultPolicy;
|
||||||
use Composer\DependencyResolver\Pool;
|
use Composer\DependencyResolver\Pool;
|
||||||
|
@ -38,7 +39,7 @@ class SolverTest extends TestCase
|
||||||
|
|
||||||
$this->request = new Request($this->pool);
|
$this->request = new Request($this->pool);
|
||||||
$this->policy = new DefaultPolicy;
|
$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()
|
public function testSolverInstallSingle()
|
||||||
|
|
Loading…
Reference in New Issue