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

Improve phutil module linter behavior for vanished modules and missing or

broken __init__.php.

Summary: This allows phutilmodulelinter to generate missing __init__.php and
recover from missing modules without horrible fataltown.

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-01-10 00:07:58 -08:00
parent 12f1ba1d77
commit 10b0a553b4

View file

@ -189,10 +189,14 @@ class ArcanistPhutilModuleLinter extends ArcanistLinter {
'module' => $module_name, 'module' => $module_name,
)); ));
$disk_path = $this->getModulePathOnDisk($req_module); $disk_path = $this->getModulePathOnDisk($req_module);
if (Filesystem::pathExists($disk_path)) {
$futures[$req_module] = new ExecFuture( $futures[$req_module] = new ExecFuture(
'%s %s', '%s %s',
$bin, $bin,
$disk_path); $disk_path);
} else {
$dependencies[$req_module] = array();
}
} }
} }
} }
@ -241,7 +245,12 @@ class ArcanistPhutilModuleLinter extends ArcanistLinter {
$library = null, $library = null,
$name); $name);
if ($class_spec) { if ($class_spec) {
if (phutil_autoload_class($name)) { try {
$loaded = phutil_autoload_class($name);
} catch (PhutilLibraryLoadException $ex) {
$loaded = false;
}
if ($loaded) {
$resolvable[] = $message; $resolvable[] = $message;
$need_classes[$name] = $class_spec; $need_classes[$name] = $class_spec;
} else { } else {
@ -274,7 +283,12 @@ class ArcanistPhutilModuleLinter extends ArcanistLinter {
$library = null, $library = null,
$name); $name);
if ($func_spec) { if ($func_spec) {
if (phutil_autoload_function($name)) { try {
$loaded = phutil_autoload_function($name);
} catch (PhutilLibraryLoadException $ex) {
$loaded = false;
}
if ($loaded) {
$resolvable[] = $message; $resolvable[] = $message;
$need_functions[$name] = $func_spec; $need_functions[$name] = $func_spec;
} else { } else {