mirror of
https://github.com/composer/composer
synced 2025-05-10 00:53:06 +00:00
Merge remote-tracking branch 'ronnylt/script-event-post-dump-autoload'
Conflicts: tests/Composer/Test/Autoload/AutoloadGeneratorTest.php
This commit is contained in:
commit
8d55b9cced
12 changed files with 132 additions and 16 deletions
|
@ -18,6 +18,8 @@ use Composer\Package\AliasPackage;
|
|||
use Composer\Package\PackageInterface;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Util\Filesystem;
|
||||
use Composer\Script\EventDispatcher;
|
||||
use Composer\Script\ScriptEvents;
|
||||
|
||||
/**
|
||||
* @author Igor Wiedler <igor@wiedler.ch>
|
||||
|
@ -25,6 +27,16 @@ use Composer\Util\Filesystem;
|
|||
*/
|
||||
class AutoloadGenerator
|
||||
{
|
||||
/**
|
||||
* @var EventDispatcher
|
||||
*/
|
||||
private $eventDispatcher;
|
||||
|
||||
public function __construct(EventDispatcher $eventDispatcher)
|
||||
{
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
public function dump(Config $config, RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
|
||||
{
|
||||
$filesystem = new Filesystem();
|
||||
|
@ -174,6 +186,8 @@ EOF;
|
|||
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
||||
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath));
|
||||
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
||||
|
||||
$this->eventDispatcher->dispatch(ScriptEvents::POST_AUTOLOAD_DUMP);
|
||||
}
|
||||
|
||||
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue