1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-14 10:52:40 +01:00
phorge-arcanist/scripts/arcanist.php

300 lines
9 KiB
PHP
Raw Normal View History

2011-01-10 00:22:25 +01:00
#!/usr/bin/env php
<?php
if (function_exists('pcntl_async_signals')) {
pcntl_async_signals(true);
} else {
declare(ticks = 1);
}
require_once dirname(dirname(__FILE__)).'/scripts/init/init-arcanist.php';
$runtime = new ArcanistRuntime();
return $runtime->execute($argv);
$config_trace_mode = $base_args->getArg('trace');
$force_conduit = $base_args->getArg('conduit-uri');
$force_token = $base_args->getArg('conduit-token');
Begin modernizing the Arcanist interaction with Conduit Summary: Ref T10895. NOTE: I'm going to land this and other changes to a new `experimental` branch until `arc` is more substantially rebuilt, since everything I touch feels like it requires me to rebuild 30 other things first. Currently, many `arc` workflows are unnecessarily slow because they call `conduit.connect` on startup. There's no need to do this with the modern way the API works, and we've generally moved away from explicit version testing to more granular capability testing on specific workflows. Additionally, some workflows like `arc patch` are huge messes (see T11434) because they're trying to run in anonymous mode but it doesn't really work with all the upfront stuff Conduit does now. It's not possible, in the general case, for a workflow to know upfront if it needs Conduit or not. And: - `ArcanistWorkflow` has piles of Conduit logic, but should not. - Pooling Conduit requests isn't very easy. - There's a lot of general cruft around the workflow. - We should drop certificate support. This pulls out Conduit into a separate on-demand class with modern support, future pooling, less cruft, inline handling of login issues, and generally less garbage. Also adds an `--anonymous` flag, mostly to make testing easier. Test Plan: Ran `arc browse`, used `--anonymous` and `--trace`, fiddled with credentials, got approximatley the same behavior that mainline `arc` has. Reviewers: chad, avivey Reviewed By: avivey Subscribers: avivey Maniphest Tasks: T10895 Differential Revision: https://secure.phabricator.com/D16921
2016-11-23 00:55:18 +01:00
$is_anonymous = $base_args->getArg('anonymous');
$load = $base_args->getArg('load-phutil-library');
$help = $base_args->getArg('help');
$args = array_values($base_args->getUnconsumedArgumentVector());
2011-01-10 00:22:25 +01:00
$console = PhutilConsole::getConsole();
$config = null;
$workflow = null;
2011-01-10 00:22:25 +01:00
try {
$command = strtolower($args[0]);
$args = array_slice($args, 1);
$workflow = $config->selectWorkflow(
$command,
$args,
$configuration_manager,
$console);
$workflow->setConfigurationManager($configuration_manager);
2011-01-10 00:22:25 +01:00
$workflow->setArcanistConfiguration($config);
$workflow->setCommand($command);
$workflow->setWorkingDirectory($working_directory);
$workflow->parseArguments($args);
2011-01-10 00:22:25 +01:00
// Write the command into the environment so that scripts (for example, local
// Git commit hooks) can detect that they're being run via `arc` and change
// their behaviors.
putenv('ARCANIST='.$command);
$need_working_copy = $workflow->requiresWorkingCopy();
$supported_vcs_types = $workflow->getSupportedRevisionControlSystems();
$vcs_type = $working_copy->getVCSType();
if ($vcs_type || $need_working_copy) {
if (!in_array($vcs_type, $supported_vcs_types)) {
throw new ArcanistUsageException(
pht(
'`%s %s` is only supported under %s.',
'arc',
$workflow->getWorkflowName(),
implode(', ', $supported_vcs_types)));
}
}
2011-01-10 00:22:25 +01:00
$need_conduit = $workflow->requiresConduit();
$need_auth = $workflow->requiresAuthentication();
$need_repository_api = $workflow->requiresRepositoryAPI();
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
$want_repository_api = $workflow->desiresRepositoryAPI();
$want_working_copy = $workflow->desiresWorkingCopy() ||
$want_repository_api;
2011-01-10 00:22:25 +01:00
$need_conduit = $need_conduit ||
$need_auth;
$need_working_copy = $need_working_copy ||
$need_repository_api;
[Arcanist] add a local (per working copy) config file Summary: This adds the concept of a local (i.e. working copy local) config file to arc. This config file has the highest precedence for config settings that may come from any config file. The config is stored in .(git|hg|sv)/arc/config, and is read ahead of the project config by getConfigFromAnySource(). Test Plan: #Testing arc set-config and arc get-config [16:57:04 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit [16:57:12 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19410 $ ./bin/arc set-config foo bar Set key 'foo' = 'bar' in global config. [16:57:23 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar [16:57:26 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19411 $ ./bin/arc set-config --local foo baz Set key 'foo' = 'baz' in local config. [16:57:35 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = bar (local) foo = baz [16:57:39 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19412 $ ./bin/arc set-config foo '' Deleted key 'foo' from global config (was 'bar'). [16:57:49 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit (global) foo = (local) foo = baz [16:57:51 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19413 $ ./bin/arc set-config --local foo '' Deleted key 'foo' from local config (was 'baz'). [16:58:05 Tue Jun 12 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19414 $ ./bin/arc get-config (global) default = https://phabricator.fb.com/conduit #testing getConfigFromAnySource by means of lint [11:26:57 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19612 $ ./bin/arc set-config lint.engine BogusLintEngine Set key 'lint.engine' = 'BogusLintEngine' in global config. [11:30:04 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19613 $ ./bin/arc set-config --local lint.engine DummyLintEngine Set key 'lint.engine' = 'DummyLintEngine' in local config. [11:30:19 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint Exception Failed to load symbol 'DummyLintEngine'. If this symbol was recently added or moved, your library map may be out of date. You can rebuild the map by running 'arc liberate'. For more information, see: http://www.phabricator.com/docs/phabricator/article/libphutil_Libraries_User_Guide.html (Run with --trace for a full exception trace.) [11:30:25 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19586 $ ./bin/arc set-config --local lint.engine '' Deleted key 'lint.engine' from local config (was 'DummyLintEngine'). [11:30:34 Wed Jun 13 2012] dschleimer@dev4022.snc6 ~/devtools/arcanist arcanist local_config 19587 $ ./bin/arc lint OKAY No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1233 Differential Revision: https://secure.phabricator.com/D2739
2012-06-14 01:02:29 +02:00
if ($need_working_copy || $want_working_copy) {
if ($need_working_copy && !$working_copy->getVCSType()) {
throw new ArcanistUsageException(
pht(
'This command must be run in a Git, Mercurial or Subversion '.
'working copy.'));
}
$configuration_manager->setWorkingCopyIdentity($working_copy);
2011-01-10 00:22:25 +01:00
}
if ($force_conduit) {
$conduit_uri = $force_conduit;
} else {
$conduit_uri = $configuration_manager->getConfigFromAnySource(
Allow `arc` to identify repositories without "project_id" Summary: Ref T4343. Continues the process of reducing the prominence of Arcanist Projects. Primarily: - Query Phabricator to identify the working copy based on explicit configuration, or guess based on heuristics. - Enhance `arc which` to explain the process to the user. - The `project_id` key is no longer required in `.arcconfig`. Minor/cleanup changes: - Rename `project_id` to `project.name` (consistency, clarity). - Rename `conduit_uri` to `phabricator.uri` (consistency, clairty). - These both need documentation updates. - Add `repository.callsign` to explicitly bind to a repository. - Updated `.arcconfig` for the new values. - Fix a unit test which broke a while ago when we fixed a rare definition of "unstaged". - Make `getRepositoryUUID()` generic so we can get rid of one `instanceof`. Test Plan: - Ran `arc which`. - Ran `arc diff`. - This doesn't really change anything, so the only real risk is version compatibility breaks. This //does// introduce such a break, but the window is very narrow: if you upgrade `arc` after this commit, and try to diff against a Phabricator which was updated after yesterday (D8068) but before D8072 lands, the lookup will work so we'll add `repositoryPHID` to the `differential.creatediff` call, but it won't exist in Phabricator yet. This window is so narrow that I'm not going to try to fix it, as I'd guess there is a significant chance that no users will be affected. I don't see a clever way to fix it that doesn't involve a lot of work, either. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4343 Differential Revision: https://secure.phabricator.com/D8073
2014-01-27 00:31:30 +01:00
'phabricator.uri');
if ($conduit_uri === null) {
$conduit_uri = $configuration_manager->getConfigFromAnySource('default');
}
}
if ($conduit_uri) {
// Set the URI path to '/api/'. TODO: Originally, I contemplated letting
// you deploy Phabricator somewhere other than the domain root, but ended
// up never pursuing that. We should get rid of all "/api/" silliness
// in things users are expected to configure. This is already happening
// to some degree, e.g. "arc install-certificate" does it for you.
$conduit_uri = new PhutilURI($conduit_uri);
$conduit_uri->setPath('/api/');
$conduit_uri = (string)$conduit_uri;
}
$workflow->setConduitURI($conduit_uri);
// Apply global CA bundle from configs.
$ca_bundle = $configuration_manager->getConfigFromAnySource('https.cabundle');
if ($ca_bundle) {
$ca_bundle = Filesystem::resolvePath(
$ca_bundle, $working_copy->getProjectRoot());
HTTPSFuture::setGlobalCABundleFromPath($ca_bundle);
}
$blind_key = 'https.blindly-trust-domains';
$blind_trust = $configuration_manager->getConfigFromAnySource($blind_key);
if ($blind_trust) {
$trust_extension = PhutilHTTPEngineExtension::requireExtension(
ArcanistBlindlyTrustHTTPEngineExtension::EXTENSIONKEY);
$trust_extension->setDomains($blind_trust);
}
if ($need_conduit) {
2011-01-10 00:22:25 +01:00
if (!$conduit_uri) {
$message = phutil_console_format(
"%s\n\n - %s\n - %s\n - %s\n",
pht(
'This command requires arc to connect to a Phabricator install, '.
'but no Phabricator installation is configured. To configure a '.
'Phabricator URI:'),
pht(
'set a default location with `%s`; or',
'arc set-config default <uri>'),
pht(
'specify `%s` explicitly; or',
'--conduit-uri=uri'),
pht(
"run `%s` in a working copy with an '%s'.",
'arc',
'.arcconfig'));
$message = phutil_console_wrap($message);
throw new ArcanistUsageException($message);
2011-01-10 00:22:25 +01:00
}
$workflow->establishConduit();
}
$hosts_config = idx($user_config, 'hosts', array());
$host_config = idx($hosts_config, $conduit_uri, array());
$user_name = idx($host_config, 'user');
$certificate = idx($host_config, 'cert');
$conduit_token = idx($host_config, 'token');
if ($force_token) {
$conduit_token = $force_token;
}
2011-01-10 00:22:25 +01:00
Begin modernizing the Arcanist interaction with Conduit Summary: Ref T10895. NOTE: I'm going to land this and other changes to a new `experimental` branch until `arc` is more substantially rebuilt, since everything I touch feels like it requires me to rebuild 30 other things first. Currently, many `arc` workflows are unnecessarily slow because they call `conduit.connect` on startup. There's no need to do this with the modern way the API works, and we've generally moved away from explicit version testing to more granular capability testing on specific workflows. Additionally, some workflows like `arc patch` are huge messes (see T11434) because they're trying to run in anonymous mode but it doesn't really work with all the upfront stuff Conduit does now. It's not possible, in the general case, for a workflow to know upfront if it needs Conduit or not. And: - `ArcanistWorkflow` has piles of Conduit logic, but should not. - Pooling Conduit requests isn't very easy. - There's a lot of general cruft around the workflow. - We should drop certificate support. This pulls out Conduit into a separate on-demand class with modern support, future pooling, less cruft, inline handling of login issues, and generally less garbage. Also adds an `--anonymous` flag, mostly to make testing easier. Test Plan: Ran `arc browse`, used `--anonymous` and `--trace`, fiddled with credentials, got approximatley the same behavior that mainline `arc` has. Reviewers: chad, avivey Reviewed By: avivey Subscribers: avivey Maniphest Tasks: T10895 Differential Revision: https://secure.phabricator.com/D16921
2016-11-23 00:55:18 +01:00
if ($is_anonymous) {
$conduit_token = null;
}
$description = implode(' ', $original_argv);
$credentials = array(
'user' => $user_name,
'certificate' => $certificate,
'description' => $description,
'token' => $conduit_token,
);
$workflow->setConduitCredentials($credentials);
Begin modernizing the Arcanist interaction with Conduit Summary: Ref T10895. NOTE: I'm going to land this and other changes to a new `experimental` branch until `arc` is more substantially rebuilt, since everything I touch feels like it requires me to rebuild 30 other things first. Currently, many `arc` workflows are unnecessarily slow because they call `conduit.connect` on startup. There's no need to do this with the modern way the API works, and we've generally moved away from explicit version testing to more granular capability testing on specific workflows. Additionally, some workflows like `arc patch` are huge messes (see T11434) because they're trying to run in anonymous mode but it doesn't really work with all the upfront stuff Conduit does now. It's not possible, in the general case, for a workflow to know upfront if it needs Conduit or not. And: - `ArcanistWorkflow` has piles of Conduit logic, but should not. - Pooling Conduit requests isn't very easy. - There's a lot of general cruft around the workflow. - We should drop certificate support. This pulls out Conduit into a separate on-demand class with modern support, future pooling, less cruft, inline handling of login issues, and generally less garbage. Also adds an `--anonymous` flag, mostly to make testing easier. Test Plan: Ran `arc browse`, used `--anonymous` and `--trace`, fiddled with credentials, got approximatley the same behavior that mainline `arc` has. Reviewers: chad, avivey Reviewed By: avivey Subscribers: avivey Maniphest Tasks: T10895 Differential Revision: https://secure.phabricator.com/D16921
2016-11-23 00:55:18 +01:00
$basic_user = $configuration_manager->getConfigFromAnySource(
'http.basicauth.user');
$basic_pass = $configuration_manager->getConfigFromAnySource(
'http.basicauth.pass');
$engine = id(new ArcanistConduitEngine())
->setConduitURI($conduit_uri)
->setConduitToken($conduit_token)
->setBasicAuthUser($basic_user)
->setBasicAuthPass($basic_pass);
$workflow->setConduitEngine($engine);
if ($need_auth) {
if ((!$user_name || !$certificate) && (!$conduit_token)) {
$arc = 'arc';
if ($force_conduit) {
$arc .= csprintf(' --conduit-uri=%s', $conduit_uri);
}
$conduit_domain = id(new PhutilURI($conduit_uri))->getDomain();
throw new ArcanistUsageException(
phutil_console_format(
"%s\n\n%s\n\n%s **%s:**\n\n $ **{$arc} install-certificate**\n",
pht('YOU NEED TO AUTHENTICATE TO CONTINUE'),
pht(
'You are trying to connect to a server (%s) that you '.
'do not have any credentials stored for.',
$conduit_domain),
pht('To retrieve and store credentials for this server,'),
pht('run this command')));
}
$workflow->authenticateConduit();
2011-01-10 00:22:25 +01:00
}
if ($need_repository_api ||
($want_repository_api && $working_copy->getVCSType())) {
$repository_api = ArcanistRepositoryAPI::newAPIFromConfigurationManager(
$configuration_manager);
2011-01-10 00:22:25 +01:00
$workflow->setRepositoryAPI($repository_api);
}
$listeners = $configuration_manager->getConfigFromAnySource(
'events.listeners');
if ($listeners) {
foreach ($listeners as $listener) {
$console->writeLog(
"%s\n",
pht("Registering event listener '%s'.", $listener));
try {
id(new $listener())->register();
} catch (PhutilMissingSymbolException $ex) {
// Continue anyway, since you may otherwise be unable to run commands
2012-10-16 19:01:35 +02:00
// like `arc set-config events.listeners` in order to repair the damage
// you've caused. We're writing out the entire exception here because
// it might not have been triggered by the listener itself (for example,
// the listener might use a bad class in its register() method).
$console->writeErr(
"%s\n",
pht(
"ERROR: Failed to load event listener '%s': %s",
$listener,
$ex->getMessage()));
}
}
}
2011-01-10 00:22:25 +01:00
$config->willRunWorkflow($command, $workflow);
$workflow->willRunWorkflow();
try {
$err = $workflow->run();
$config->didRunWorkflow($command, $workflow, $err);
} catch (Exception $e) {
$workflow->finalize();
throw $e;
}
$workflow->finalize();
exit((int)$err);
2011-01-10 00:22:25 +01:00
} catch (ArcanistNoEffectException $ex) {
echo $ex->getMessage()."\n";
} catch (Exception $ex) {
$is_usage = ($ex instanceof ArcanistUsageException);
if ($is_usage) {
fwrite(STDERR, phutil_console_format(
"**%s** %s\n",
pht('Usage Exception:'),
Begin modernizing the Arcanist interaction with Conduit Summary: Ref T10895. NOTE: I'm going to land this and other changes to a new `experimental` branch until `arc` is more substantially rebuilt, since everything I touch feels like it requires me to rebuild 30 other things first. Currently, many `arc` workflows are unnecessarily slow because they call `conduit.connect` on startup. There's no need to do this with the modern way the API works, and we've generally moved away from explicit version testing to more granular capability testing on specific workflows. Additionally, some workflows like `arc patch` are huge messes (see T11434) because they're trying to run in anonymous mode but it doesn't really work with all the upfront stuff Conduit does now. It's not possible, in the general case, for a workflow to know upfront if it needs Conduit or not. And: - `ArcanistWorkflow` has piles of Conduit logic, but should not. - Pooling Conduit requests isn't very easy. - There's a lot of general cruft around the workflow. - We should drop certificate support. This pulls out Conduit into a separate on-demand class with modern support, future pooling, less cruft, inline handling of login issues, and generally less garbage. Also adds an `--anonymous` flag, mostly to make testing easier. Test Plan: Ran `arc browse`, used `--anonymous` and `--trace`, fiddled with credentials, got approximatley the same behavior that mainline `arc` has. Reviewers: chad, avivey Reviewed By: avivey Subscribers: avivey Maniphest Tasks: T10895 Differential Revision: https://secure.phabricator.com/D16921
2016-11-23 00:55:18 +01:00
rtrim($ex->getMessage())));
2011-01-10 00:22:25 +01:00
}
if ($config) {
$config->didAbortWorkflow($command, $workflow, $ex);
}
2011-01-10 00:22:25 +01:00
if ($config_trace_mode) {
fwrite(STDERR, "\n");
2011-01-10 00:22:25 +01:00
throw $ex;
}
if (!$is_usage) {
fwrite(STDERR, phutil_console_format(
"<bg:red>** %s **</bg>\n", pht('Exception')));
while ($ex) {
fwrite(STDERR, $ex->getMessage()."\n");
if ($ex instanceof PhutilProxyException) {
$ex = $ex->getPreviousException();
} else {
$ex = null;
}
}
fwrite(STDERR, phutil_console_format(
"(%s)\n",
pht('Run with `%s` for a full exception trace.', '--trace')));
}
2011-01-10 00:22:25 +01:00
exit(1);
}
Allow global config to load libraries and set test engines Summary: Khan Academy is looking into lint configuration, but doesn't use ".arcconfig" because they have a large number of repositories. Making configuration more flexible generally gives us more options for onboarding installs. - Currently, only project config (".arcconfig") can load libraries. Allow user config ("~/.arcrc") to load libraries as well. - Currently, only project config can set lint/unit engines. Allow user config to set default lint/unit engines. - Add some type checking to "arc set-config". - Add "arc set-config --show". Test Plan: - **load** - Ran `arc set-config load xxx`, got error about format. - Ran `arc set-config load ["apple"]`, got warning on running 'arc' commands (no such library) but was able to run 'arc set-config' again to clear it. - Ran `arc set-config load ["/path/to/a/lib/src/"]`, worked. - Ran `arc list --trace`, verified my library loaded in addition to `.arcconfig` libraries. - Ran `arc list --load-phutil-library=xxx --trace`, verified only that library loaded. - Ran `arc list --trace --load-phutil-library=apple --trace`, got hard error about bad library. - Set `.arcconfig` to point at a bad library, verified hard error. - **lint.engine** / **unit.engine** - Removed lint engine from `.arcconfig`, ran "arc lint", got a run with specified engine. - Removed unit engine from `.arcconfig`, ran "arc unit", got a run with specified engine. - **--show** - Ran `arc set-config --show`. - **misc** - Ran `arc get-config`. Reviewers: csilvers, btrahan, vrana Reviewed By: csilvers CC: aran Differential Revision: https://secure.phabricator.com/D2618
2012-05-31 20:41:39 +02:00