From: Karen Etheridge Date: Mon, 6 May 2013 17:17:39 +0000 (-0700) Subject: introduction of conflicts checking for Moo X-Git-Tag: v1.003000~55^2~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b46a4be88ff40d07ff8c22d0fa7d51380f19067;p=gitmo%2FMoo.git introduction of conflicts checking for Moo This was copied from the latest Moose build (which in turn was auto-generated via Dist::Zilla::Plugin::Conflicts). --- diff --git a/Makefile.PL b/Makefile.PL index a865867..e8c7e61 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,6 +2,8 @@ use strict; use warnings FATAL => 'all'; use 5.008001; use ExtUtils::MakeMaker; + +check_conflicts(); (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; my %BUILD_DEPS = (); @@ -43,10 +45,14 @@ my %extra_info = ( WriteMakefile( NAME => 'Moo', VERSION_FROM => 'lib/Moo.pm', + CONFIGURE_REQUIRES => { + 'Dist::CheckConflicts' => '0.02', + }, PREREQ_PM => { %RUN_DEPS, ($] >= 5.010 ? () : ('MRO::Compat' => 0)), ($mymeta_works ? () : (%BUILD_DEPS)), + 'Dist::CheckConflicts' => '0.02', }, ($mymeta_works ? ( # BUILD_REQUIRES makes MYMETA right, requires stops META being wrong @@ -70,5 +76,39 @@ WriteMakefile( }, ($mymeta && !$mymeta_works ? (NO_MYMETA => 1) : ()), LICENSE => 'perl', + 'EXE_FILES' => [ + 'bin/moo-outdated', + ], ); + +# copied from Moose-2.0801/Makefile.PL +sub check_conflicts { + if ( eval { require 'lib/Moo/Conflicts.pm'; 1; } ) { + if ( eval { Moo::Conflicts->check_conflicts; 1 } ) { + return; + } + else { + my $err = $@; + $err =~ s/^/ /mg; + warn "***\n$err***\n"; + } + } + else { + print <<'EOF'; +*** + Your toolchain doesn't support configure_requires, so + Dist::CheckConflicts hasn't been installed yet. You should check for + conflicting modules manually using the 'moo-outdated' script that is + installed with this distribution once the installation finishes. +*** +EOF + } + + # More or less copied from Module::Build + return if $ENV{PERL_MM_USE_DEFAULT}; + return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) ); + + sleep 4; +} + diff --git a/bin/moo-outdated b/bin/moo-outdated new file mode 100644 index 0000000..e73862b --- /dev/null +++ b/bin/moo-outdated @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use strict; +use warnings; +# PODNAME: moo-outdated + +use Getopt::Long; +use Moo::Conflicts; + +my $verbose; +GetOptions( 'verbose|v' => \$verbose ); + +if ($verbose) { + Moo::Conflicts->check_conflicts; +} +else { + my @conflicts = Moo::Conflicts->calculate_conflicts; + print "$_\n" for map { $_->{package} } @conflicts; + exit @conflicts; +} + diff --git a/lib/Moo/Conflicts.pm b/lib/Moo/Conflicts.pm new file mode 100644 index 0000000..488e2ca --- /dev/null +++ b/lib/Moo/Conflicts.pm @@ -0,0 +1,27 @@ +package # hide from PAUSE + Moo::Conflicts; + +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Moo', + -conflicts => { + # enter conflicting downstream deps here, with the version indicating + # the last *broken* version that *does not work*. + + }, + + # these dists' ::Conflicts modules (if they exist) are also checked for + # more incompatibilities -- should include all runtime prereqs here. + -also => [ qw( + Carp + Class::Method::Modifiers + strictures + Module::Runtime + Role::Tiny + Devel::GlobalDestruction + ) ], +; + +1;