Skip to content

Commit

Permalink
Include ./lib in @inc when running dzil build if the distro starts wi…
Browse files Browse the repository at this point in the history
…th Dist-Zilla

I would assume that any dzil bundle or plugin distro wants to use itself
during building.
  • Loading branch information
autarch committed Jan 8, 2021
1 parent 4883730 commit 2b33cbf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.9 2021-01-08

* If the distro name starts with "Dist-Zilla", then the distro's lib dir will
be included in `@INC` (via `dzil -I lib`) when running `dzil build.


## 0.1.8 2021-01-08

* If a distro has a script named `dev-bin/install-xt-tools.sh` we now run this
Expand Down
12 changes: 12 additions & 0 deletions tools/lib/T/BuildDist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ sub run {
sub _build_dzil {
my $self = shift;

my $content = path('dist.ini')->slurp_utf8;
my ($distro) = $content =~ /name\s*=\s*(\S+)/;

my @i;

# This assumes that any dzil-related module will use itself during dzil
# build.
if ( $distro && $distro =~ /\ADist-Zilla/ ) {
@i = ( '-I', 'lib' );
}

# The working dir might be something like '~/project` and pushd can't
# handle the '~', apparently.
my $dir = $self->_pushd( $self->checkout_dir );
Expand All @@ -57,6 +68,7 @@ sub _build_dzil {
$self->_system(
$self->_brewed_perl( $self->tools_perl ),
$self->_perl_local_script( $self->tools_perl, 'dzil' ),
@i,
'build',
);
},
Expand Down

0 comments on commit 2b33cbf

Please sign in to comment.