Handle dump-autoload where vendor folder is not installed or not complete (#12139)
* Handle dump-autoload where vendor folder is not installed or not complete * Fix implementation issues The package could theoretically be a single file not a directory --------- Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>pull/12143/head
parent
8949f91117
commit
edb1588f68
|
@ -12,6 +12,7 @@
|
|||
|
||||
namespace Composer\Command;
|
||||
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Plugin\CommandEvent;
|
||||
use Composer\Plugin\PluginEvents;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -67,6 +68,17 @@ EOT
|
|||
$package = $composer->getPackage();
|
||||
$config = $composer->getConfig();
|
||||
|
||||
$missingDependencies = false;
|
||||
foreach ($localRepo->getCanonicalPackages() as $localPkg) {
|
||||
$installPath = $installationManager->getInstallPath($localPkg);
|
||||
if ($installPath !== null && file_exists($installPath) === false) {
|
||||
$missingDependencies = true;
|
||||
$this->getIO()->write('<warning>Not all dependencies are installed. Make sure to run a "composer install" to install missing dependencies</warning>');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
|
||||
$authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
|
||||
$apcuPrefix = $input->getOption('apcu-prefix');
|
||||
|
@ -124,7 +136,7 @@ EOT
|
|||
$this->getIO()->write('<info>Generated autoload files</info>');
|
||||
}
|
||||
|
||||
if ($input->getOption('strict-psr') && count($classMap->getPsrViolations()) > 0) {
|
||||
if ($missingDependencies || ($input->getOption('strict-psr') && count($classMap->getPsrViolations()) > 0)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue