1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Improve symbol generation scripts

Summary: Currently the symbol generation scripts fail if passed a list containing no files because `explode("\n", $input)` returns `array("")` rather than `array()`. This means that a generic Harbormaster Build Plan with a step which executes `find . -type f -name '*.php' | ./scripts/generate_php_symbols.php` won't work because it fails in repositories that don't contain any PHP code.

Test Plan: Ran `echo | generate_php_symbols` and saw no output instead of an exception.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D19588
This commit is contained in:
Joshua Spence 2018-08-16 06:39:07 +10:00
parent cc1def6cea
commit ba25586016
2 changed files with 8 additions and 0 deletions

View file

@ -39,6 +39,10 @@ $data = array();
$futures = array(); $futures = array();
foreach (explode("\n", trim($input)) as $file) { foreach (explode("\n", trim($input)) as $file) {
if (!strlen($file)) {
continue;
}
$file = Filesystem::readablePath($file); $file = Filesystem::readablePath($file);
$futures[$file] = ctags_get_parser_future($file); $futures[$file] = ctags_get_parser_future($file);
} }

View file

@ -27,6 +27,10 @@ $data = array();
$futures = array(); $futures = array();
foreach (explode("\n", trim($input)) as $file) { foreach (explode("\n", trim($input)) as $file) {
if (!strlen($file)) {
continue;
}
$file = Filesystem::readablePath($file); $file = Filesystem::readablePath($file);
$data[$file] = Filesystem::readFile($file); $data[$file] = Filesystem::readFile($file);
$futures[$file] = PhutilXHPASTBinary::getParserFuture($data[$file]); $futures[$file] = PhutilXHPASTBinary::getParserFuture($data[$file]);