Force xt/ tests to run on anything involving a create_distdir
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
fe650234 1use strict;
2use warnings;
3
55087b99 4use 5.008001;
6c96d73f 5use inc::Module::Install 1.06;
ce4c07df 6
d1dc7a98 7##
8## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad)
9##
fc4b0448 10# get cpanX --installdeps . to behave in a checkout (most users do not expect
11# the deps for a full test suite run, and if they do - there's MI::AutoInstall
12# for that)
13BEGIN {
14 $Module::Install::AUTHOR = 0 if (grep { $ENV{"PERL5_${_}_IS_RUNNING"} } (qw/CPANM CPANPLUS CPAN/) );
15}
4b5544ad 16
47589465 17homepage 'http://www.dbix-class.org/';
18resources 'IRC' => 'irc://irc.perl.org/#dbix-class';
19resources 'license' => 'http://dev.perl.org/licenses/';
20resources 'repository' => 'https://github.com/dbsrgits/DBIx-Class';
21resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
22resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
23
ce4c07df 24name 'DBIx-Class';
b50d0dd3 25perl_version '5.008001';
8e0f16f1 26all_from 'lib/DBIx/Class.pm';
294c1f51 27Meta->{values}{x_authority} = 'cpan:RIBASUSHI';
ce4c07df 28
fc4b0448 29tests_recursive (qw|
30 t
31|);
8057ed01 32
fc4b0448 33install_script (qw|
34 script/dbicadmin
35|);
90cfe42b 36
fc4b0448 37###
38### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
39### All of them *MUST* go to DBIx::Class::Optional::Dependencies
40###
8057ed01 41my $runtime_requires = {
fc4b0448 42 # FIXME - temporary, needs throwing out for something more efficient
43 'Data::Compare' => '1.22',
44
45 # DBI itself should be capable of installation and execution in pure-perl
46 # mode. However it has never been tested yet, so consider XS for the time
47 # being
48 'DBI' => '1.57',
49
50 # XS (or XS-dependent) libs
51 'Sub::Name' => '0.04',
52
53 # pure-perl (FatPack-able) libs
90fb8e19 54 'Class::Accessor::Grouped' => '0.10009',
9c1700e3 55 'Class::C3::Componentised' => '1.0009',
8057ed01 56 'Class::Inspector' => '1.24',
79680fc0 57 'Config::Any' => '0.20',
58 'Context::Preserve' => '0.01',
2b8cc2f2 59 'Data::Dumper::Concise' => '2.020',
8057ed01 60 'Data::Page' => '2.00',
90fb8e19 61 'Devel::GlobalDestruction' => '0.09',
b8d22f13 62 'Hash::Merge' => '0.12',
dfd722ef 63 'Moo' => '1.000006',
90fb8e19 64 'MRO::Compat' => '0.12',
65 'Module::Find' => '0.07',
66 'namespace::clean' => '0.24',
f4d7449c 67 'Path::Class' => '0.18',
b7b18f32 68 'Scope::Guard' => '0.03',
6612e610 69 'SQL::Abstract' => '1.73',
90fb8e19 70 'Try::Tiny' => '0.07',
fc4b0448 71};
cd122820 72
fc4b0448 73my $build_requires = {
74 # needed for testing only, not for operation
75 # we will move away from this dep eventually, perhaps to DBD::CSV or something
76 'DBD::SQLite' => '1.29',
8057ed01 77};
78
fc4b0448 79my $test_requires = {
80 'File::Temp' => '0.22',
81 'Test::Exception' => '0.31',
82 'Test::Warn' => '0.21',
83 'Test::More' => '0.94',
84 # not sure if this is necessary at all, ask schwern some day
85 'Test::Builder' => '0.94',
86
87 # this is already a dep of n::c, but just in case - used by t/55namespaces_cleaned.t
88 # remove and do a manual glob-collection if n::c is no longer a dep
89 'Package::Stash' => '0.28',
90};
bb7950c0 91
9345b14c 92# make strictures.pm happy (DO NOT LIKE, TOO MUCH XS!)
93# (i.e. what if the .git/.svn is *not* because of DBIC?)
94#
95# Note - this is added as test_requires *directly*, so it gets properly
96# excluded on META.yml cleansing
97if (-e '.git' or -e '.svn') {
98 test_requires 'indirect' => '0.25';
99 test_requires 'multidimensional' => '0.008';
100 test_requires 'bareword::filehandles' => '0.003';
101}
102
20beaf5f 103# if the user has this env var set and no SQLT installed, tests will fail
104# same rationale for direct test_requires as the strictures stuff above
105# (even though no dist will be created from this)
106# we force this req regarless of author_deps, worst case scenario it will
107# be specified twice
108if ($ENV{DBICTEST_SQLT_DEPLOY}) {
109 local @INC = ('lib', @INC);
110 require DBIx::Class::Optional::Dependencies;
111 my $dep_req = DBIx::Class::Optional::Dependencies->req_list_for('deploy');
112 for (keys %$dep_req) {
113 test_requires ($_ => $dep_req->{$_})
114 }
115}
116
8057ed01 117# this is so we can order requires alphabetically
fc4b0448 118# copies are needed for potential author requires injection
8057ed01 119my $reqs = {
120 build_requires => { %$build_requires },
121 requires => { %$runtime_requires },
122 test_requires => { %$test_requires },
123};
3a4251e2 124
c78f9f5b 125# only do author-includes if not part of a `make` run
126if ($Module::Install::AUTHOR and ! $ENV{MAKELEVEL}) {
fc4b0448 127 # get options here, make $args available to all snippets
128 require Getopt::Long;
129 my $getopt = Getopt::Long::Parser->new(
130 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
131 );
132 my $args = {
133 skip_author_deps => undef,
134 };
df65d4da 135 $getopt->getoptions($args, qw/
136 skip_author_deps|skip-author-deps
137 /);
fc4b0448 138 if (@ARGV) {
139 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
0424d17a 140 }
8057ed01 141
fc4b0448 142 require File::Spec;
143 # string-eval, not do(), because we need to provide the
144 # $reqs and $*_requires lexicals to the included file
145 # (some includes *do* modify $reqs above)
8baa2122 146 for my $inc (sort glob ( File::Spec->catfile('maint', 'Makefile.PL.inc', '*') ) ) {
147 my $src = do { local (@ARGV, $/) = $inc; <> } or die $!;
148 eval "use warnings; use strict; $src" or die sprintf
149 "Failed execution of %s: %s\n",
150 $inc,
151 ($@ || $! || 'Unknown error'),
152 ;
0424d17a 153 }
8057ed01 154}
fc4b0448 155else {
156 # make sure this Makefile can not be used to make a dist
0e016219 157 # (without the author includes there are no meta cleanup, no sanity checks, etc)
fc4b0448 158 postamble <<EOP;
fc4b0448 159create_distdir: nonauthor_stop_distdir_creation
160nonauthor_stop_distdir_creation:
161\t\$(NOECHO) \$(ECHO) Creation of dists in non-author mode is not allowed
162\t\$(NOECHO) \$(FALSE)
163EOP
164}
8057ed01 165
166# compose final req list, for alphabetical ordering
167my %final_req;
168for my $rtype (keys %$reqs) {
169 for my $mod (keys %{$reqs->{$rtype}} ) {
170
171 # sanity check req duplications
172 if ($final_req{$mod}) {
b718fd0a 173 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
8057ed01 174 }
175
176 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
177 }
178}
179
180# actual require
181for my $mod (sort keys %final_req) {
182 my ($rtype, $ver) = @{$final_req{$mod}};
183 no strict 'refs';
184 $rtype->($mod, $ver);
185}
a410299d 186
fc4b0448 187# author-mode or not - this is where we show a list of missing deps
188# IFF we are running interactively
92f8f62a 189auto_install();
a410299d 190
713cc98e 191WriteAll();