livingsocial / rake-pipeline

An extension to Rake for dealing with a directory of inputs, a number of filters, and a directory of outputs
MIT License
276 stars 38 forks source link

Dynamic tasks make simple pipelines re-compile on subsequent runs #93

Closed svenfuchs closed 12 years ago

svenfuchs commented 12 years ago

I'm seeing stuff like this:

# with the following pipelines calling `rakep` repeatedly will re-generate output for both coffee_script 
# and minispade for all matched files over and over.
#
# when using just either the coffee_script or minispade pipeline `rakep` will only generate files once
# on repeated executions.

require 'rake-pipeline-web-filters'

output 'public/scripts'
input 'assets/scripts' do
  match '**/*.coffee' do
    coffee_script
  end

  match '**/*.js' do
    modules = proc { |input| input.path.gsub(%r((^app/|lib/|\.js$)), '') }
    minispade(string: true, rewrite_requires: true, module_id_generator: modules)
  end
end

and

# also, this compiles handlebars only once, as expected:

output 'public/scripts'
input 'assets/scripts' do
  match '**/*.hbs' do
    keyname = proc { |input| input.path.sub(%r(^app/templates/), '').sub(/\.hbs$/, '') }
    handlebars(:key_name_proc => keyname)
  end

  match '**/*.hbs' do
    concat 'templates.js'
  end
end

# while this, again, will compile handlebars over and over:

output 'public/scripts'
input 'assets/scripts' do
  match '**/*.hbs' do
    keyname = proc { |input| input.path.sub(%r(^app/templates/), '').sub(/\.hbs$/, '') }
    handlebars(:key_name_proc => keyname)
    concat 'templates.js'
  end
end

When downgrading to 3465e0e3e1 it seems to go away.

ahawkins commented 12 years ago

The first examples has 2 pipelines (one to generate and another to concatenate). The second pipeline has N inputs to 1 output. (generation and concatenation all happen in the same pipeline). The issue may because by how we think caching/dirty tracking should work. @wycats: Does dirty tracking only happen at the pipeline level or does it work at the filter level as well? I'm asking because if you look at the two pipelines as a block box, in order to generate a correct output for the N -> 1 you'd have to recompile the pipeline each time any of the N files changed (as rakep doesn't have any idea what's actually happening inside the pipeline).

wagenet commented 12 years ago

@twinturbo Is this still an issue?

ahawkins commented 12 years ago

@wagenet no it covered in the tests. You can close this one too.

ahawkins commented 12 years ago

@svenfuchs #117 fixes all this stuff. Have you had a change to test against current master?

svenfuchs commented 12 years ago

not yet, sorry :/ heavily involved in other stuff these days

but i think @drogus has updated our rake-pipeline version and might have some feedback?

wagenet commented 12 years ago

Assuming this is fixed by #117 then. If there are still issues, let us know.