-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Macro implementation when using triggers is not working #1444
Comments
Minimal repro: // build.sbt
val hello = taskKey[Unit]("hello")
val world = taskKey[Unit]("world")
hello := println("hello")
world := println("world")
world := (world triggeredBy hello).value // prints "hello", should print "hello\nworld"
// world <<= world triggeredBy hello // works Run with |
It seems this issue is only incidentally related to the macro expansion. The code that is generated when this expression is expanded:
in the end happens to be similar to:
In the latter expression, the |
old logicIf we consider a task to consists of two parts, In that logic, world := (world triggeredBy hello).value is not much different from world := {
val x = (world triggeredBy hello).value
123
} or world := 123 Functor lawThe part that starts to break down is new ideas?Even though it's forgetful, focusing only on the value using One workaround might be to track triggers as a separate key: onComplete in hello += world This would move the trigger as if they are values, and at the end of the loading we can put them to the appropriate task attributes. |
Is there a workaround to this issue that will achieve the same behavior without triggering a deprecation warning in sbt? |
Fix triggeredBy/storeAs/etc using :=. Fixes #1444
This fix is not available on 0.13.x yet, right? |
It's available in 0.13.14-RC1. |
thanks, worked fine with that version :) |
Hi, this does not seem to be fixed for me: refreshBrowsers <<= refreshBrowsers.triggeredBy(WebKeys.assets in Assets) works, while refreshBrowsers := refreshBrowsers.triggeredBy(WebKeys.assets in Assets) does not.
Project source: https://github.com/woost/wust2/blob/dff8fdcdd13d39dfaf51e61b9ec251b99d1e619c/build.sbt#L232 Do you need more information? |
Did you miss '.value' intentionally in the code snippet that uses |
Good catch! That was not intentional, it works with It's strange though that I didn't get a compile error... |
It's because the expected |
Hi to all, I have tried with : compile in MultiJvm := ( compile in MultiJvm ).triggeredBy( compile in Test ).value instead of: compile in MultiJvm <<= ( compile in MultiJvm ) triggeredBy ( compile in Test ) But doesn't works |
Which sbt version? |
Sorry, 0.13.13 |
This thread says that the fix for |
Sorry, you're right. |
// Here is a snippet that might help those that
Within build.sbt
call doc
Thanks to all on thread for doing the hard work. |
This works:
however this doesn't:
The text was updated successfully, but these errors were encountered: