Skip to content

Commit

Permalink
add exclude-pattern argument to compiler
Browse files Browse the repository at this point in the history
Flyingmana committed Feb 24, 2015

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 9d3bae5 commit ab3f179
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions dev/tools/Magento/Tools/Di/compiler.php
Original file line number Diff line number Diff line change
@@ -32,12 +32,15 @@
'extra-classes-file=s' => 'path to file with extra proxies and factories to generate',
'generation=s' => 'absolute path to generated classes, <magento_root>/var/generation by default',
'di=s' => 'absolute path to DI definitions directory, <magento_root>/var/di by default',
'exclude-pattern=s' => 'allows to exclude Paths from compilation (default is #[\\\\/]m1[\\\\/]#i)',
]
);
$opt->parse();

$generationDir = $opt->getOption('generation') ? $opt->getOption('generation') : $rootDir . '/var/generation';
$diDir = $opt->getOption('di') ? $opt->getOption('di') : $rootDir . '/var/di';
$fileExcludePatterns = $opt->getOption('exclude-pattern') ?
[$opt->getOption('exclude-pattern')] : ['#[\\\\/]M1[\\\\/]#i'];
$relationsFile = $diDir . '/relations.ser';
$pluginDefFile = $diDir . '/plugins.ser';

@@ -60,7 +63,7 @@
$filePatterns = ['php' => '/.*\.php$/', 'di' => '/\/etc\/([a-zA-Z_]*\/di|di)\.xml$/'];
$codeScanDir = realpath($rootDir . '/app');
$directoryScanner = new Scanner\DirectoryScanner();
$files = $directoryScanner->scan($codeScanDir, $filePatterns);
$files = $directoryScanner->scan($codeScanDir, $filePatterns, $fileExcludePatterns);
$files['additional'] = [$opt->getOption('extra-classes-file')];
$entities = [];

@@ -144,11 +147,13 @@
$validator = new \Magento\Framework\Code\Validator();
$validator->add(new \Magento\Framework\Code\Validator\ConstructorIntegrity());
$validator->add(new \Magento\Framework\Code\Validator\ContextAggregation());
$classesScanner = new \Magento\Tools\Di\Code\Reader\ClassesScanner();
$classesScanner->addExcludePatterns($fileExcludePatterns);

$directoryInstancesNamesList = new \Magento\Tools\Di\Code\Reader\InstancesNamesList\Directory(
$log,
new \Magento\Framework\Code\Reader\ClassReader(),
new \Magento\Tools\Di\Code\Reader\ClassesScanner(),
$classesScanner,
$validator,
$generationDir
);

0 comments on commit ab3f179

Please sign in to comment.