Make sure multiple autoload files can be used together, fixes #207
parent
c9929a2e82
commit
7222c111ed
|
@ -27,13 +27,16 @@ class AutoloadGenerator
|
|||
{
|
||||
public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir)
|
||||
{
|
||||
$autoloadFile = file_get_contents(__DIR__.'/ClassLoader.php');
|
||||
$autoloadFile .= <<<'EOF'
|
||||
$autoloadFile = <<<'EOF'
|
||||
<?php
|
||||
|
||||
// autoload.php generated by Composer
|
||||
if (!class_exists('Composer\\Autoload\\ClassLoader')) {
|
||||
require __DIR__.'/ClassLoader.php';
|
||||
}
|
||||
|
||||
function init() {
|
||||
$loader = new ClassLoader();
|
||||
$__composer_autoload_init = function() {
|
||||
$loader = new \Composer\Autoload\ClassLoader();
|
||||
|
||||
$map = require __DIR__.'/autoload_namespaces.php';
|
||||
|
||||
|
@ -44,9 +47,9 @@ function init() {
|
|||
$loader->register();
|
||||
|
||||
return $loader;
|
||||
}
|
||||
};
|
||||
|
||||
return init();
|
||||
return $__composer_autoload_init();
|
||||
EOF;
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
|
@ -117,6 +120,8 @@ EOF;
|
|||
|
||||
file_put_contents($targetDir.'/autoload.php', $autoloadFile);
|
||||
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
|
||||
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
|
||||
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue