Changeset View
Changeset View
Standalone View
Standalone View
src/moduleutils/PhutilLibraryMapBuilder.php
Show First 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | /* -( Symbol Analysis and Caching )---------------------------------------- */ | ||||
private function buildSymbolAnalysisFuture($file) { | private function buildSymbolAnalysisFuture($file) { | ||||
$absolute_file = $this->getPath($file); | $absolute_file = $this->getPath($file); | ||||
return self::newExtractSymbolsFuture( | return self::newExtractSymbolsFuture( | ||||
array(), | array(), | ||||
array($absolute_file)); | array($absolute_file)); | ||||
} | } | ||||
private static function newExtractSymbolsFuture(array $flags, array $paths) { | private static function newExtractSymbolsFuture(array $flags, array $paths) { | ||||
$bin = dirname(__FILE__).'/../../support/lib/extract-symbols.php'; | $bin = __DIR__.'/../../support/lib/extract-symbols.php'; | ||||
return new ExecFuture( | return new ExecFuture( | ||||
'php -f %R -- --ugly %Ls -- %Ls', | 'php -f %R -- --ugly %Ls -- %Ls', | ||||
$bin, | $bin, | ||||
$flags, | $flags, | ||||
$paths); | $paths); | ||||
} | } | ||||
Show All 29 Lines | private function loadSourceFileMap() { | ||||
if (!Filesystem::pathExists($init)) { | if (!Filesystem::pathExists($init)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
"Provided path '%s' is not a %s library.", | "Provided path '%s' is not a %s library.", | ||||
$root, | $root, | ||||
'phutil')); | 'phutil')); | ||||
} | } | ||||
$files = id(new FileFinder($root)) | $files = (new FileFinder($root)) | ||||
->withType('f') | ->withType('f') | ||||
->withSuffix('php') | ->withSuffix('php') | ||||
->excludePath('*/.*') | ->excludePath('*/.*') | ||||
->setGenerateChecksums(true) | ->setGenerateChecksums(true) | ||||
->find(); | ->find(); | ||||
$extensions_dir = 'extensions/'; | $extensions_dir = 'extensions/'; | ||||
$extensions_len = strlen($extensions_dir); | $extensions_len = strlen($extensions_dir); | ||||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | private function analyzeLibrary() { | ||||
// Run the analyzer on any files which need analysis. | // Run the analyzer on any files which need analysis. | ||||
if ($futures) { | if ($futures) { | ||||
$limit = $this->subprocessLimit; | $limit = $this->subprocessLimit; | ||||
$progress = new PhutilConsoleProgressBar(); | $progress = new PhutilConsoleProgressBar(); | ||||
$progress->setTotal(count($futures)); | $progress->setTotal(count($futures)); | ||||
$futures = id(new FutureIterator($futures)) | $futures = (new FutureIterator($futures)) | ||||
->limit($limit); | ->limit($limit); | ||||
foreach ($futures as $file => $future) { | foreach ($futures as $file => $future) { | ||||
$result = $future->resolveJSON(); | $result = $future->resolveJSON(); | ||||
if (empty($result['error'])) { | if (empty($result['error'])) { | ||||
$symbol_map[$file] = $result; | $symbol_map[$file] = $result; | ||||
} else { | } else { | ||||
$progress->done(false); | $progress->done(false); | ||||
throw new XHPASTSyntaxErrorException( | throw new XHPASTSyntaxErrorException( | ||||
Show All 21 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0