#######################################################################
#      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/Build.PL $
#     $Date: 2007-12-29 13:22:01 -0600 (Sat, 29 Dec 2007) $
#   $Author: clonezone $
# $Revision: 2076 $
########################################################################

BEGIN {
    require 5.006001;
}

use strict;
use warnings;

use lib 'inc';
use lib 't/tlib';

use Module::Build;

use Perl::Critic::BuildUtilities qw<
    recommended_module_versions
    test_wrappers_to_generate
    get_PL_files
    dump_unlisted_or_optional_module_versions
    emit_tar_warning_if_necessary
>;

my $warning = <<'END_WARNING';

###################################################
# NOTICE! NOTICE! NOTICE! NOTICE! NOTICE! NOTICE! #
#-------------------------------------------------#
# In this version of Perl::Critic, some of        #
# the Policy modules have been renamed to better  #
# better reflect the intent of the Policy.  If    #
# you have an older version of Perl::Critic       #
# already installed, it will cause many of the    #
# tests to fail and the new version will not work #
# properly.                                       #
#                                                 #
# I strongly advise you to remove the current     #
# version of Perl::Critic before proceeding with  #
# this installation.  In most cases, this can be  #
# done by deleting everything below the           #
# Perl/Critic/Policy directory in your site_perl  #
# location.                                       #
#                                                 #
# Also, if you have created a .perlcriticrc file, #
# you will need to update it to match the new     #
# Policy module names.                            #
#                                                 #
# Sorry for the inconvenience.                    #
#                                                 #
# -Jeff <thaljef@cpan.org>                        #
###################################################

END_WARNING


eval {
    require Perl::Critic;
    warn $warning if $Perl::Critic::VERSION < 0.14;
};

emit_tar_warning_if_necessary();

my $builder = Module::Build->new(
    module_name    => 'Perl::Critic',
    dist_author    => 'Jeffrey Thalhammer <thaljef@cpan.org>',
    dist_abstract  => 'Critique Perl source code for best-practices',
    license        => 'perl',

    requires       => {
        'B::Keywords'           => 1.05,
        'Config::Tiny'          => 2,
        'Exception::Class'      => 1.23,
        'File::Spec'            => 0,
        'File::Spec::Unix'      => 0,
        'IO::String'            => 0,
        'List::MoreUtils'       => 0,
        'List::Util'            => 0,
        'Module::Pluggable'     => 3.1,
        'PPI'                   => 1.201,
        'Pod::PlainText'        => 0,
        'Pod::Usage'            => 0,
        'Readonly'              => 1.03,
        'Scalar::Util'          => 0,
        'String::Format'        => 1.13,
    },

    recommends     => { recommended_module_versions() },

    build_requires => {
        'Test::More'            => 0,
    },

    PL_files       => get_PL_files(),

    script_files   => ['bin/perlcritic'],

    meta_merge     => {
        resources   => {
            homepage    => 'http://perlcritic.com',
            license     => 'http://dev.perl.org/licenses/',
            Repository  => 'http://perlcritic.tigris.org/source/browse/perlcritic/',
            MailingList => 'http://perlcritic.tigris.org/servlets/SummarizeList?listName=users',
        }
    },

    add_to_cleanup => [
        qw<
            MANIFEST.bak
            Makefile
            Makefile.old
            pm_to_blib
            t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
        >,
        test_wrappers_to_generate(),
    ],
);

$builder->create_build_script();

dump_unlisted_or_optional_module_versions();

##############################################################################
# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
#   indent-tabs-mode: nil
#   c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab :
