jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

Jake dependencies from rules #249

Closed veldsla closed 10 years ago

veldsla commented 10 years ago

Having briefly looked at Rake, but preferring JavaScript I'm getting my feet wet with Jake. So it might be that I'm misinterpreting, but I'm seeing odd behavior when I run multiple Jake dependencies that are fulfilled with a rule.

This is my Jakefile:

rule(".next", ".txt", {async: true}, function() {
    var info = this.name;
    jake.exec("cp " +  this.source + ' ' + this.name, function() {
        console.log("Created", info);
        complete();
    });
});

task("all", ['a.next', 'b.next','c.next'], function() {
    console.log("all done");
});

If I understand correctly the task 'all' depends on the three files but not in any order. I ran the following commands in the shell and this is the output:

$ touch a.txt b.txt c.txt
$ jake all
Created a.next
Created b.next
Created c.next
all done

$ jake all
all done

$ touch b.txt
$ jake all
Created b.next
Created c.next
all done

$ jake all
all done

$ touch a.txt
$ jake all
Created a.next
Created b.next
Created c.next
all done

So if it appears that if a single dependency in the array needs to be updated all dependencies after that one also get rebuilt.

mde commented 10 years ago

Excellent catch. This was a result of prototype pollution in the prereqs. I have a fix for this, but there's some collateral damage in the tests I have to fix before I can push it out.

mde commented 10 years ago

Thanks again for catching this. Fix pushed to NPM, v0.7.12.