005f0dae

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

Only instrument library components, not test-suites/exes/benches

Cabal's --ghc-option=-fplugin=... in Setup build's buildFlags applies
globally to every component compiled in that invocation. For packages
where addManifest wraps a package with both a library and a test-suite
(e.g. opt-env-conf-test), this caused the test-suite modules to be
instrumented too.

Fix: do a two-step build in addManifest's postBuild. Step 1 (main build
phase) scopes Setup build to lib:<pname> with the plugin flags; step 2
re-runs Setup build with the same flags but MUTATION_PLUGIN_SKIP=1, so
remaining components (test-suite, exe, bench) compile without
instrumentation. The plugin honours the env var. Same plugin flags are
required in step 2 to avoid Cabal seeing a package-set change and
rebuilding the already-instrumented library un-instrumented.

Also switch pluginRecompile from impurePlugin to flagRecompile so that
the second invocation does not force-recompile the library.