1
0
Fork 0

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
PrinsFrank 2024-10-02 13:25:46 +02:00 committed by GitHub
parent 8949f91117
commit edb1588f68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 1 deletions

View File

@ -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;
}