tweag / rules_haskell

Haskell rules for Bazel.
https://haskell.build
Apache License 2.0
266 stars 81 forks source link

haskell_doctest needs a better API #846

Open mboes opened 5 years ago

mboes commented 5 years ago

Is your feature request related to a problem? Please describe.

It is currently possible with haskell_doctest to test multiple Haskell targets at once, by providing several labels to its deps attribute. The problem is that haskell_doctest also supports restricting the set of modules we're testing via the modules attribute. Using that attribute makes sense when there is a single target to test, but does not when there are several.

There is another problem: the modules attribute should really be a srcs attribute, as noted in #845. But that would be confusing, because unlike other rules, we would have a srcs attribute listing a subset of the sources in deps, rather than a new set of srcs provided deps. So we need a different name or a different API altogether.

mboes commented 5 years ago

On further thought, I think we should simply deprecate the modules attribute. It's buggy and no replacement will work all that well. If we list source files instead, we'll have to ask users to list source files in their postprocessed name rather than their original name (e.g. Foo.hs instead of Foo.hsc). Besides, does anyone need to be able to restrict the scope of doctest? If so, for what reason?

cc @thumphries @guibou @regnat

thufschmitt commented 5 years ago

Tbh we've tried using the doctest rule but gave up because it behaves rather badly in general (In particular it's a build rule and not a test rule which is a bit silly − and I don't see how to easily change that). But for the use-case we had there was absolutely no point in restricting its scope indeed.