Revert "Fix t/lib/MooseCompat.pm"
[gitmo/Mouse.git] / Makefile.PL
CommitLineData
972340a6 1# COMPAT_TEST=1 genrates Moose compatible tests
e8c583d3 2# for developpers:
3BEGIN{
4 if(grep{ $_ eq '--author' } @ARGV){
01f38ab1 5 print "$^X -S cpanm < author/requires.cpanm\n";
e8c583d3 6 system "$^X -S cpanm < author/requires.cpanm";
7 }
8}
9
08f7a8db 10use strict;
11use warnings;
533ed4d6 12use inc::Module::Install 1.00;
c3398f5b 13
884bf37f 14# for co-developpers
8e4a10a8 15use Module::Install::XSUtil 0.30;
d202164d 16use Module::Install::AuthorTests;
884bf37f 17
c3398f5b 18name 'Mouse';
19all_from 'lib/Mouse.pm';
20
ec53d678 21# Scalar::Util < 1.14 has a bug.
22# > Fixed looks_like_number(undef) to return false for perl >= 5.009002
23requires 'Scalar::Util' => 1.14;
272a1930 24
eb88905f 25test_requires 'Test::More' => 0.88;
533ed4d6 26test_requires 'Test::Exception' => 0.29;
179ac6cc 27
3310ddf2 28my %suggests = (
af1c2a64 29 'Any::Moose' => 0.10,
8e4a10a8 30
3310ddf2 31 'MouseX::AttributeHelpers' => 0.06,
32);
3310ddf2 33while(my($mod, $least) = each %suggests){
6741954a 34 my $status = system $^X, '-e', <<"CHECK";
35if(eval q{ use $mod (); 1 }) {
36 if(eval q{ use $mod $least (); 1 }) {
c4f4f5e3 37 exit 0; # installd, and new enough
38 }
39 else {
40 exit 1; # installed, but too old
41 }
42}
43CHECK
44
45 if($status != 0){
46 my $ver = `$^X -e "use $mod (); print $mod->VERSION"`;
47 warn("\n",
48 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
49 " Please update $mod after installation of Mouse.\n",
50 "\n"
51 );
3310ddf2 52 }
53}
54
ec7a9423 55# cc_want deals with the '--pp' and '--xs' options
56my $use_xs = ($] >= 5.008_001 && want_xs());
0e81c55d 57
58if($use_xs){
2af88019 59 print "Mouse configured with XS.\n";
bb543d7f 60
fdee07cc 61 use_ppport(3.19);
8e4a10a8 62 use_xshelper();
2af88019 63 cc_warnings();
0e81c55d 64 cc_src_paths('xs-src');
0e81c55d 65}
66else{
7b92a82b 67 print "Mouse configured with Pure Perl.\n";
0e81c55d 68}
69
125dc1a8 70tests 't/*.t t/*/*.t';
1e2f2888 71author_tests 'xt';
72
125dc1a8 73repository 'git://git.moose.perl.org/Mouse.git';
74
823419c5 75system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
76 or warn "Cannot generate Mouse::Tiny: $!";
77makemaker_args PL_FILES => {
78 'tool/generate-mouse-tiny.pl' => 'lib/Mouse/Tiny.pm',
79};
80
af1c2a64 81if ($Module::Install::AUTHOR) {
82 require 'lib/Mouse/Spec.pm'; # for the version
121acb8a 83 my $require_version = Mouse::Spec->MooseVersion;
bf9f3f91 84
972340a6 85 if ($ENV{COMPAT_TEST}
86 && eval { require Moose; Moose->VERSION($require_version) }) {
92ff14d0 87 print "You have Moose ", Moose->VERSION, ".\n";
2af88019 88 do 'tool/create-moose-compatibility-tests.pl';
89 # repeat testing
90 # see also ExtUtils::MM_Any::test_via_harness()
91 my $t_moose = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
92 .q{ "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
93 .q{ xt/compat/t/*/*.t } . "\n";
94
95 postamble qq{test :: test_moose\n\n}
96 . qq{test_moose :: pure_all\n}
97 . qq{\t} . $t_moose;
314fe304 98 } else {
92ff14d0 99 print "You don't have Moose $require_version. skipping moose compatibility test\n";
314fe304 100 }
4358792d 101
102 if($use_xs){
f47ebad0 103 # repeat testing
104 # see also ExtUtils::MM_Any::test_via_harness()
105 my $t_pp = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
106 .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
107 .q{ $(TEST_FILES)} . "\n";
108
2af88019 109 postamble qq{test :: test_pp\n\n}
f47ebad0 110 . qq{test_pp :: pure_all\n}
111 . qq{\t} . $t_pp;
4358792d 112 }
314fe304 113}
114
af1c2a64 115clean_files q{
116 lib/Mouse/Tiny.pm $(O_FILES) test-mydeps-*.log
117 *.out
118 cover_db xs-src/*.gc{v,no,da}
119};
1e2f2888 120
eb88905f 121WriteAll check_nmake => 0;