summaryrefslogtreecommitdiff
path: root/lib/WebCoso/Maker.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WebCoso/Maker.pm')
-rw-r--r--lib/WebCoso/Maker.pm42
1 files changed, 35 insertions, 7 deletions
diff --git a/lib/WebCoso/Maker.pm b/lib/WebCoso/Maker.pm
index 5aae4f8..d5436df 100644
--- a/lib/WebCoso/Maker.pm
+++ b/lib/WebCoso/Maker.pm
@@ -4,16 +4,44 @@ role WebCoso::Maker[$from,$to] {
has $.basename;
has $.dir;
- method process-contents($from-contents) { ... }
+ method process-contents(:$src,:@deps) { ... }
+
+ method dest-files() {
+ say "Maker[$from,$to]($.dir/$.basename)::dest-files";
+ return $.wc.get-files($.dir,$.basename,$to,:!make);
+ }
+
+ method src-files() {
+ say "Maker[$from,$to]($.dir/$.basename)::src-files";
+ return $.wc.get-files($.dir,$.basename,$from);
+ }
+
+ method dep-files() {
+ return Hash;
+ }
+
+ method make() {
+ say "Maker[$from,$to]($.dir/$.basename)::make";
+ my %srcs = $.src-files();
+ my %dsts = $.dest-files();
+ my %deps = $.dep-files();
+
+ say "Maker[$from,$to]($.dir/$.basename)::make from {%srcs.perl} and {%deps.perl} to {%dsts.perl}";
- method get-files() {
- my %srcs = $.wc.get-files($.dir,$.basename,$from);
- my %dsts = $.wc.get-files($.dir,$.basename,$to);
for %srcs.keys -> $lang {
my $src = %srcs{$lang};
- next if %dsts{$lang} and
- %dsts{$lang}.modified after $src.modified;
- my $processed-contents = self.process-contents($src.slurp);
+ my $dst = %dsts{$lang};
+ my @deps = %deps{$lang} // ();
+ say "Maker[$from,$to]($.dir/$.basename)::make lang $lang";
+ next if $dst and $dst.modified after
+ all($src.modified,@depsĀ».modified.flat);
+
+ say "Maker[$from,$to]($.dir/$.basename)::make processing $lang";
+ my $processed-contents = self.process-contents(
+ src => $src.slurp,
+ deps => @depsĀ».slurp,
+ );
+
%dsts{$lang} = $.wc.put-file($.dir,$.basename,$lang,$to,
$processed-contents)
}