1 my ($optdep_msg, $opt_testdeps);
3 if ($args->{skip_author_deps}) {
6 ******************************************************************************
7 ******************************************************************************
9 *** IGNORING AUTHOR MODE: no optional test dependencies will be forced. ***
11 *** If you are using this checkout with the intention of submitting a DBIC ***
12 *** patch, you are *STRONGLY ENCOURAGED* to install all dependencies, so ***
13 *** that every possible unit-test will run. ***
15 ******************************************************************************
16 ******************************************************************************
21 $optdep_msg = <<'EOW';
23 ******************************************************************************
24 ******************************************************************************
26 *** AUTHOR MODE: all optional test dependencies converted to hard requires ***
27 *** ( to disable re-run Makefile.PL with --skip_author_deps ) ***
29 ******************************************************************************
30 ******************************************************************************
34 require DBIx::Class::Optional::Dependencies;
35 my %reqs_for_group = %{DBIx::Class::Optional::Dependencies->req_group_list};
37 # exclude the rdbms_* groups which are for DBIC users
39 map { %{$reqs_for_group{$_}} } grep { !/^rdbms_/ } keys %reqs_for_group
42 print "Including all optional deps\n";
43 $reqs->{test_requires} = {
44 %{$reqs->{test_requires}},
49 # nasty hook into both M::AI init and the prompter, so that the optdep message
50 # comes at the right places (on top and then right above the prompt)
52 require Module::AutoInstall;
53 no warnings 'redefine';
56 for (qw/_prompt import/) {
57 my $meth = "Module::AutoInstall::$_";
66 # this will run after the Makefile is written and the main Makefile.PL terminates
69 # Re-write META.yml at the end to _exclude_ all forced build-requires (we do not
70 # want to ship this) We are also not using M::I::AuthorRequires as this will be
71 # an extra dep, and deps in Makefile.PL still suck
72 # Also always test the result so we stop shipping borked dependency lists to CPAN
74 # FIXME test_requires is not yet part of META
75 my %original_build_requires = ( %$build_requires, %$test_requires );
76 my @all_build_requires = @{delete Meta->{values}{build_requires}||[]};
77 my %removed_build_requires;
79 for (@all_build_requires) {
80 if ($original_build_requires{$_->[0]}) {
81 push @{Meta->{values}{build_requires}}, $_;
84 $removed_build_requires{$_->[0]} = $_->[1]
85 unless $_->[0] eq 'ExtUtils::MakeMaker';
89 if (keys %removed_build_requires) {
90 print "Regenerating META with author requires excluded\n";
94 # test that we really took things away (just in case, happened twice somehow)
95 if (! -f 'META.yml') {
96 warn "No META.yml generated?! aborting...\n";
100 my $meta = do { local @ARGV = 'META.yml'; local $/; <> };
102 # this is safe as there is a fatal check earlier in the main Makefile.PL
103 # to make sure there are no duplicates (i.e. $opt_testdeps does not contain
104 # any real dependencies)
105 my @illegal_leftovers = grep
106 { $meta =~ /^ \s+ \Q$_\E \: \s+ /mx }
107 ( sort keys %$opt_testdeps )
110 if (@illegal_leftovers) {
112 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:\n",
113 map { "\t$_" } @illegal_leftovers
120 # keep the Makefile.PL eval happy