Author: dagolden
Date: Mon Oct 5 22:10:51 2009
New Revision: 13380
Modified:
Module-Build/branches/inc-bundling/lib/Module/Build/Base.pm
Log:
prepare for including prerequisites in inc bundling
Modified: Module-Build/branches/inc-bundling/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/branches/inc-bundling/lib/Module/Build/Base.pm (original)
+++ Module-Build/branches/inc-bundling/lib/Module/Build/Base.pm Mon Oct 5
22:10:51 2009
@@ -842,6 +842,7 @@
__PACKAGE__->add_property(build_script => 'Build');
__PACKAGE__->add_property(build_bat => 0);
__PACKAGE__->add_property(bundle_inc => []);
+__PACKAGE__->add_property(bundle_inc_preload => []);
__PACKAGE__->add_property(config_dir => '_build');
__PACKAGE__->add_property(include_dirs => []);
__PACKAGE__->add_property(license => 'unknown');
@@ -1195,12 +1196,25 @@
sub set_bundle_inc {
my $self = shift;
my $bundle_inc = $self->{properties}{bundle_inc};
+ my $bundle_inc_preload = $self->{properties}{bundle_inc_preload};
# We're in author mode if inc::latest is loaded, but not from cwd
return unless inc::latest->can('loaded_modules');
require ExtUtils::Installed;
# ExtUtils::Installed is buggy about finding additions to default @INC
my $inst = ExtUtils::Installed->new(extra_libs => [$self->_added_to_INC]);
- for my $mod ( inc::latest->loaded_modules ) {
+ my @bundle_list = map { [ $_, 0 ] } inc::latest->loaded_modules;
+
+ # XXX TODO: Need to get ordering of prerequisites correct so they are
+ # are loaded in the right order. Use an actual tree?!
+
+ while( @bundle_list ) {
+ my ($mod, $prereq) = @{ shift @bundle_list };
+
+ # XXX TODO: Append prereqs to list
+ # skip if core or already in bundle or preload lists
+ # push @bundle_list, [$_, 1] for prereqs()
+
+ # Locate packlist for bundling
my $lookup = $self->_find_packlist($inst,$mod);
if ( ! $lookup ) {
# XXX Really needs a more helpful error message here
@@ -1210,7 +1224,7 @@
NO_PACKLIST
}
else {
- push @$bundle_inc, $lookup;
+ push @{ $prereq ? $bundle_inc_preload : $bundle_inc }, $lookup;
}
}
} # sub check_bundling
@@ -3592,7 +3606,7 @@
my $self = shift;
my $dist_inc = File::Spec->catdir( $self->dist_dir, 'inc' );
require inc::latest;
- inc::latest->write($dist_inc);
+ inc::latest->write($dist_inc, @{$self->bundle_inc_preload});
inc::latest->bundle_module($_, $dist_inc) for @{$self->bundle_inc};
return 1;
}