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

Support "load" key in arc system configuration

Summary: I think @nh needs this at some point?

Test Plan: Added bogus and valid "load" to system config, got warning and load respectively.

Reviewers: nh, dschleimer, btrahan

Reviewed By: dschleimer

CC: aran

Differential Revision: https://secure.phabricator.com/D2931
This commit is contained in:
epriestley 2012-07-06 10:05:55 -07:00
parent 61da381c30
commit e5992a44fb

View file

@ -78,6 +78,7 @@ try {
} }
$global_config = ArcanistBaseWorkflow::readGlobalArcConfig(); $global_config = ArcanistBaseWorkflow::readGlobalArcConfig();
$system_config = ArcanistBaseWorkflow::readSystemArcConfig();
$working_copy = ArcanistWorkingCopyIdentity::newFromPath($working_directory); $working_copy = ArcanistWorkingCopyIdentity::newFromPath($working_directory);
// Load additional libraries, which can provide new classes like configuration // Load additional libraries, which can provide new classes like configuration
@ -97,6 +98,16 @@ try {
$working_copy, $working_copy,
$config_trace_mode); $config_trace_mode);
} else { } else {
// Load libraries in system 'load' config. In contrast to global config, we
// fail hard here because this file is edited manually, so if 'arc' breaks
// that doesn't make it any more difficult to correct.
arcanist_load_libraries(
idx($system_config, 'load', array()),
$must_load = true,
$lib_source = 'the "load" setting in system config',
$working_copy,
$config_trace_mode);
// Load libraries in global 'load' config, as per "arc set-config load". We // Load libraries in global 'load' config, as per "arc set-config load". We
// need to fail softly if these break because errors would prevent the user // need to fail softly if these break because errors would prevent the user
// from running "arc set-config" to correct them. // from running "arc set-config" to correct them.
@ -435,6 +446,14 @@ function arcanist_load_libraries(
return; return;
} }
if (!is_array($load)) {
$error = "Libraries specified by {$lib_source} are invalid; expected ".
"a list. Check your configuration.";
$console = PhutilConsole::getConsole();
$console->writeErr("WARNING: %s\n", $error);
return;
}
foreach ($load as $location) { foreach ($load as $location) {
// Try to resolve the library location. We look in several places, in // Try to resolve the library location. We look in several places, in