-
Notifications
You must be signed in to change notification settings - Fork 939
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
The "Generating files" HOWTO is broken for 0.13.0 #971
Comments
This was introduced in: |
Fix sbt#971. Note that this is no complete fix, because this solution uses an operator which is not any more described in the guide for 0.13.
The above fix uses <+= which is not currently explained by the docs. I also tried using value; however, the problem is that while I need to convert an implicit def macroValueI[T](in: Initialize[T]): MacroValue[T] = ???
implicit def macroValueIT[T](in: Initialize[Task[T]]): MacroValue[T] = ??? I guess I could disambiguate the call by invoking the implicit explicitly, but the implicit name is not part of the documented API, so it does not sound like a good idea. However, an ascription on the return value does not work: sourceGenerators in Compile <+= Def.task {
val file = (sourceManaged in Compile).value / "demo" / "Test.scala"
IO.write(file, """object Test extends App { println("Hi") }""")
Seq(file)
}
//Works
sourceGenerators in Compile += (Def.macroValueI(Def.task {
val file = (sourceManaged in Compile).value / "demo" / "Test.scala"
IO.write(file, """object Test extends App { println("Hi") }""")
Seq(file)
}).value: Task[Seq[File]])
//Also works
sourceGenerators in Compile += (Def.macroValueI(Def.task {
val file = (sourceManaged in Compile).value / "demo" / "Test.scala"
IO.write(file, """object Test extends App { println("Hi") }""")
Seq(file)
}).value)
//Doesn't work.
/*sourceGenerators in Compile += ((Def.task {
val file = (sourceManaged in Compile).value / "demo" / "Test.scala"
IO.write(file, """object Test extends App { println("Hi") }""")
Seq(file)
}).value: Task[Seq[File]])
*/ |
Your analysis is correct and sorry for the trouble. The underlying bug is #866. |
Fix #971. Note that this is no complete fix, because this solution uses an operator which is not any more described in the guide for 0.13.
Thanks for the prompt fix! |
No problem. It will be a bit delayed getting pushed to the site due to being in an RC cycle. |
Fix #971. Note that this is no complete fix, because this solution uses an operator which is not any more described in the guide for 0.13.
Fix #971. Note that this is no complete fix, because this solution uses an operator which is not any more described in the guide for 0.13. Conflicts: src/sphinx/Howto/generatefiles.rst
According to http://www.scala-sbt.org/0.13.0/docs/Howto/generatefiles.html:
But this simply doesn't work. It's obvious why when comparing with the 0.12.4 version, which gives:
Now, that's just not the kind of change which happened between 0.12 and 0.13. Edit: I spoke a bit too soon; you can replace <+= with += if the type on the right changes, and loses the
Initialize
part, but it's not the case here, probably because it's a setting containing a task.This is visible in the example. Example given for 0.12.4:
Example given for 0.13.0, but non-working:
After replacing
+=
with<+=
, we get a example that works:Error from the given 0.13.0 code (not very self-explanatory, I'd say):
I'd open a further bug saying "example code in documentation is not tested", but I don't know if you'd care and/or if the technology for fixing it exists.
The text was updated successfully, but these errors were encountered: