From: Marek Sapota Date: Thu, 10 Nov 2011 21:47:45 +0000 (-0800) Subject: Add events framework to Arcanist X-Git-Tag: conduit-4~235 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=53c64f64b0169a7d9076f265b8c0a4953a1b9d0b;p=arcanist.git Add events framework to Arcanist Test Plan: Added a test event listener, added an event dispatch in diff workflow, run the workflow, the listener was called. Reviewers: epriestley Reviewed By: epriestley CC: aran, jungejason, epriestley Differential Revision: 1102 --- diff --git a/scripts/arcanist.php b/scripts/arcanist.php index f4ecf925..f900ce50 100755 --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -252,6 +252,13 @@ try { $workflow->setRepositoryAPI($repository_api); } + $listeners = $working_copy->getConfig('events.listeners'); + if ($listeners) { + foreach ($listeners as $listener) { + id(new $listener())->register(); + } + } + $config->willRunWorkflow($command, $workflow); $workflow->willRunWorkflow(); $err = $workflow->run(); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index d4ef91b7..bf97f652 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -35,6 +35,7 @@ phutil_register_library_map(array( 'ArcanistDifferentialCommitMessageParserException' => 'differential/commitmessage', 'ArcanistDifferentialRevisionRef' => 'differential/revision', 'ArcanistDownloadWorkflow' => 'workflow/download', + 'ArcanistEventType' => 'events/constant/type', 'ArcanistExportWorkflow' => 'workflow/export', 'ArcanistFilenameLinter' => 'lint/linter/filename', 'ArcanistGeneratedLinter' => 'lint/linter/generated', @@ -114,6 +115,7 @@ phutil_register_library_map(array( 'ArcanistDiffUtilsTestCase' => 'ArcanistPhutilTestCase', 'ArcanistDiffWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistDownloadWorkflow' => 'ArcanistBaseWorkflow', + 'ArcanistEventType' => 'PhutilEventType', 'ArcanistExportWorkflow' => 'ArcanistBaseWorkflow', 'ArcanistFilenameLinter' => 'ArcanistLinter', 'ArcanistGeneratedLinter' => 'ArcanistLinter', diff --git a/src/events/constant/type/ArcanistEventType.php b/src/events/constant/type/ArcanistEventType.php new file mode 100644 index 00000000..ea8abb5c --- /dev/null +++ b/src/events/constant/type/ArcanistEventType.php @@ -0,0 +1,20 @@ +