From 61e059984a15b50a1f4276bf070922dc2ed49328 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 12 Feb 2020 15:43:12 -0800 Subject: [PATCH] Merge "phage" from "experimental" Summary: Ref T13395. Currently, "phage" is required for various cluster operations. Bring the working code out of "experimental". This isn't the final form; "wilds" has a fancier version. Test Plan: Ran phage workflows against the cluster. Maniphest Tasks: T13395 Differential Revision: https://secure.phabricator.com/D20982 --- bin/phage | 1 + scripts/phage.php | 29 ++++++++++++++++++++++++++++ src/__phutil_library_map__.php | 2 ++ src/phage/workflow/PhageWorkflow.php | 10 ++++++++++ 4 files changed, 42 insertions(+) create mode 120000 bin/phage create mode 100755 scripts/phage.php create mode 100644 src/phage/workflow/PhageWorkflow.php diff --git a/bin/phage b/bin/phage new file mode 120000 index 00000000..0817a287 --- /dev/null +++ b/bin/phage @@ -0,0 +1 @@ +../scripts/phage.php \ No newline at end of file diff --git a/scripts/phage.php b/scripts/phage.php new file mode 100755 index 00000000..1aa5c8f7 --- /dev/null +++ b/scripts/phage.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +parseStandardArguments(); + +$args->parsePartial(array()); + + +// TODO: This is pretty minimal and should be shared with "arc". +$working_directory = getcwd(); +$working_copy = ArcanistWorkingCopyIdentity::newFromPath($working_directory); +$config = id(new ArcanistConfigurationManager()) + ->setWorkingCopyIdentity($working_copy); + +foreach ($config->getProjectConfig('load') as $load) { + $load = Filesystem::resolvePath($working_copy->getProjectRoot().'/'.$load); + phutil_load_library($load); +} + + +$workflows = id(new PhutilClassMapQuery()) + ->setAncestorClass('PhageWorkflow') + ->execute(); +$workflows[] = new PhutilHelpArgumentWorkflow(); +$args->parseWorkflows($workflows); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 793d028e..ce7297af 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -473,6 +473,7 @@ phutil_register_library_map(array( 'PhagePHPAgent' => 'phage/agent/PhagePHPAgent.php', 'PhagePHPAgentBootloader' => 'phage/bootloader/PhagePHPAgentBootloader.php', 'PhagePlanAction' => 'phage/action/PhagePlanAction.php', + 'PhageWorkflow' => 'phage/workflow/PhageWorkflow.php', 'Phobject' => 'object/Phobject.php', 'PhobjectTestCase' => 'object/__tests__/PhobjectTestCase.php', 'PhpunitTestEngine' => 'unit/engine/PhpunitTestEngine.php', @@ -1348,6 +1349,7 @@ phutil_register_library_map(array( 'PhagePHPAgent' => 'Phobject', 'PhagePHPAgentBootloader' => 'PhageAgentBootloader', 'PhagePlanAction' => 'PhageAction', + 'PhageWorkflow' => 'PhutilArgumentWorkflow', 'Phobject' => 'Iterator', 'PhobjectTestCase' => 'PhutilTestCase', 'PhpunitTestEngine' => 'ArcanistUnitTestEngine', diff --git a/src/phage/workflow/PhageWorkflow.php b/src/phage/workflow/PhageWorkflow.php new file mode 100644 index 00000000..2506f79a --- /dev/null +++ b/src/phage/workflow/PhageWorkflow.php @@ -0,0 +1,10 @@ +