« Dist/Zilla/Plugin/ATOOMIC/Git/CheckFor/CorrectBranch.pm
↑ Summary
Dist/Zilla/Plugin/ATOOMIC/RunExtraTests.pm »
| 1 | package Dist::Zilla::Plugin::ATOOMIC::MakeMaker; | ||
| 2 | |||
| 3 | use v5.10; | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | use autodie; | ||
| 8 | use namespace::autoclean; | ||
| 9 | |||
| 10 | our $VERSION = '1.00'; | ||
| 11 | |||
| 12 | use File::Which qw( which ); | ||
| 13 | |||
| 14 | use Moose; | ||
| 15 | |||
| 16 | extends 'Dist::Zilla::Plugin::MakeMaker::Awesome'; | ||
| 17 | |||
| 18 | has has_xs => ( | ||
| 19 | is => 'ro', | ||
| 20 | isa => 'Bool', | ||
| 21 | default => 0, | ||
| 22 | ); | ||
| 23 | |||
| 24 | has wall_min_perl_version => ( | ||
| 25 | is => 'ro', | ||
| 26 | isa => 'Str', | ||
| 27 | default => '5.008008', | ||
| 28 | ); | ||
| 29 | |||
| 30 | with 'Dist::Zilla::Plugin::ATOOMIC::Role::CoreCounter'; | ||
| 31 | |||
| 32 | # Dist::Zilla provides no way to pass a `-j` option when running dzil release | ||
| 33 | # but I really would like faster releases. | ||
| 34 | sub default_jobs { | ||
| 35 | return shift->_core_count; | ||
| 36 | } | ||
| 37 | |||
| 38 | override _build_WriteMakefile_dump => sub { | ||
| 39 | my $self = shift; | ||
| 40 | |||
| 41 | my $dump = super(); | ||
| 42 | return $dump unless $self->has_xs; | ||
| 43 | |||
| 44 | $dump .= sprintf( <<'EOF', $self->wall_min_perl_version ); | ||
| 45 | my $gcc_warnings = $ENV{AUTHOR_TESTING} && $] >= %s ? q{ -Wall -Werror} : q{}; | ||
| 46 | $WriteMakefileArgs{DEFINE} | ||
| 47 | = ( $WriteMakefileArgs{DEFINE} || q{} ) . $gcc_warnings; | ||
| 48 | |||
| 49 | EOF | ||
| 50 | |||
| 51 | return $dump; | ||
| 52 | }; | ||
| 53 | |||
| 54 | __PACKAGE__->meta->make_immutable; | ||
| 55 | |||
| 56 | 1; | ||
| 57 | |||
| 58 | # ABSTRACT: Subclasses MakeMaker::Awesome to always run tests in parallel and add -W flags for XS code | ||
| 59 | |||
| 60 | __END__ |