Browse Source

Adjust phar compiler to work with composer autoloader

Jordi Boggiano 13 years ago
parent
commit
60db5d2c3b
2 changed files with 19 additions and 2 deletions
  1. 6 1
      bin/compile
  2. 13 1
      src/Composer/Compiler.php

+ 6 - 1
bin/compile

@@ -1,7 +1,12 @@
 #!/usr/bin/env php
 <?php
 
-require __DIR__.'/../tests/bootstrap.php';
+if (!@include __DIR__.'/../vendor/.composer/autoload.php') {
+    die('You must set up the project dependencies, run the following commands:
+wget http://getcomposer.org/composer.phar
+php composer.phar install
+');
+}
 
 use Composer\Compiler;
 

+ 13 - 1
src/Composer/Compiler.php

@@ -51,7 +51,19 @@ class Compiler
             $this->addFile($phar, $file);
         }
 
-        $this->addFile($phar, new \SplFileInfo(__DIR__.'/../../tests/bootstrap.php'));
+        $finder = new Finder();
+        $finder->files()
+            ->ignoreVCS(true)
+            ->name('*.php')
+            ->in(__DIR__.'/../../vendor/symfony/')
+        ;
+
+        foreach ($finder as $file) {
+            $this->addFile($phar, $file);
+        }
+
+        $this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/.composer/autoload.php'));
+        $this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/.composer/autoload_namespaces.php'));
         $this->addComposerBin($phar);
 
         // Stubs