Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Haskell.nix where possible #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

shajra
Copy link

@shajra shajra commented Dec 30, 2019

These three commits address issue #57. The main problem is that Haskell.nix builds packages one component at a time with Setup.hs directly, so

  • non-test components aren't available as LocalBuildInfo
  • intermediate build artifacts (like build/ or dist/) from non-test components aren't available.

Changes include:

  • making entries in Build_doctests for test components
  • excluding Build_doctests from module sources
  • including relative paths as well as absolute paths for "-i" flags.

At least one build system
[Haskell.nix](https://github.com/input-output-hk/haskell.nix) builds Haskell
projects a component at a time.  This breaks cabal-doctest's expected usage of
getting configuration from the Cabal components for libraries and executables
under test.

By recording flags for the test component, we introduce another possible usage
where all information we need comes from the test component alone.

See issue ulidtko#57 for more discussion and details.
We used to only get module sources from library and executable components.  So
the `Build_doctests` module wouldn't show up.  But for issue ulidtko#57 we're now
getting module sources for the test suites as well, and Cabal nags us with the
warning:

    <no location info>: warning: [-Wmissing-home-modules]
	These modules are needed for compilation but not listed in your .cabal
        file's other-modules:
            Build_doctests

So people are likely to follow the warning and put in Build_doctests into their
Cabal file, and then be annoyed that it breaks their tests.

Because `Build_doctests` is autogenerated by Cabal-doctests, we know it will
never have doctests itself, so it can be safely filtered out.
The main motivation of the commits for issue ulidtko#57 is to make it easier to use
Cabal-doctests with Haskell.nix.  Haskell.nix has built everything by the time
everything is run, so there are no intermediate directories around like `build/`
or `dist/`.

What Haskell.nix does instead is just make the original source available.  So it
seems convenient to include not just absolute paths, but relative paths as well.

Otherwise, we have to munge the "-i" flags after the fact.
@shajra
Copy link
Author

shajra commented Dec 31, 2019

@phadej I see you have your status set as busy, but I thought I'd leave a note here for when you're free.

I hope these commits is not so bad. I really tried to make the changes small and without impacting prior functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant