diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-03-29 14:21:19 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-03-29 14:21:19 -0500 |
commit | 1de0245b552a791eca039472a61b8b8493626805 (patch) | |
tree | 8d6306ec568bec4ba9d3a806c12568a4eb8bca11 | |
parent | 94461dbdba9cc4ed782c9450275ae64a0bb1efd5 (diff) | |
download | package-stash-1de0245b552a791eca039472a61b8b8493626805.tar.gz package-stash-1de0245b552a791eca039472a61b8b8493626805.zip |
don't mark ::XS as a dep, but do set dynamic_config = 1
-rw-r--r-- | dist.ini | 7 | ||||
-rw-r--r-- | inc/DistMeta.pm | 31 | ||||
-rw-r--r-- | inc/MMPackageStash.pm | 4 |
3 files changed, 40 insertions, 2 deletions
@@ -9,12 +9,17 @@ dist = Package-Stash awesome = =inc::MMPackageStash CompileTests_skip = [Cc]onflicts$ +[=inc::DistMeta] +dynamic_config = 1 + [Prereqs] perl = 5.8.1 Package::DeprecationManager = 0 -Package::Stash::XS = 0.22 Scalar::Util = 0 +[Prereqs / RuntimeRecommends] +Package::Stash::XS = 0.22 + [Prereqs / TestRequires] Test::Fatal = 0 Test::More = 0.88 diff --git a/inc/DistMeta.pm b/inc/DistMeta.pm new file mode 100644 index 0000000..aa340f5 --- /dev/null +++ b/inc/DistMeta.pm @@ -0,0 +1,31 @@ +package inc::DistMeta; +use Moose; + +has metadata => ( + is => 'ro', + isa => 'HashRef', + required => 1, +); + +with 'Dist::Zilla::Role::MetaProvider'; + +around BUILDARGS => sub { + my $orig = shift; + my $self = shift; + + my $params = $self->$orig(@_); + + my $zilla = delete $params->{zilla}; + my $plugin_name = delete $params->{plugin_name}; + + return { + zilla => $zilla, + plugin_name => $plugin_name, + metadata => $params, + }; +}; + +__PACKAGE__->meta->make_immutable; +no Moose; + +1; diff --git a/inc/MMPackageStash.pm b/inc/MMPackageStash.pm index bcbc48e..de68a03 100644 --- a/inc/MMPackageStash.pm +++ b/inc/MMPackageStash.pm @@ -44,7 +44,9 @@ CAN_CC my $template = $self->$orig(@_); - $template =~ s/(WriteMakefile\()/delete \$WriteMakefileArgs{PREREQ_PM}{'Package::Stash::XS'}\n unless can_cc();\n\n$1/; + my $xs_version = $self->zilla->prereqs->requirements_for('runtime', 'recommends')->as_string_hash->{'Package::Stash::XS'}; + + $template =~ s/(WriteMakefile\()/\$WriteMakefileArgs{PREREQ_PM}{'Package::Stash::XS'} = $xs_version\n if can_cc();\n\n$1/; return $template . $can_cc; }; |