my
(
$optdep_msg
,
$opt_testdeps
);
if
(
$args
->{skip_author_deps}) {
$optdep_msg
=
<<'EOW';
******************************************************************************
******************************************************************************
*** ***
*** IGNORING AUTHOR MODE: no optional test dependencies will be forced. ***
*** ***
*** If you are using this checkout with the intention of submitting a DBIC ***
*** patch, you are *STRONGLY ENCOURAGED* to install all dependencies, so ***
*** that every possible unit-test will run. ***
*** ***
******************************************************************************
******************************************************************************
EOW
}
else
{
$optdep_msg
=
<<'EOW';
******************************************************************************
******************************************************************************
*** ***
*** AUTHOR MODE: all optional test dependencies converted to hard requires ***
*** ( to disable re-run Makefile.PL with --skip-author-deps ) ***
*** ***
******************************************************************************
******************************************************************************
EOW
my
%reqs_for_group
= %{DBIx::Class::Optional::Dependencies->req_group_list};
$opt_testdeps
= {
map
{ %{
$reqs_for_group
{
$_
}} }
grep
{ !/^rdbms_|^dist_/ }
keys
%reqs_for_group
};
print
"Including all optional deps\n"
;
$reqs
->{test_requires} = {
%{
$reqs
->{test_requires}},
%$opt_testdeps
};
}
{
no
warnings
'redefine'
;
no
strict
'refs'
;
for
(
qw/_prompt import/
) {
my
$meth
=
"Module::AutoInstall::$_"
;
my
$orig
= \&{
$meth
};
*{
$meth
} =
sub
{
print
$optdep_msg
;
goto
$orig
;
};
}
}
END {
return
if
$?;
my
%original_build_requires
= (
%$build_requires
,
%$test_requires
);
my
@all_build_requires
= @{
delete
Meta->{
values
}{build_requires}||[]};
my
%removed_build_requires
;
for
(
@all_build_requires
) {
if
(
$original_build_requires
{
$_
->[0]}) {
push
@{Meta->{
values
}{build_requires}},
$_
;
}
else
{
$removed_build_requires
{
$_
->[0]} =
$_
->[1]
unless
$_
->[0] eq
'ExtUtils::MakeMaker'
;
}
}
if
(
keys
%removed_build_requires
) {
print
"Regenerating META with author requires excluded\n"
;
local
$SIG
{__WARN__} =
sub
{
warn
$_
[0]
unless
$_
[0] =~ /Wide character in
print
/ };
Meta->
write
;
}
if
($^O eq
'MSWin32'
or $^O eq
'cygwin'
) {
local
$ENV
{PERLIO} =
'unix'
;
system
( $^X,
qw( -MExtUtils::Command -e dos2unix -- META.yml)
, );
}
if
(! -f
'META.yml'
) {
warn
"No META.yml generated?! aborting...\n"
;
unlink
'Makefile'
;
exit
1;
}
my
$meta
=
do
{
local
@ARGV
=
'META.yml'
;
local
$/; <> };
$meta
=~ /^\Qname: DBIx-Class\E$/m or
do
{
warn
"Seemingly malformed META.yml...?\n"
;
unlink
'Makefile'
;
exit
1;
};
my
@illegal_leftovers
=
grep
{
$meta
=~ /^ \s+ \Q
$_
\E \: \s+ /mx }
(
sort
keys
%$opt_testdeps
)
;
if
(
@illegal_leftovers
) {
warn
join
(
"\n"
,
"\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:\n"
,
map
{
"\t$_"
}
@illegal_leftovers
) .
"\n\n"
;
unlink
'Makefile'
;
exit
1;
}
}
1;