compile 966 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env php
  2. <?php
  3. $cwd = getcwd();
  4. chdir(__DIR__.'/../');
  5. $ts = rtrim(shell_exec('git log -n1 --pretty=%ct HEAD'));
  6. if (!is_numeric($ts)) {
  7. echo 'Could not detect date using "git log -n1 --pretty=%ct HEAD"'.PHP_EOL;
  8. exit(1);
  9. }
  10. // Install with the current version to force it having the right ClassLoader version
  11. // Install without dev packages to clean up the included classmap from phpunit classes
  12. shell_exec('php bin/composer config autoloader-suffix ComposerPhar' . $ts);
  13. shell_exec('php bin/composer install -q --no-dev');
  14. shell_exec('php bin/composer config autoloader-suffix --unset');
  15. chdir($cwd);
  16. require __DIR__.'/../src/bootstrap.php';
  17. use Composer\Compiler;
  18. error_reporting(-1);
  19. ini_set('display_errors', 1);
  20. try {
  21. $compiler = new Compiler();
  22. $compiler->compile();
  23. } catch (\Exception $e) {
  24. echo 'Failed to compile phar: ['.get_class($e).'] '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().PHP_EOL;
  25. exit(1);
  26. }