build_bootstrap.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of the Symfony Standard Edition.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. $argv = $_SERVER['argv'];
  12. // allow the base path to be passed as the first argument, or default
  13. if (isset($argv[1])) {
  14. $baseDir = $argv[1];
  15. } else {
  16. if (!$baseDir = realpath(__DIR__.'/../../../../../../..')) {
  17. exit('Looks like you don\'t have a standard layout.');
  18. }
  19. }
  20. require_once $baseDir.'/vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
  21. /*
  22. * This file is part of the Symfony package.
  23. *
  24. * (c) Fabien Potencier <fabien@symfony.com>
  25. *
  26. * For the full copyright and license information, please view the LICENSE
  27. * file that was distributed with this source code.
  28. */
  29. use Symfony\Component\ClassLoader\UniversalClassLoader;
  30. use Symfony\Component\ClassLoader\ClassCollectionLoader;
  31. $loader = new UniversalClassLoader();
  32. $loader->registerNamespaces(array('Symfony' => $baseDir.'/vendor/symfony/src'));
  33. $loader->register();
  34. $file = $baseDir.'/app/bootstrap.php.cache';
  35. if (file_exists($file)) {
  36. unlink($file);
  37. }
  38. ClassCollectionLoader::load(array(
  39. 'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface',
  40. // Cannot be included because annotations will parse the big compiled class file
  41. //'Symfony\\Component\\DependencyInjection\\ContainerAware',
  42. 'Symfony\\Component\\DependencyInjection\\ContainerInterface',
  43. 'Symfony\\Component\\DependencyInjection\\Container',
  44. 'Symfony\\Component\\HttpKernel\\HttpKernelInterface',
  45. 'Symfony\\Component\\HttpKernel\\KernelInterface',
  46. 'Symfony\\Component\\HttpKernel\\Kernel',
  47. 'Symfony\\Component\\ClassLoader\\ClassCollectionLoader',
  48. //'Symfony\\Component\\ClassLoader\\UniversalClassLoader',
  49. 'Symfony\\Component\\HttpKernel\\Bundle\\Bundle',
  50. 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface',
  51. 'Symfony\\Component\\Config\\ConfigCache',
  52. // cannot be included as commands are discovered based on the path to this class via Reflection
  53. //'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle',
  54. ), dirname($file), basename($file, '.php.cache'), false, false, '.php.cache');
  55. file_put_contents($file, "<?php\n\nnamespace { require_once __DIR__.'/autoload.php'; }\n\n".substr(file_get_contents($file), 5));