|
|
@ -53,7 +53,7 @@ return array(
|
|
|
|
EOF;
|
|
|
|
EOF;
|
|
|
|
|
|
|
|
|
|
|
|
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getPackages());
|
|
|
|
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getPackages());
|
|
|
|
$autoloads = $this->parseAutoloads($packageMap);
|
|
|
|
$autoloads = $this->parseAutoloads($packageMap, $filesystem);
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($autoloads['psr-0'] as $namespace => $paths) {
|
|
|
|
foreach ($autoloads['psr-0'] as $namespace => $paths) {
|
|
|
|
$exportedPaths = array();
|
|
|
|
$exportedPaths = array();
|
|
|
@ -118,10 +118,9 @@ EOF;
|
|
|
|
$autoloads['classmap'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['classmap']));
|
|
|
|
$autoloads['classmap'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['classmap']));
|
|
|
|
foreach ($autoloads['classmap'] as $dir) {
|
|
|
|
foreach ($autoloads['classmap'] as $dir) {
|
|
|
|
foreach (ClassMapGenerator::createMap($dir) as $class => $path) {
|
|
|
|
foreach (ClassMapGenerator::createMap($dir) as $class => $path) {
|
|
|
|
|
|
|
|
|
|
|
|
$classmapFile .= ' '.var_export($class, true) . ' => ';
|
|
|
|
$classmapFile .= ' '.var_export($class, true) . ' => ';
|
|
|
|
|
|
|
|
|
|
|
|
if (0 === strpos($path, dirname($vendorPath), 0)) {
|
|
|
|
if (0 === strpos($path, getcwd())) {
|
|
|
|
// this path seems to be located within this application/package
|
|
|
|
// this path seems to be located within this application/package
|
|
|
|
$path = '/' . $filesystem->findShortestPath(getcwd(), $path, true);
|
|
|
|
$path = '/' . $filesystem->findShortestPath(getcwd(), $path, true);
|
|
|
|
$classmapFile .= '$baseDir . ';
|
|
|
|
$classmapFile .= '$baseDir . ';
|
|
|
@ -171,10 +170,15 @@ EOF;
|
|
|
|
* Compiles an ordered list of namespace => path mappings
|
|
|
|
* Compiles an ordered list of namespace => path mappings
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param array $packageMap array of array(package, installDir-relative-to-composer.json)
|
|
|
|
* @param array $packageMap array of array(package, installDir-relative-to-composer.json)
|
|
|
|
|
|
|
|
* @param Filesystem $filesystem optional filesystem instance to use
|
|
|
|
* @return array array('psr-0' => array('Ns\\Foo' => array('installDir')))
|
|
|
|
* @return array array('psr-0' => array('Ns\\Foo' => array('installDir')))
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function parseAutoloads(array $packageMap)
|
|
|
|
public function parseAutoloads(array $packageMap, Filesystem $filesystem = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!$filesystem) {
|
|
|
|
|
|
|
|
$filesystem = new Filesystem;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$autoloads = array('classmap' => array(), 'psr-0' => array(), 'files' => array());
|
|
|
|
$autoloads = array('classmap' => array(), 'psr-0' => array(), 'files' => array());
|
|
|
|
foreach ($packageMap as $item) {
|
|
|
|
foreach ($packageMap as $item) {
|
|
|
|
list($package, $installPath) = $item;
|
|
|
|
list($package, $installPath) = $item;
|
|
|
@ -190,11 +194,17 @@ EOF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach ($mapping as $namespace => $paths) {
|
|
|
|
foreach ($mapping as $namespace => $paths) {
|
|
|
|
foreach ((array) $paths as $path) {
|
|
|
|
foreach ((array) $paths as $path) {
|
|
|
|
|
|
|
|
if ($filesystem->isAbsolutePath($path)) {
|
|
|
|
|
|
|
|
// handle absolute paths in raw form
|
|
|
|
|
|
|
|
$autoloads[$type][$namespace][] = $path;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// prepend install path (including target dir) to the relative paths
|
|
|
|
$autoloads[$type][$namespace][] = empty($installPath) ? $path : $installPath.'/'.$path;
|
|
|
|
$autoloads[$type][$namespace][] = empty($installPath) ? $path : $installPath.'/'.$path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($autoloads as $type => $maps) {
|
|
|
|
foreach ($autoloads as $type => $maps) {
|
|
|
|
krsort($autoloads[$type]);
|
|
|
|
krsort($autoloads[$type]);
|
|
|
|