Skip to content

Commit

Permalink
Filter the libraries to split by the selected libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
francoispluchino committed May 7, 2020
1 parent b33b428 commit ccdca17
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Command/SplitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected function initLibraries(InputInterface $input): void
$config = $this->getReleaser()->getConfig();
$baseDir = $config->getBaseDir();
$configLibraries = (array) $config->get('libraries', []);
$libraryNames = $input->getArgument('library');
$libraryNames = (array) $input->getArgument('library');
$this->libraries = $configLibraries;

foreach ($libraryNames as $libraryName) {
Expand All @@ -157,6 +157,8 @@ protected function initLibraries(InputInterface $input): void
foreach (array_keys($this->libraries) as $libraryName) {
if (!isset($configLibraries[$libraryName]) || !is_dir($baseDir.'/'.$libraryName)) {
unset($this->libraries[$libraryName]);
} elseif (!empty($libraryNames) && !\in_array($libraryName, $libraryNames, true)) {
unset($this->libraries[$libraryName]);
}
}
}
Expand All @@ -172,9 +174,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$fetch = $input->getOption('fetch');
$allowScratch = $input->getOption('scratch');
$allLibraries = $input->getOption('all-lib');
$libraryNames = (array) $input->getArgument('library');

foreach ($this->branches as $branch) {
$libraryPaths = $allLibraries
$libraryPaths = $allLibraries || !empty($libraryNames)
? array_keys($this->libraries)
: GitUtil::getLibraries($this->libraries, $branch, $this->depth);

Expand Down

0 comments on commit ccdca17

Please sign in to comment.