-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBuild.PL
129 lines (114 loc) · 3.74 KB
/
Build.PL
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
#!/usr/bin/perl -w
use strict;
use warnings;
use Module::Build;
# This subclassing adds the following build commands:
# testrelease - runs the release tests in xt/release
# testslow - runs the painfully slow tests in xt/slow
# testall - runs the tests both in t and xt (recursively)
# It also customises the "test" command so that it also runs the
# release tests if either the RELEASE_TESTING or AUTOMATED_TESTING
# environment variables are set, in line with what appears to be
# the current consensus "best-practice" as of Feb 2010.
#
# All xt tests are assumed to do their own requirements checking
# and to gracefully skip their tests if the requirements are not
# available: under no circumstances should they add requirements
# to the end-user build or install processes.
my $class = Module::Build->subclass(
class => 'Module::Build::SGRAHAM',
code => <<'END_OF_CODE',
sub ACTION_test
{
my ( $self ) = @_;
if( $ENV{ RELEASE_TESTING } or $ENV{ AUTOMATED_TESTING } )
{
# Checking $self->{ properties } breaks the black-box but
# won't clobber use of --test_files args.
# Can't call $self->test_files() to find if any were manually
# supplied, because that autoexpands the default setting.
$self->test_files( 't', 'xt/release' )
unless $self->{ properties }->{ test_files };
}
return $self->SUPER::ACTION_test();
}
sub ACTION_testrelease
{
my ( $self ) = @_;
$self->depends_on( 'build' );
local $ENV{ RELEASE_TESTING } = 1;
$self->test_files( qw( xt/release ) );
$self->depends_on( 'test' );
}
sub ACTION_testslow
{
my ( $self ) = @_;
$self->depends_on( 'build' );
$self->test_files( qw( xt/slow ) );
$self->depends_on( 'test' );
}
sub ACTION_testall
{
my ( $self ) = @_;
$self->depends_on( 'build' );
$self->test_files( qw( t xt ) );
$self->recursive_test_files( 1 );
$self->depends_on( 'test' );
}
sub ACTION_distdir
{
my ( $self ) = @_;
$self->depends_on( 'testrelease' );
return( $self->SUPER::ACTION_distdir() );
}
END_OF_CODE
);
my $builder = $class->new(
module_name => 'Template::Benchmark',
license => 'perl',
dist_author => q{Sam Graham <[email protected]>},
dist_version_from => 'lib/Template/Benchmark.pm',
script_files => 'script',
configure_requires => {
'Module::Build' => 0.23,
},
build_requires => {
'Config' => 0,
'Cwd' => 0,
'File::Spec' => 0,
'FindBin' => 0,
'Test::More' => 0,
'Test::Command' => 0.08,
'Test::Exception' => 0,
'Test::MockObject' => 0,
},
requires => {
'perl' => '5.6.1',
# For the module.
'Module::Pluggable' => 0,
'Benchmark' => 0,
'File::Path' => 0,
'File::Spec' => 0,
# File::Temp->newdir() requires 0.18.
'File::Temp' => 0.18,
'File::Slurp' => '9999.19',
'IO::File' => 0,
'Scalar::Util' => 0,
# For the script.
'FindBin' => 0,
'Getopt::Long' => 0,
'Pod::Usage' => 0,
'Term::Size::Any' => 0.001,
'Text::Wrap' => 0,
'Text::Matrix' => 0,
},
meta_merge => {
'resources' => {
'repository' => 'http://github.com/illusori/Perl-Template-Benchmark',
},
},
create_readme => 1,
sign => 1,
dynamic_config => 0,
);
$builder->create_build_script();