[Composer] Stwitch to composer vendors management
Bug fix: no Feature addition: yes Backwards compatibility break: ? Symfony2 tests pass: yes Fixes the following tickets: - Todo: - This speeds up Travis CI builds to `~2 min` also makes vendor management a lot easier.
This commit is contained in:
parent
d6948581ac
commit
aa055dfd98
|
@ -5,4 +5,4 @@ php:
|
||||||
- 5.3
|
- 5.3
|
||||||
- 5.4
|
- 5.4
|
||||||
|
|
||||||
before_script: php vendors.php
|
before_script: wget http://getcomposer.org/composer.phar && php composer.phar --install-suggests install
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__.'/src/Symfony/Component/ClassLoader/ClassLoader.php';
|
|
||||||
|
|
||||||
use Symfony\Component\ClassLoader\ClassLoader;
|
|
||||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
|
||||||
|
|
||||||
$loader = new ClassLoader();
|
|
||||||
$loader->addPrefixes(array(
|
|
||||||
'Symfony\\Tests\\' => __DIR__.'/tests',
|
|
||||||
'Symfony\\' => __DIR__.'/src',
|
|
||||||
'Doctrine\\Common\\DataFixtures\\' => __DIR__.'/vendor/doctrine-fixtures/lib',
|
|
||||||
'Doctrine\\Common\\' => __DIR__.'/vendor/doctrine-common/lib',
|
|
||||||
'Doctrine\\DBAL\\' => __DIR__.'/vendor/doctrine-dbal/lib',
|
|
||||||
'Doctrine\\ORM\\' => __DIR__.'/vendor/doctrine/lib',
|
|
||||||
'Monolog\\' => __DIR__.'/vendor/monolog/src',
|
|
||||||
'Twig_' => __DIR__.'/vendor/twig/lib',
|
|
||||||
));
|
|
||||||
if (!function_exists('intl_get_error_code')) {
|
|
||||||
require_once __DIR__.'/src/Symfony/Component/Locale/Resources/stubs/functions.php';
|
|
||||||
|
|
||||||
$loader->addPrefix('', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
|
|
||||||
}
|
|
||||||
if (!interface_exists('SessionHandlerInterface', false)) {
|
|
||||||
$loader->addPrefix('SessionHandlerInterface', __DIR__.'/src/Symfony/Component/HttpFoundation/Resources/stubs');
|
|
||||||
}
|
|
||||||
$loader->register();
|
|
||||||
|
|
||||||
if (is_file(__DIR__.'/vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php')) {
|
|
||||||
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_file(__DIR__.'/vendor/swiftmailer/lib/classes/Swift.php')) {
|
|
||||||
require_once __DIR__.'/vendor/swiftmailer/lib/classes/Swift.php';
|
|
||||||
Swift::registerAutoload(__DIR__.'/vendor/swiftmailer/lib/swift_init.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_file($file = __DIR__.'/vendor/propel/runtime/lib/Propel.php')) {
|
|
||||||
require_once $file;
|
|
||||||
}
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$loader = require_once __DIR__.'/vendor/.composer/autoload.php';
|
||||||
|
$loader->add('Symfony\\Tests', __DIR__.'/tests');
|
||||||
|
|
||||||
|
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||||
|
|
||||||
|
if (!function_exists('intl_get_error_code')) {
|
||||||
|
require_once __DIR__.'/src/Symfony/Component/Locale/Resources/stubs/functions.php';
|
||||||
|
|
||||||
|
$loader->add('IntlDateFormatter', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
|
||||||
|
$loader->add('Collator', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
|
||||||
|
$loader->add('Locale', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
|
||||||
|
$loader->add('NumberFormatter', __DIR__.'/src/Symfony/Component/Locale/Resources/stubs');
|
||||||
|
}
|
||||||
|
|
||||||
|
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
|
||||||
|
AnnotationRegistry::registerFile(__DIR__.'/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
|
||||||
|
|
||||||
|
if (is_file(__DIR__.'/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php')) {
|
||||||
|
require_once __DIR__.'/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php';
|
||||||
|
Swift::registerAutoload(__DIR__.'/vendor/swiftmailer/swiftmailer/lib/swift_init.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_file($file = __DIR__.'/vendor/propel/propel/runtime/lib/Propel.php')) {
|
||||||
|
require_once $file;
|
||||||
|
}
|
|
@ -52,7 +52,10 @@
|
||||||
"symfony/yaml": "self.version"
|
"symfony/yaml": "self.version"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"doctrine/data-fixtures": "1.0.*"
|
"doctrine/dbal": "2.2.*",
|
||||||
|
"doctrine/orm": "2.2.*",
|
||||||
|
"doctrine/data-fixtures": "1.0.*",
|
||||||
|
"propel/propel1": "dev-master"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
syntaxCheck="false"
|
syntaxCheck="false"
|
||||||
bootstrap="autoload.php.dist"
|
bootstrap="composer.autoload.php.dist"
|
||||||
>
|
>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Symfony Test Suite">
|
<testsuite name="Symfony Test Suite">
|
||||||
|
|
|
@ -22,6 +22,14 @@ while ($dir !== $lastDir) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
file_exists($dir.'/vendor/.composer/autoload.php')
|
||||||
|
&& file_exists($dir.'/composer.autoload.php.dist')
|
||||||
|
) {
|
||||||
|
require_once $dir.'/composer.autoload.php.dist';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (file_exists($dir.'/autoload.php.dist')) {
|
if (file_exists($dir.'/autoload.php.dist')) {
|
||||||
require_once $dir.'/autoload.php.dist';
|
require_once $dir.'/autoload.php.dist';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -22,6 +22,14 @@ while ($dir !== $lastDir) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
file_exists($dir.'/vendor/.composer/autoload.php')
|
||||||
|
&& file_exists($dir.'/composer.autoload.php.dist')
|
||||||
|
) {
|
||||||
|
require_once $dir.'/composer.autoload.php.dist';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_file($dir.'/autoload.php.dist')) {
|
if (is_file($dir.'/autoload.php.dist')) {
|
||||||
require_once $dir.'/autoload.php.dist';
|
require_once $dir.'/autoload.php.dist';
|
||||||
break;
|
break;
|
||||||
|
|
65
vendors.php
65
vendors.php
|
@ -1,65 +0,0 @@
|
||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of the Symfony package.
|
|
||||||
*
|
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
CAUTION: This file installs the dependencies needed to run the Symfony2 test suite.
|
|
||||||
If you want to create a new project, download the Symfony Standard Edition instead:
|
|
||||||
|
|
||||||
http://symfony.com/download
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
set_time_limit(0);
|
|
||||||
|
|
||||||
if (!is_dir($vendorDir = dirname(__FILE__).'/vendor')) {
|
|
||||||
mkdir($vendorDir, 0777, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// optional transport change
|
|
||||||
$transport = false;
|
|
||||||
if (isset($argv[1]) && in_array($argv[1], array('--transport=http', '--transport=https', '--transport=git'))) {
|
|
||||||
$transport = preg_replace('/^--transport=(.*)$/', '$1', $argv[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$deps = array(
|
|
||||||
array('doctrine', 'http://github.com/doctrine/doctrine2.git', 'origin/master'),
|
|
||||||
array('doctrine-dbal', 'http://github.com/doctrine/dbal.git', 'origin/master'),
|
|
||||||
array('doctrine-fixtures', 'https://github.com/doctrine/data-fixtures.git', 'origin/master'),
|
|
||||||
array('doctrine-common', 'http://github.com/doctrine/common.git', 'origin/master'),
|
|
||||||
array('twig', 'http://github.com/fabpot/Twig.git', 'origin/master'),
|
|
||||||
array('propel', 'http://github.com/propelorm/Propel.git', 'origin/master'),
|
|
||||||
array('monolog', 'https://github.com/Seldaek/monolog.git', 'origin/master'),
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($deps as $dep) {
|
|
||||||
list($name, $url, $rev) = $dep;
|
|
||||||
|
|
||||||
if ($transport) {
|
|
||||||
$url = preg_replace('/^(http:|https:|git:)(.*)/', $transport . ':$2', $url);
|
|
||||||
}
|
|
||||||
|
|
||||||
$installDir = $vendorDir.'/'.$name;
|
|
||||||
$install = false;
|
|
||||||
if (!is_dir($installDir)) {
|
|
||||||
$install = true;
|
|
||||||
echo "> Installing $name\n";
|
|
||||||
|
|
||||||
system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$install) {
|
|
||||||
echo "> Updating $name\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
|
|
||||||
}
|
|
Reference in New Issue