The build step is very simple and consists of generating a vendor/autoload.php file similar to how Composer generates it. Prototype at Monorepo funtionality. No change detection yet.
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $noDevMode = (bool) $input->getOption('no-dev');
     $optimize = (bool) $input->getOption('optimize-autoloader');
     $build = new Build(new ConsoleIO($input, $output, $this->getHelperSet()));
     $build->build(getcwd(), $optimize, $noDevMode);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $range = $input->getArgument('range') ?: (isset($_SERVER['TRAVIS_COMMIT_RANGE']) ? $_SERVER['TRAVIS_COMMIT_RANGE'] : '');
     if (!$range) {
         throw new \RuntimeException("No git range given via argument or TRAVIS_COMMIT_RANGE environment variable.");
     }
     exec('git diff --name-only ' . escapeshellarg($range), $result);
     $build = new Build(new ConsoleIO($input, $output, $this->getHelperSet()));
     $this->packages = $build->loadPackages(getcwd());
     $changePackageName = rtrim($input->getArgument('package'), '/');
     $this->calculateDependencies($changePackageName);
     if ($output->isVerbose()) {
         $output->writeln('Checking for changes in the following directories:');
         foreach ($this->checkPaths as $checkPath) {
             $output->writeln('- ' . $checkPath);
         }
         $output->writeln(sprintf('Iterating the changed files in git commit range %s', $range));
     }
     $found = false;
     foreach ($result as $changedFile) {
         if ($output->isVerbose()) {
             $output->writeln(sprintf("- %s", $changedFile));
         }
         foreach ($this->checkPaths as $checkPath) {
             if (strpos(trim($changedFile), $checkPath) !== false) {
                 if ($output->isVerbose()) {
                     $output->writeln(sprintf('  Matches check path %s', $checkPath));
                 }
                 $found = true;
             }
         }
     }
     exit($found ? 0 : 1);
 }
 public function testBuildWithAdvancedExampleProject()
 {
     $build = new Build();
     $build->build(__DIR__ . '/../_fixtures/example-advanced');
     $barAutoloadReal = file_get_contents(__DIR__ . '/../_fixtures/example-advanced/bar/vendor/composer/autoload_real.php');
     $barIncludeFiles = (include __DIR__ . '/../_fixtures/example-advanced/bar/vendor/composer/autoload_files.php');
     $this->assertEquals(array(realpath(__DIR__ . '/../../') . '/vendor/foo/baz/bin/baz'), array_values($barIncludeFiles));
     $this->assertContains('composerRequireOnce', $barAutoloadReal);
 }
예제 #4
0
 /**
  * Delegate autoload dump to all the monorepo subdirectories.
  */
 public function generateMonorepoAutoloads(Event $event)
 {
     $flags = $event->getFlags();
     $optimize = isset($flags['optimize']) ? $flags['optimize'] : false;
     $this->build->build(getcwd(), $optimize, !$event->isDevMode());
 }