Changeset View
Changeset View
Standalone View
Standalone View
support/ArcanistRuntime.php
| Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | private function executeCore(array $argv) { | ||||
| $is_trace = $args->getArg('trace'); | $is_trace = $args->getArg('trace'); | ||||
| if ($is_trace) { | if ($is_trace) { | ||||
| $this->logTrace(pht('ARGV'), csprintf('%Ls', $argv)); | $this->logTrace(pht('ARGV'), csprintf('%Ls', $argv)); | ||||
| } | } | ||||
| $args->parsePartial($config_args, true); | $args->parsePartial($config_args, true); | ||||
| $config = $this->loadConfiguration($args); | $config_engine = $this->loadConfiguration($args); | ||||
| $config = $config_engine->newConfigurationSourceList(); | |||||
| $this->loadLibraries($args, $config); | $this->loadLibraries($args, $config); | ||||
| // Now that we've loaded libraries, we can validate configuration. | |||||
| // Do this before continuing since configuration can impact other | |||||
| // behaviors immediately and we want to catch any issues right away. | |||||
| $config->setConfigOptions($config_engine->newConfigOptionsMap()); | |||||
| $config->validateConfiguration(); | |||||
| $toolset = $this->newToolset($argv); | $toolset = $this->newToolset($argv); | ||||
| $args->parsePartial($toolset->getToolsetArguments()); | $args->parsePartial($toolset->getToolsetArguments()); | ||||
| $workflows = $this->newWorkflows($toolset); | $workflows = $this->newWorkflows($toolset); | ||||
| $phutil_workflows = array(); | $phutil_workflows = array(); | ||||
| foreach ($workflows as $key => $workflow) { | foreach ($workflows as $key => $workflow) { | ||||
| $phutil_workflows[$key] = $workflow->newPhutilWorkflow(); | $phutil_workflows[$key] = $workflow->newPhutilWorkflow(); | ||||
| $workflow | |||||
| ->setConfigurationEngine($config_engine) | |||||
| ->setConfigurationSourceList($config); | |||||
| } | } | ||||
| $unconsumed_argv = $args->getUnconsumedArgumentVector(); | $unconsumed_argv = $args->getUnconsumedArgumentVector(); | ||||
| if (!$unconsumed_argv) { | if (!$unconsumed_argv) { | ||||
| // TOOLSETS: This means the user just ran "arc" or some other top-level | // TOOLSETS: This means the user just ran "arc" or some other top-level | ||||
| // toolset without any workflow argument. We should give them a summary | // toolset without any workflow argument. We should give them a summary | ||||
| // of the toolset, a list of workflows, and a pointer to "arc help" for | // of the toolset, a list of workflows, and a pointer to "arc help" for | ||||
| ▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | private function loadConfiguration(PhutilArgumentParser $args) { | ||||
| $engine = id(new ArcanistConfigurationEngine()) | $engine = id(new ArcanistConfigurationEngine()) | ||||
| ->setArguments($args); | ->setArguments($args); | ||||
| $working_copy = ArcanistWorkingCopy::newFromWorkingDirectory(getcwd()); | $working_copy = ArcanistWorkingCopy::newFromWorkingDirectory(getcwd()); | ||||
| if ($working_copy) { | if ($working_copy) { | ||||
| $engine->setWorkingCopy($working_copy); | $engine->setWorkingCopy($working_copy); | ||||
| } | } | ||||
| return $engine->newConfigurationSourceList(); | return $engine; | ||||
| } | } | ||||
| private function loadLibraries( | private function loadLibraries( | ||||
| PhutilArgumentParser $args, | PhutilArgumentParser $args, | ||||
| ArcanistConfigurationSourceList $config) { | ArcanistConfigurationSourceList $config) { | ||||
| // TOOLSETS: Make this work again -- or replace it entirely with package | // TOOLSETS: Make this work again -- or replace it entirely with package | ||||
| // management? | // management? | ||||
| ▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | private function newWorkflows(ArcanistToolset $toolset) { | ||||
| return $map; | return $map; | ||||
| } | } | ||||
| private function resolveAliases( | private function resolveAliases( | ||||
| array $workflows, | array $workflows, | ||||
| array $argv, | array $argv, | ||||
| ArcanistConfigurationSourceList $config) { | ArcanistConfigurationSourceList $config) { | ||||
| return $argv; | |||||
| $command = head($argv); | $command = head($argv); | ||||
| // If this is a match for a recognized workflow, just return the arguments | // If this is a match for a recognized workflow, just return the arguments | ||||
| // unmodified. You aren't allowed to alias over real workflows. | // unmodified. You aren't allowed to alias over real workflows. | ||||
| if (isset($workflows[$command])) { | if (isset($workflows[$command])) { | ||||
| return $argv; | return $argv; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines | |||||