Skip to content

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

Closed
andreasabel wants to merge 1 commit into
haskell:masterfrom
andreasabel:master
Closed

andreasabel wants to merge 1 commit into
haskell:masterfrom
andreasabel:master

Conversation

@andreasabel

@andreasabel andreasabel commented Jan 19, 2021 •

Copy link
Copy Markdown
Member

[ 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
Copy Markdown
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

fgaz commented Jan 22, 2021

Copy link
Copy Markdown
Member

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

@fgaz

fgaz commented Jan 27, 2021

Copy link
Copy Markdown
Member

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
Copy Markdown
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

fgaz commented Feb 1, 2021

Copy link
Copy Markdown
Member

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

fgaz commented May 18, 2021 •

Copy link
Copy Markdown
Member

@emilypi does #7344 supersede this?

@emilypi

emilypi commented May 18, 2021 •

Copy link
Copy Markdown
Member

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

@emilypi emilypi mentioned this pull request May 18, 2021
11 tasks done
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