1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
package Perl::Critic::Module::Build::Standard;
use 5.010001;
use strict;
use warnings;
our $VERSION = '1.126';
use Carp;
use English qw< $OS_ERROR -no_match_vars >;
use parent 'Module::Build';
sub ACTION_authortest {
my ($self) = @_;
$self->authortest_dependencies();
$self->depends_on('test');
return;
}
sub ACTION_authortestcover {
my ($self) = @_;
$self->authortest_dependencies();
$self->depends_on('testcover');
return;
}
sub ACTION_distdir {
my ($self, @arguments) = @_;
$self->depends_on('authortest');
return $self->SUPER::ACTION_distdir(@arguments);
}
sub ACTION_manifest {
my ($self, @arguments) = @_;
# Make sure we get rid of files that no longer exist.
if (-e 'MANIFEST') {
unlink 'MANIFEST' or die "Can't unlink MANIFEST: $OS_ERROR";
}
return $self->SUPER::ACTION_manifest(@arguments);
}
sub tap_harness_args {
my ($self) = @_;
return $self->_tap_harness_args() if $ENV{RUNNING_UNDER_TEAMCITY};
return;
}
sub _tap_harness_args {
return {formatter_class => 'TAP::Formatter::TeamCity', merge => 1};
}
sub authortest_dependencies {
my ($self) = @_;
$self->depends_on('build');
$self->depends_on('manifest');
$self->depends_on('distmeta');
$self->test_files( qw< t xt > );
$self->recursive_test_files(1);
return;
}
1;
__END__
#-----------------------------------------------------------------------------
=pod
=for stopwords
=head1 NAME
Perl::Critic::Module::Build::Standard - Customization of L<Module::Build> for L<Perl::Critic> distributions.
=head1 DESCRIPTION
This is a custom subclass of L<Module::Build> that enhances existing
functionality and adds more for the benefit of installing and
developing L<Perl::Critic>. The following actions have been added
or redefined:
=head1 ACTIONS
=over
=item authortest
Runs the regular tests plus the author tests (those in F<xt>).
It used to be the case that author tests were run if an environment
variable was set or if a F<.svn> directory existed. What ended up
happening was that people that had that environment variable set for
other purposes or who had done a checkout of the code repository would
run those tests, which would fail, and we'd get bug reports for
something not expected to run elsewhere. Now, you've got to
explicitly ask for the author tests to be run.
=item authortestcover
As C<authortest> is to the standard C<test> action, C<authortestcover>
is to the standard C<testcover> action.
=item distdir
In addition to the standard action, this adds a dependency upon the
C<authortest> action so you can't do a release without passing the
author tests.
=back
=head1 METHODS
In addition to the above actions:
=head2 C<authortest_dependencies()>
Sets up dependencies upon the C<build>, C<manifest>, and C<distmeta> actions,
adds F<xt> to the set of test directories, and turns on the recursive
search for tests.
=head1 AUTHOR
Elliot Shank <perl@galumph.com>
=head1 COPYRIGHT
Copyright (c) 2007-2011 Elliot Shank.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
=cut
##############################################################################
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 78
# indent-tabs-mode: nil
# c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
|