/**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $errors = $this->validate($input);
     if ($errors) {
         $output->writeln($errors);
         return;
     }
     $generationDir = $input->getOption(self::INPUT_KEY_GENERATION) ? $input->getOption(self::INPUT_KEY_GENERATION) : $this->directoryList->getPath(DirectoryList::GENERATION);
     $modulesExcludePatterns = $this->getModuleExcludePatterns();
     $testExcludePatterns = ["#^" . $this->directoryList->getPath(DirectoryList::SETUP) . "/[\\w]+/[\\w]+/Test#", "#^" . $this->directoryList->getRoot() . "/dev/tools/Magento/Tools/[\\w]+/Test#"];
     $librariesExcludePatterns = $this->getLibraryExcludePatterns();
     $testExcludePatterns = array_merge($testExcludePatterns, $modulesExcludePatterns, $librariesExcludePatterns);
     $fileExcludePatterns = $input->getOption('exclude-pattern') ? [$input->getOption(self::INPUT_KEY_EXCLUDE_PATTERN)] : ['#[\\\\/]M1[\\\\/]#i'];
     $fileExcludePatterns = array_merge($fileExcludePatterns, $testExcludePatterns);
     /** @var Writer\Console logWriter Writer model for success messages */
     $logWriter = new Writer\Console($output);
     $this->log = new Log($logWriter, $logWriter);
     AutoloaderRegistry::getAutoloader()->addPsr4('Magento\\', $generationDir . '/Magento/');
     // 1 Code generation
     $this->generateCode($generationDir, $fileExcludePatterns, $input);
     // 2. Compilation
     $this->compileCode($generationDir, $fileExcludePatterns, $input);
     //Reporter
     $this->log->report();
     if (!$this->log->hasError()) {
         $output->writeln('<info>On *nix systems, verify the Magento application has permissions to modify files ' . 'created by the compiler in the "var" directory. For instance, if you run the Magento application ' . 'using Apache, the owner of the files in the "var" directory should be the Apache user (example ' . 'command: "chown -R www-data:www-data <MAGENTO_ROOT>/var" where MAGENTO_ROOT is the Magento ' . 'root directory).</info>');
     }
 }