/** * * * @param object \InputInterface * @param object \OutputInterface * @return void */ private function processKernel(InputInterface $input, OutputInterface $output) { $kernelFilepath = $this->config->get('kernel_file'); $outputFile = $this->config->get('build_dir') . '/Kernel.js'; $dependencies = Dependency::getKernelDependencies($this->config, $kernelFilepath); Dependency::merge($this->config, $dependencies, $outputFile, true); // true toggle kernel mode ("_build" dir is not taken in account in rewrite) Module::rewriteKernel($this->config, $kernelFilepath, $outputFile); }
/** * Merge dependencies in one single file * * @param object \Config * @param array Dependencies pathes (indexd by module shortname) * @param string Output final file path * @return bool */ public static function merge(\Adadgio\Common\Config $config, array $dependencies = array(), $outputFile, $kernelMode = false) { $contents = null; foreach ($dependencies as $modulePath) { $basename = basename($modulePath); $script = Module::rewrite($config, $modulePath, $kernelMode); $contents .= "\n" . $script; } return file_put_contents($outputFile, $contents); }