Merge pull request #9935 from Seldaek/fix_autoloader
Fix autoload generation for dev dependencies when --no-scripts is usedpull/9941/head
commit
304455be48
|
@ -145,19 +145,23 @@ class AutoloadGenerator
|
|||
// Force scanPsrPackages when classmap is authoritative
|
||||
$scanPsrPackages = true;
|
||||
}
|
||||
if ($this->runScripts) {
|
||||
|
||||
// auto-set devMode based on whether dev dependencies are installed or not
|
||||
if (null === $this->devMode) {
|
||||
// we assume no-dev mode if no vendor dir is present or it is too old to contain dev information
|
||||
$this->devMode = false;
|
||||
|
||||
$installedJson = new JsonFile($config->get('vendor-dir').'/composer/installed.json');
|
||||
$isDevInstall = null;
|
||||
if ($installedJson->exists()) {
|
||||
$installedJson = $installedJson->read();
|
||||
$isDevInstall = isset($installedJson['dev']) ? $installedJson['dev'] : null;
|
||||
}
|
||||
// auto-set devMode based on whether dev dependencies are installed or not
|
||||
if (null !== $isDevInstall && null === $this->devMode) {
|
||||
$this->devMode = $isDevInstall;
|
||||
if (isset($installedJson['dev'])) {
|
||||
$this->devMode = $installedJson['dev'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set COMPOSER_DEV_MODE in case not set yet so it is available in the dump-autoload autoload
|
||||
if ($this->runScripts) {
|
||||
// set COMPOSER_DEV_MODE in case not set yet so it is available in the dump-autoload event listeners
|
||||
if (!isset($_SERVER['COMPOSER_DEV_MODE'])) {
|
||||
Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue