Registering dependencies on auxiliary (non-scala) files

38 views
Skip to first unread message

Martin Duhem

unread,
Nov 26, 2014, 5:21:11 AM11/26/14
to sbt...@googlegroups.com, xen...@gmail.com
Hi !

I have been working on implementing a technique that would allow sbt to record dependencies on auxiliary files from macro-client.

The idea is to ask the author of the macro to attach to the expanded macro the list of the files that have been used to produce the expansion. Using this information, sbt would be able to invalidate macro-clients whenever a file used to produce a macro expansion is modified. This information would be given to sbt using a `java.util.HashMap[String, Any]` : The macro author would simply have to add a mapping from `touchedFiles` to a `List[java.io.File]` that contains the list of files that have been used to produce the expansion.

Please consult this scripted test for an example [1] of case where we encounter this kind of dependency.

The complete implementation can be found at [2] (it is based on #1736 [3]).

What do you think ?

The parts of this work that, I guess, may be the most surprising are :

 - [4] Since we do not know where auxiliary files are in general, there's no directory that we can scan and get them all. We only see them if the compiled file advertise them. Therefore, we may not see them at all for a while, even if they have not be deleted. Therefore, we need to pass them from a previous analysis to the next, because otherwise sbt would consider that they have been deleted.
 - [5] Adding a method `allAuxiliary` to `ReadStamps`. The methods of this kind (`allBinary`, ...) are all in the trait `Stamps` that extends `ReadStamps`. This method needs to be here because from method `changedInitial` in `IncrementalCommon.scala` we have an instance of `ReadStamps`. However, we need to check all the stamps on auxiliary dependencies to detect it if they have been changed.

Thank you for your comments !

Martin

Naftoli Gugenheim

unread,
Nov 26, 2014, 1:42:21 PM11/26/14
to sbt...@googlegroups.com, xen...@gmail.com
Good to hear --- this opens up a lot of possibilities! 

--
You received this message because you are subscribed to the Google Groups "sbt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbt-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbt-dev/e5402d03-9a60-4206-9441-a6bcfd6844bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages