sbt/sbt — pull request #1757 by Duhemm (2014-12-03 11:54:22+00:00)
Title: Registering dependencies on auxiliary (non-scala) files

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.

The scripted test gives an example of case where we encounter this kind of dependency.

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

- 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 advertises them. Therefore, we may not see them at all for a while, even if they have not be deleted. We need to pass them from a previous analysis to the next, because otherwise sbt would consider that they have been deleted.
- 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.

/cc @xeno-by