Pass devMode from RunScriptCommand to Script\Event
parent
ff7daf0bd4
commit
71e0fba216
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
use Composer\Script\CommandEvent;
|
use Composer\Script\Event as ScriptEvent;
|
||||||
use Composer\Script\ScriptEvents;
|
use Composer\Script\ScriptEvents;
|
||||||
use Composer\Util\ProcessExecutor;
|
use Composer\Util\ProcessExecutor;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -81,7 +81,9 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
$composer = $this->getComposer();
|
$composer = $this->getComposer();
|
||||||
$hasListeners = $composer->getEventDispatcher()->hasEventListeners(new CommandEvent($script, $composer, $this->getIO()));
|
$devMode = $input->getOption('dev') || !$input->getOption('no-dev');
|
||||||
|
$event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
|
||||||
|
$hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
|
||||||
if (!$hasListeners) {
|
if (!$hasListeners) {
|
||||||
throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
|
throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
|
||||||
}
|
}
|
||||||
|
@ -96,7 +98,7 @@ EOT
|
||||||
ProcessExecutor::setTimeout((int) $timeout);
|
ProcessExecutor::setTimeout((int) $timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args);
|
return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function listScripts()
|
protected function listScripts()
|
||||||
|
|
|
@ -24,6 +24,7 @@ use Composer\Script;
|
||||||
use Composer\Script\CommandEvent;
|
use Composer\Script\CommandEvent;
|
||||||
use Composer\Script\PackageEvent;
|
use Composer\Script\PackageEvent;
|
||||||
use Composer\Util\ProcessExecutor;
|
use Composer\Util\ProcessExecutor;
|
||||||
|
use Composer\Script\Event as ScriptEvent;
|
||||||
use Symfony\Component\Process\PhpExecutableFinder;
|
use Symfony\Component\Process\PhpExecutableFinder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,6 +416,10 @@ class EventDispatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
$generator = $this->composer->getAutoloadGenerator();
|
$generator = $this->composer->getAutoloadGenerator();
|
||||||
|
if ($event instanceof ScriptEvent) {
|
||||||
|
$generator->setDevMode($event->isDevMode());
|
||||||
|
}
|
||||||
|
|
||||||
$packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
|
$packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
|
||||||
$packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
|
$packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
|
||||||
$map = $generator->parseAutoloads($packageMap, $package);
|
$map = $generator->parseAutoloads($packageMap, $package);
|
||||||
|
|
Loading…
Reference in New Issue