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