sbt / util

util modules for sbt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Output Caching caches value from before effect function is called, not after

bpholt opened this issue · comments

In 0.13, the output value () ⇒ A1 function is called twice, including after the call to f: (Boolean, A1) => A2 (the function signature was (Boolean, I) ⇒ O in 0.13).

This changed in 1.x, so now the output value function p is only called once and assigned to a value.

val initial = p()
val help = new CacheHelp(cache)
val changed = help.changed(store, initial)
val result = f(changed, initial)
if (changed) {
help.save(store, initial)

This changes the behavior of the caching function. For example, files that did not exist prior to the call to f but were created by f are now cached as missing, where there would have been cached as created in 0.13. (I believe this is the root cause of sbt/sbt-assembly#289 and Dwolla/sbt-s3-publisher#11.)

I think I have a fix for the issue, but I'm having trouble using the locally built version of sbt to run scripted tests for sbt-assembly. (It seems to be using my local 1.2.0-SNAPSHOT version of sbt but with the 1.2.0-M2 version of the util-tracking jar, not the local one.) I'll probably push up a PR anyway, to try to move things forward.

Nice catch!

See https://github.com/sbt/sbt/blob/1.x/CONTRIBUTING.md#instruction-to-build-all-modules-from-source for building sbt from source.
You need to do something like:

sbt -Dsbtutil.path=../util

to bake sbt and util together.