Remove BC code
parent
a06ebdd8ef
commit
4bbb168d44
|
@ -24,7 +24,7 @@ use Composer\Util\Filesystem;
|
||||||
*/
|
*/
|
||||||
class AutoloadGenerator
|
class AutoloadGenerator
|
||||||
{
|
{
|
||||||
public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $bcLinks = false)
|
public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir)
|
||||||
{
|
{
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
$filesystem->ensureDirectoryExists($installationManager->getVendorPath());
|
$filesystem->ensureDirectoryExists($installationManager->getVendorPath());
|
||||||
|
@ -134,20 +134,6 @@ EOF;
|
||||||
}
|
}
|
||||||
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, true, true, (Boolean) $includePathFile, $targetDirLoader, $filesCode));
|
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, true, true, (Boolean) $includePathFile, $targetDirLoader, $filesCode));
|
||||||
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
||||||
|
|
||||||
// TODO BC feature, remove after June 15th
|
|
||||||
if ($bcLinks) {
|
|
||||||
$filesystem->ensureDirectoryExists($vendorPath.'/.composer');
|
|
||||||
$deprecated = "// Deprecated file, use the one in root of vendor dir\n".
|
|
||||||
"trigger_error(__FILE__.' is deprecated, please use vendor/autoload.php or vendor/composer/autoload_* instead'.PHP_EOL.'See https://groups.google.com/forum/#!msg/composer-dev/fWIs3KocwoA/nU3aLko9LhQJ for details', E_USER_DEPRECATED);\n";
|
|
||||||
file_put_contents($vendorPath.'/.composer/autoload_namespaces.php', "<?php\n{$deprecated}\nreturn include dirname(__DIR__).'/composer/autoload_namespaces.php';\n");
|
|
||||||
file_put_contents($vendorPath.'/.composer/autoload_classmap.php', "<?php\n{$deprecated}\nreturn include dirname(__DIR__).'/composer/autoload_classmap.php';\n");
|
|
||||||
file_put_contents($vendorPath.'/.composer/autoload.php', "<?php\n{$deprecated}\nreturn include dirname(__DIR__).'/autoload.php';\n");
|
|
||||||
file_put_contents($vendorPath.'/.composer/ClassLoader.php', "<?php\n{$deprecated}\nreturn include dirname(__DIR__).'/composer/ClassLoader.php';\n");
|
|
||||||
if ($includePathFile) {
|
|
||||||
file_put_contents($vendorPath.'/.composer/include_paths.php', "<?php\n{$deprecated}\nreturn include dirname(__DIR__).'/composer/include_paths.php';\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
|
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
|
||||||
|
|
|
@ -51,9 +51,6 @@ class GitDownloader extends VcsDownloader
|
||||||
$this->io->setAuthorization('github.com', $match[1], $match[2]);
|
$this->io->setAuthorization('github.com', $match[1], $match[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: BC for the composer remote that didn't exist, to be remove after May 18th.
|
|
||||||
$this->process->execute(sprintf('cd %s && git remote add composer %s', escapeshellarg($path), escapeshellarg($initial->getSourceUrl())), $ignoredOutput);
|
|
||||||
|
|
||||||
$commandCallable = function($url) use ($ref, $path, $command) {
|
$commandCallable = function($url) use ($ref, $path, $command) {
|
||||||
return sprintf($command, escapeshellarg($path), escapeshellarg($url), escapeshellarg($ref));
|
return sprintf($command, escapeshellarg($path), escapeshellarg($url), escapeshellarg($ref));
|
||||||
};
|
};
|
||||||
|
|
|
@ -167,23 +167,6 @@ class Factory
|
||||||
|
|
||||||
protected function addLocalRepository(RepositoryManager $rm, $vendorDir)
|
protected function addLocalRepository(RepositoryManager $rm, $vendorDir)
|
||||||
{
|
{
|
||||||
// TODO BC feature, remove after June 15th
|
|
||||||
if (file_exists($vendorDir.'/.composer/installed.json')) {
|
|
||||||
if (!is_dir($vendorDir.'/composer')) { mkdir($vendorDir.'/composer/', 0777, true); }
|
|
||||||
rename($vendorDir.'/.composer/installed.json', $vendorDir.'/composer/installed.json');
|
|
||||||
}
|
|
||||||
if (file_exists($vendorDir.'/.composer/installed_dev.json')) {
|
|
||||||
if (!is_dir($vendorDir.'/composer')) { mkdir($vendorDir.'/composer/', 0777, true); }
|
|
||||||
rename($vendorDir.'/.composer/installed_dev.json', $vendorDir.'/composer/installed_dev.json');
|
|
||||||
}
|
|
||||||
if (file_exists($vendorDir.'/installed.json')) {
|
|
||||||
if (!is_dir($vendorDir.'/composer')) { mkdir($vendorDir.'/composer/', 0777, true); }
|
|
||||||
rename($vendorDir.'/installed.json', $vendorDir.'/composer/installed.json');
|
|
||||||
}
|
|
||||||
if (file_exists($vendorDir.'/installed_dev.json')) {
|
|
||||||
if (!is_dir($vendorDir.'/composer')) { mkdir($vendorDir.'/composer/', 0777, true); }
|
|
||||||
rename($vendorDir.'/installed_dev.json', $vendorDir.'/composer/installed_dev.json');
|
|
||||||
}
|
|
||||||
$rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json')));
|
$rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json')));
|
||||||
$rm->setLocalDevRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed_dev.json')));
|
$rm->setLocalDevRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed_dev.json')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ class Installer
|
||||||
// write autoloader
|
// write autoloader
|
||||||
$this->io->write('<info>Generating autoload files</info>');
|
$this->io->write('<info>Generating autoload files</info>');
|
||||||
$localRepos = new CompositeRepository($this->repositoryManager->getLocalRepositories());
|
$localRepos = new CompositeRepository($this->repositoryManager->getLocalRepositories());
|
||||||
$this->autoloadGenerator->dump($localRepos, $this->package, $this->installationManager, $this->installationManager->getVendorPath() . '/composer', true);
|
$this->autoloadGenerator->dump($localRepos, $this->package, $this->installationManager, $this->installationManager->getVendorPath() . '/composer');
|
||||||
|
|
||||||
if ($this->runScripts) {
|
if ($this->runScripts) {
|
||||||
// dispatch post event
|
// dispatch post event
|
||||||
|
|
|
@ -89,12 +89,6 @@ class Locker
|
||||||
$repo = $dev ? $this->repositoryManager->getLocalDevRepository() : $this->repositoryManager->getLocalRepository();
|
$repo = $dev ? $this->repositoryManager->getLocalDevRepository() : $this->repositoryManager->getLocalRepository();
|
||||||
|
|
||||||
foreach ($lockedPackages as $info) {
|
foreach ($lockedPackages as $info) {
|
||||||
// TODO BC remove this after June 10th
|
|
||||||
if (isset($info['alias']) && empty($warned)) {
|
|
||||||
$warned = true;
|
|
||||||
echo 'BC warning: your lock file appears to be of an older format than this composer version, it is recommended to run composer update'.PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
$resolvedVersion = !empty($info['alias-version']) ? $info['alias-version'] : $info['version'];
|
$resolvedVersion = !empty($info['alias-version']) ? $info['alias-version'] : $info['version'];
|
||||||
|
|
||||||
// try to find the package in the local repo (best match)
|
// try to find the package in the local repo (best match)
|
||||||
|
|
|
@ -159,10 +159,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
$processExecutor->expects($this->at(2))
|
$processExecutor->expects($this->at(2))
|
||||||
->method('execute')
|
|
||||||
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote add composer 'https://github.com/composer/composer'")))
|
|
||||||
->will($this->returnValue(0));
|
|
||||||
$processExecutor->expects($this->at(3))
|
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo($expectedGitUpdateCommand))
|
->with($this->equalTo($expectedGitUpdateCommand))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
|
@ -196,10 +192,6 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote -v")))
|
||||||
->will($this->returnValue(0));
|
->will($this->returnValue(0));
|
||||||
$processExecutor->expects($this->at(2))
|
$processExecutor->expects($this->at(2))
|
||||||
->method('execute')
|
|
||||||
->with($this->equalTo($this->getCmd("cd 'composerPath' && git remote add composer 'https://github.com/composer/composer'")))
|
|
||||||
->will($this->returnValue(0));
|
|
||||||
$processExecutor->expects($this->at(3))
|
|
||||||
->method('execute')
|
->method('execute')
|
||||||
->with($this->equalTo($expectedGitUpdateCommand))
|
->with($this->equalTo($expectedGitUpdateCommand))
|
||||||
->will($this->returnValue(1));
|
->will($this->returnValue(1));
|
||||||
|
|
Loading…
Reference in New Issue