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

[ fix #7251 ] sort and nub module list inferred by cabal init --lib #7253

Closed
wants to merge 1 commit into from

Conversation

andreasabel
Copy link
Member

@andreasabel andreasabel commented Jan 19, 2021

[ fix #7251 ] sort and nub module list inferred by cabal init --lib

This should fix the problem that duplicate entries end up in exposed-modules, e.g. from Foo.x and Foo.hs (with alex as build-tool).

  • > Patches conform to the coding conventions.
  • > Any changes that could be relevant to users have been recorded in the changelog (add file to changelog.d directory).
    This fixes a broken behavior, shouldn't need mentioning.
  • > The documentation has been updated, if necessary.
    Ditto

Please also shortly describe how you tested your change. Bonus points for added tests!

Couldn't test yet because of #7251 (comment) :-(

TODO:

  • test
  • changelog

…--lib

This should fix the problem that duplicate entries end up in
exposed-modules, e.g. from Foo.x and Foo.hs (with alex as build-tool).
@andreasabel
Copy link
Member Author

Here is a test script now (using BNFC):

bnfc --version || cabal install BNFC
mkdir -p myparser
cd myparser
echo "Foo. Bar ::= Integer" > Foo.cf
bnfc -o src -d -m Foo.cf
make -C src
mv src/Foo/Test.hs Main.hs
cabal init --libandexe --application-dir=.
cabal build all
cat myparser.cabal

This will create a meaningful myparser.cabal except that the executable section does not have the necessary dependency on the library.

@fgaz
Copy link
Member

fgaz commented Jan 22, 2021

Having a test for this in cabal-testsuite would be good

@fgaz
Copy link
Member

fgaz commented Jan 27, 2021

This fixes a broken behavior, shouldn't need mentioning.

Bug fixes go in the changelog too, plus there's the sorting

Here's how the changelog.d works: https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#changelog

@andreasabel
Copy link
Member Author

Thanks for the feedback @fgaz!

  • Could you point me to a location where the new test should reside?
  • Is there maybe some documentation how to add a test?

@fgaz
Copy link
Member

fgaz commented Feb 1, 2021

The most straightforward way to test this is with a package test. You can add it in cabal-testsuite/PackageTests, where you can also find a readme and many examples. Check out the "Hermetic tests" section in particular, since you'll need it for this test

@fgaz
Copy link
Member

fgaz commented May 18, 2021

@emilypi does #7344 supersede this?

@emilypi
Copy link
Member

emilypi commented May 18, 2021

@fgaz yeah. We've fixed this in the omnibus.

@emilypi emilypi mentioned this pull request May 18, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cabal init --lib puts build-tools(happy, alex) generated modules twice into exposed-modules
3 participants