Provide a plugin hook for when build steps finish

Fixes #318.
This commit is contained in:
Eelco Dolstra
2016-05-27 14:32:48 +02:00
parent f70946efca
commit a55942603a
7 changed files with 105 additions and 79 deletions

View File

@ -16,7 +16,6 @@ use File::Path;
use File::Temp;
use File::Spec;
use File::Slurp;
use Hydra::Helper::PluginHooks;
use Hydra::Helper::CatalystUtils;
our @ISA = qw(Exporter);

View File

@ -1,35 +0,0 @@
package Hydra::Helper::PluginHooks;
use strict;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(
notifyBuildStarted
notifyBuildFinished);
sub notifyBuildStarted {
my ($plugins, $build) = @_;
foreach my $plugin (@{$plugins}) {
eval {
$plugin->buildStarted($build);
};
if ($@) {
print STDERR "$plugin->buildStarted: $@\n";
}
}
}
sub notifyBuildFinished {
my ($plugins, $build, $dependents) = @_;
foreach my $plugin (@{$plugins}) {
eval {
$plugin->buildFinished($build, $dependents);
};
if ($@) {
print STDERR "$plugin->buildFinished: $@\n";
}
}
}
1;

View File

@ -33,6 +33,12 @@ sub buildFinished {
my ($self, $build, $dependents) = @_;
}
# Called when step $step has finished. The build log is stored in the
# file $logPath (bzip2-compressed).
sub stepFinished {
my ($self, $step, $logPath) = @_;
}
# Called to determine the set of supported input types. The plugin
# should add these to the $inputTypes hashref, e.g. $inputTypes{'svn'}
# = 'Subversion checkout'.