build.sh 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/sh
  2. # This file is part of the Symfony Standard Edition.
  3. #
  4. # (c) Fabien Potencier <fabien@symfony.com>
  5. #
  6. # For the full copyright and license information, please view the LICENSE
  7. # file that was distributed with this source code.
  8. DIR=`php -r "echo realpath(dirname(\\$_SERVER['argv'][0]));"`
  9. cd $DIR
  10. VERSION=`grep 'VERSION' vendor/symfony/src/Symfony/Component/HttpKernel/Kernel.php | sed -E "s/.*'(.+)'.*/\1/g"`
  11. if [ ! -d "$DIR/build" ]; then
  12. mkdir -p $DIR/build
  13. fi
  14. $DIR/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
  15. $DIR/app/console assets:install web/
  16. # Without vendors
  17. rm -rf /tmp/Symfony
  18. mkdir /tmp/Symfony
  19. cp -r app /tmp/Symfony/
  20. cp -r bin /tmp/Symfony/
  21. cp -r src /tmp/Symfony/
  22. cp -r web /tmp/Symfony/
  23. cp -r README.md /tmp/Symfony/
  24. cp -r LICENSE /tmp/Symfony/
  25. cp -r deps /tmp/Symfony/
  26. cp -r deps.lock /tmp/Symfony/
  27. cd /tmp/Symfony
  28. sudo rm -rf app/cache/* app/logs/* .git*
  29. chmod 777 app/cache app/logs
  30. # DS_Store cleanup
  31. find . -name .DS_Store | xargs rm -rf -
  32. cd ..
  33. # avoid the creation of ._* files
  34. export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
  35. export COPYFILE_DISABLE=true
  36. tar zcpf $DIR/build/Symfony_Standard_$VERSION.tgz Symfony
  37. sudo rm -f $DIR/build/Symfony_Standard_$VERSION.zip
  38. zip -rq $DIR/build/Symfony_Standard_$VERSION.zip Symfony
  39. # With vendors
  40. cd $DIR
  41. rm -rf /tmp/vendor
  42. mkdir /tmp/vendor
  43. TARGET=/tmp/vendor
  44. if [ ! -d "$DIR/vendor" ]; then
  45. echo "The master vendor directory does not exist"
  46. exit
  47. fi
  48. cp -r $DIR/vendor/* $TARGET/
  49. # Doctrine ORM
  50. cd $TARGET/doctrine && rm -rf UPGRADE* build* bin tests tools lib/vendor
  51. # Doctrine DBAL
  52. cd $TARGET/doctrine-dbal && rm -rf bin build* tests lib/vendor
  53. # Doctrine Common
  54. cd $TARGET/doctrine-common && rm -rf build* tests lib/vendor
  55. # Swiftmailer
  56. cd $TARGET/swiftmailer && rm -rf CHANGES README* build* docs notes test-suite tests create_pear_package.php package*
  57. # Symfony
  58. cd $TARGET/symfony && rm -rf README.md phpunit.xml* tests *.sh vendor
  59. # Twig
  60. cd $TARGET/twig && rm -rf AUTHORS CHANGELOG README.markdown bin doc package.xml.tpl phpunit.xml* test
  61. # Twig Extensions
  62. cd $TARGET/twig-extensions && rm -rf README doc phpunit.xml* test
  63. # Monolog
  64. cd $TARGET/monolog && rm -rf README.markdown phpunit.xml* tests
  65. # Metadata
  66. cd $TARGET/metadata && rm -rf README.rst phpunit.xml* tests
  67. # cleanup
  68. find $TARGET -name .git | xargs rm -rf -
  69. find $TARGET -name .gitignore | xargs rm -rf -
  70. find $TARGET -name .gitmodules | xargs rm -rf -
  71. find $TARGET -name .svn | xargs rm -rf -
  72. cd /tmp/
  73. mv /tmp/vendor /tmp/Symfony/
  74. tar zcpf $DIR/build/Symfony_Standard_Vendors_$VERSION.tgz Symfony
  75. sudo rm -f $DIR/build/Symfony_Standard_Vendors_$VERSION.zip
  76. zip -rq $DIR/build/Symfony_Standard_Vendors_$VERSION.zip Symfony