Author: dagolden
Date: Fri Nov 13 04:06:25 2009
New Revision: 13498
Added:
Module-Build/trunk/t/resume.t (contents, props changed)
Modified:
Module-Build/trunk/Changes
Module-Build/trunk/MANIFEST
Module-Build/trunk/lib/Module/Build/Base.pm
Log:
add @INC additions on resume()
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Fri Nov 13 04:06:25 2009
@@ -13,6 +13,9 @@
Bug fixes:
+ - resume() was not restoring additions to @INC added in Build.PL
+ (RT#50145) [David Golden]
+
- Merging 'requires' and 'build_requires' in Module::Build::Compat could
lead to duplicate PREREQ_PM entries; now the highest version is used
for PREREQ_PM. (RT#50948) [David Golden]
@@ -20,7 +23,7 @@
- Module::Build::Compat will now die with an error if advanced,
non-numeric prerequisites are given, as these are not supported by
ExtUtils::MakeMaker in PREREQ_PM [David Golden]
-
+
- Made MYMETA generation non-fatal if fields required for META.yml
are missing [David Golden]
@@ -30,9 +33,9 @@
- When tarball paths are less than 100 characters, disables 'prefix'
mode of Archive::Tar for maximum compatibility (RT#50571) [David Golden]
-
+
- Won't die if installed Pod::Readme is broken [David Golden]
-
+
Other:
- Fixed Module::Build::Notes POD [David Golden]
Modified: Module-Build/trunk/MANIFEST
==============================================================================
--- Module-Build/trunk/MANIFEST (original)
+++ Module-Build/trunk/MANIFEST Fri Nov 13 04:06:25 2009
@@ -73,6 +73,7 @@
t/properties/needs_compiler.t
t/properties/share_dir.t
t/README.pod
+t/resume.t
t/runthrough.t
t/sample.t
t/script_dist.t
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 Fri Nov 13 04:06:25 2009
@@ -52,12 +52,15 @@
}
}
+ # record for later use in resume;
+ $self->{properties}{_added_to_INC} = [ $self->_added_to_INC ];
+
$self->set_bundle_inc;
$self->dist_name;
$self->dist_version;
$self->_guess_module_name unless $self->module_name;
-
+
$self->_find_nested_builds;
return $self;
@@ -68,6 +71,8 @@
my $self = $package->_construct(@_);
$self->read_config;
+ unshift @INC, @{ $self->{properties}{_added_to_INC} || [] };
+
# If someone called Module::Build->current() or
# Module::Build->new_from_context() and the correct class to use is
# actually a *subclass* of Module::Build, we may need to load that
Added: Module-Build/trunk/t/resume.t
==============================================================================
--- (empty file)
+++ Module-Build/trunk/t/resume.t Fri Nov 13 04:06:25 2009
@@ -0,0 +1,43 @@
+use strict;
+use lib 't/lib';
+use MBTest;
+plan tests => 3; # or 'no_plan'
+use DistGen;
+
+# Ensure any Module::Build modules are loaded from correct directory
+blib_load('Module::Build');
+
+# create dist object in a temp directory
+# enter the directory and generate the skeleton files
+my $dist = DistGen->new->chdir_in;
+$dist->add_file('mylib/MBUtil.pm', << "---");
+package MBUtil;
+sub foo { 42 }
+1;
+---
+
+$dist->add_file('Build.PL', << "---");
+use strict;
+use lib 'mylib';
+use MBUtil;
+use Module::Build;
+
+die unless MBUtil::foo() == 42;
+
+my \$builder = Module::Build->new(
+module_name => '$dist->{name}',
+license => 'perl',
+);
+
+\$builder->create_build_script();
+---
+
+$dist->regen;
+
+# get a Module::Build object and test with it
+my $mb = $dist->new_from_context(); # quiet by default
+isa_ok( $mb, "Module::Build" );
+is( $mb->dist_name, "Simple", "dist_name is 'Simple'" );
+ok( ( grep { /mylib/ } @INC ), "resume added \...@inc addition to \...@inc");
+
+# vim:ts=2:sw=2:et:sta:sts=2