From e5992a44fb517237f1c164e038d1aa61ee1c2a43 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 6 Jul 2012 10:05:55 -0700 Subject: [PATCH] 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 --- scripts/arcanist.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/arcanist.php b/scripts/arcanist.php index dfc9e01d..8784b903 100755 --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -78,6 +78,7 @@ try { } $global_config = ArcanistBaseWorkflow::readGlobalArcConfig(); + $system_config = ArcanistBaseWorkflow::readSystemArcConfig(); $working_copy = ArcanistWorkingCopyIdentity::newFromPath($working_directory); // Load additional libraries, which can provide new classes like configuration @@ -97,6 +98,16 @@ try { $working_copy, $config_trace_mode); } 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 // need to fail softly if these break because errors would prevent the user // from running "arc set-config" to correct them. @@ -435,6 +446,14 @@ function arcanist_load_libraries( 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) { // Try to resolve the library location. We look in several places, in