Skip to content

Commit

Permalink
Deprecate Dependencies class
Browse files Browse the repository at this point in the history
  • Loading branch information
Leont committed Feb 26, 2013
1 parent 7f8f247 commit 8a8a4f2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 111 deletions.
6 changes: 3 additions & 3 deletions lib/Build/Graph.pm
Expand Up @@ -54,7 +54,7 @@ $node_sorter = sub {
return if $seen->{$current}++;
my $node = $self->get_node($current) or Carp::croak("Node $current doesn't exist");
local $loop->{$current} = 1;
$self->$node_sorter($_, $callback, $seen, $loop) for $node->dependencies->all;
$self->$node_sorter($_, $callback, $seen, $loop) for $node->dependencies;
$callback->($current);
return;
};
Expand All @@ -80,13 +80,13 @@ my $run_node = sub {
return if $seen_phony->{$node_name}++;
}
else {
my @files = grep { !$self->get_node($_)->phony } sort $node->dependencies->all;
my @files = grep { !$self->get_node($_)->phony } sort $node->dependencies;
return if -e $node_name and not List::MoreUtils::any { $newer->($node_name, $_) } @files;
}
$node->make_dir($node_name) if $node->need_dir;
for my $action ($node->actions) {
my $callback = $self->commands->get($action->command) or Carp::croak("Command ${ \$action->command } doesn't exist");
$callback->($self->info_class->new(name => $node_name, arguments => $action->arguments, dependencies => $node->dependencies, %{$options}));
$callback->($self->info_class->new(name => $node_name, arguments => $action->arguments, dependencies => [ $node->dependencies ], %{$options}));
}
};

Expand Down
101 changes: 0 additions & 101 deletions lib/Build/Graph/Dependencies.pm

This file was deleted.

2 changes: 1 addition & 1 deletion lib/Build/Graph/Info.pm
Expand Up @@ -15,7 +15,7 @@ has arguments => (

has dependencies => (
is => 'ro',
isa => 'Build::Graph::Dependencies',
isa => 'ArrayRef',
required => 1,
);

Expand Down
15 changes: 9 additions & 6 deletions lib/Build/Graph/Node.pm
@@ -1,7 +1,6 @@
package Build::Graph::Node;
use Any::Moose;

use Build::Graph::Dependencies;
use Build::Graph::Action;

use File::Basename qw//;
Expand Down Expand Up @@ -32,11 +31,15 @@ sub make_dir {
return;
}

has dependencies => (
has _dependencies => (
is => 'ro',
isa => 'Build::Graph::Dependencies',
coerce => 1,
default => sub { Build::Graph::Dependencies->new },
isa => 'ArrayRef',
traits => ['Array'],
default => sub { [] },
init_arg => 'dependencies',
handles => {
dependencies => 'elements',
},
);

has actions => (
Expand All @@ -51,7 +54,7 @@ sub to_hashref {
my $self = shift;
return {
phony => $self->phony,
dependencies => $self->dependencies->to_hashref,
dependencies => $self->_dependencies,
actions => [ map { $_->to_hashref } $self->actions ],
$self->_has_need_dir_override ? (need_dir => $self->need_dir_override) : (),
};
Expand Down

0 comments on commit 8a8a4f2

Please sign in to comment.