remake icon indicating copy to clipboard operation
remake copied to clipboard

Fake targets do not propagate downstream rebuilds in simple example.

Open wlandau opened this issue 9 years ago • 2 comments

In this example, I have code.R

my_mtcars = function(){
  data(mtcars)
  mtcars
}

my_random = function(){
  data.frame(y = rnorm(31))
}

my_plot = function(mtcars, random){
  plot(mtcars$mpg, random$y)
}

and remake.yml.

sources: code.R

targets:

  all:
    depends: report.md

  report.md:
    knitr: TRUE
    depends: datasets

  datasets:
    depends:
      - mtcars
      - random

  mtcars:
    command: my_mtcars()

  random:
    command: my_random()

I want to use the datasets fake target instead of having to write mtcars and random individually. My first problem is that random is not automatically loaded into my knitr report report.Rmd below, but that's another story.

head(mtcars)
# head(random) # Error in head(random) : object 'random' not found

The first time I run the project, everything looks fine.

> remake::make()
<  MAKE > all
[ BUILD ] mtcars    |  mtcars <- my_mtcars()
[ BUILD ] random    |  random <- my_random()
[ ----- ] datasets
[  KNIT ] report.md |  knitr::knit("report.Rmd", "report.md")
[ ----- ] all

But when I change the contents of my_mtcars() and run the project again, the report is not re-knitted.

> make()
[  READ ]           |  # loading sources
<  MAKE > all
[ BUILD ] mtcars    |  mtcars <- my_mtcars()
[    OK ] random
[ ----- ] datasets
[    OK ] report.md
[ ----- ] all
> 

Since GNU Make uses timestamps, this issue is unavoidable with traditional phony targets. But with remake's hashing system, it seems possible to allow downstream rebuilds to be triggered through fake targets.

wlandau avatar Jul 16 '16 03:07 wlandau

On the other hand, in one of my large remake projects, including all the explicit true dependencies in addition to the "fake" ones seriously slows down the compilation of the reports. So I don't actually know the right thing to do.

wlandau avatar Jul 16 '16 04:07 wlandau

Thanks, and apologies for the slow replies on all the remake issues you've been finding. I do hope to get to do some serious remake work after the summer.

richfitz avatar Jul 22 '16 09:07 richfitz