a358f54b

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Split the test artifacts into an output of their own

includeTests decided what got compiled, so a repository that wanted the
test artifacts for something else had to compile everything a second
time to get them: weeder must not be shown the test code, because code
only a test uses is a weed and a test suite in the graph makes
well-tested dead code look alive.

The artifacts now land in two outputs, hie for the library and the
executables and hieTests for the test suites and the benchmarks, so what
is built and what weeder is shown are separate questions.  includeTests
is the second one, and buildTests is the first, defaulting to it so that
a repository whose only use of this build is weeder pays exactly what it
did.

Which components are tests comes from the stanzas that declare them,
because cabal names each component's build directory after its stanza and
the keyword is the only place the kind is written down: an executable's
build directory and a test suite's are the same shape.

The collection is a walk rather than an rsync, which is what the TODO
here asked for, and it keeps one directory per component and the .hi
interface beside each .hie.  Per component because every component with
a main-is declares a module called Main, and a merged tree would leave
one Main.hie standing for all of them.  Rooted at the module's own path
so A.B.C is at A/B/C.hie, which is how a module is looked up, and with
the interfaces so a reader can also ask what a module declares.