Author: dagolden
Date: Tue Sep 1 18:58:48 2009
New Revision: 13253
Modified:
Module-Build/trunk/Changes
Module-Build/trunk/MANIFEST
Module-Build/trunk/lib/Module/Build/API.pod
Module-Build/trunk/lib/Module/Build/Base.pm
Module-Build/trunk/t/properties/share_dir.t
Log:
require File::ShareDir if share_dir is set
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Tue Sep 1 18:58:48 2009
@@ -6,6 +6,8 @@
- Added 'needs_compiler' property. Defaults to true if XS or c_source
exist. If true, ExtUtils::CBuilder is also added to build_requires.
[David Golden]
+ - File::ShareDir automatically added to 'requires' if 'share_dir' is set
+ [David Golden]
Bug fixes:
- Failure to detect a compiler will now warn during Build.PL and be a
Modified: Module-Build/trunk/MANIFEST
==============================================================================
--- Module-Build/trunk/MANIFEST (original)
+++ Module-Build/trunk/MANIFEST Tue Sep 1 18:58:48 2009
@@ -66,11 +66,11 @@
t/pod_parser.t
t/ppm.t
t/properties/needs_compiler.t
+t/properties/share_dir.t
t/README.pod
t/runthrough.t
t/sample.t
t/script_dist.t
-t/share_dir.t
t/signature.t
t/test_file_exts.t
t/test_type.t
Modified: Module-Build/trunk/lib/Module/Build/API.pod
==============================================================================
--- Module-Build/trunk/lib/Module/Build/API.pod (original)
+++ Module-Build/trunk/lib/Module/Build/API.pod Tue Sep 1 18:58:48 2009
@@ -775,6 +775,9 @@
}
}
+If C<share_dir> is set (manually or automatically), then File::ShareDir
+will automatically be added to the C<requires> hash.
+
=item sign
[version 0.16]
Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Tue Sep 1 18:58:48 2009
@@ -1242,6 +1242,11 @@
}
}
+ # If using share_dir, require File::ShareDir
+ if ( $self->share_dir ) {
+ $self->_add_prereq( 'requires', 'File::ShareDir', '1.00' );
+ }
+
return;
}
@@ -2535,8 +2540,6 @@
my $files = $self->_find_share_dir_files;
return unless $files;
- # XXX need to add File::ShareDir as 'requires'
-
# root for all File::ShareDir paths
my $share_prefix = File::Spec->catdir($self->blib, qw/lib auto share/);
Modified: Module-Build/trunk/t/properties/share_dir.t
==============================================================================
--- Module-Build/trunk/t/properties/share_dir.t (original)
+++ Module-Build/trunk/t/properties/share_dir.t Tue Sep 1 18:58:48 2009
@@ -9,7 +9,7 @@
# Begin testing
#--------------------------------------------------------------------------#
-plan tests => 19;
+plan tests => 21;
blib_load('Module::Build');
@@ -38,6 +38,9 @@
is( $mb->share_dir, undef,
"default share undef if no 'share' dir exists"
);
+ok( ! exists $mb->{properties}{requires}{'File::ShareDir'},
+ "File::ShareDir not added to 'requires'"
+);
# Add 'share' dir and an 'other' dir and content
$dist->add_file('share/foo.txt',<< '---');
@@ -55,6 +58,9 @@
is_deeply( $mb->share_dir, { dist => [ 'share' ] },
"Default share_dir set as dist-type share"
);
+is( $mb->{properties}{requires}{'File::ShareDir'}, '1.00',
+ "File::ShareDir 1.00 added to 'requires'"
+);
# share_dir set to scalar
$dist->change_build_pl(