Fix autoload generation for dev dependencies when --no-scripts is used, fixes #9934
parent
c686bbd7e2
commit
d5ce7a7385
|
@ -145,19 +145,23 @@ class AutoloadGenerator
|
||||||
// Force scanPsrPackages when classmap is authoritative
|
// Force scanPsrPackages when classmap is authoritative
|
||||||
$scanPsrPackages = true;
|
$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');
|
$installedJson = new JsonFile($config->get('vendor-dir').'/composer/installed.json');
|
||||||
$isDevInstall = null;
|
|
||||||
if ($installedJson->exists()) {
|
if ($installedJson->exists()) {
|
||||||
$installedJson = $installedJson->read();
|
$installedJson = $installedJson->read();
|
||||||
$isDevInstall = isset($installedJson['dev']) ? $installedJson['dev'] : null;
|
if (isset($installedJson['dev'])) {
|
||||||
|
$this->devMode = $installedJson['dev'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// auto-set devMode based on whether dev dependencies are installed or not
|
|
||||||
if (null !== $isDevInstall && null === $this->devMode) {
|
|
||||||
$this->devMode = $isDevInstall;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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'])) {
|
if (!isset($_SERVER['COMPOSER_DEV_MODE'])) {
|
||||||
Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
|
Platform::putEnv('COMPOSER_DEV_MODE', $this->devMode ? '1' : '0');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue