pascalh / BnfcCabal

Creating cabal files for bnfc-generated modules
3 stars 1 forks source link

build-depends is not written in the .cabal generated file #3

Closed SantiMunin closed 9 years ago

SantiMunin commented 9 years ago

Hello,

I re-run the program with the newest changes. What I get is close to compile but some fields needs to be added (basically build-depends with base and array dependencies). Looking at the source code it should work, so I open this issue because I don't know how to fix it.

Generated file:

name: language-XXX
version: 0.1
cabal-version: -any
build-type: Simple
license: UnspecifiedLicense
extra-source-files:
    Language/XXX/ParXXX.y
    Language/XXX/LexXXX.x
exposed-modules:
    Language.XXX.ErrM
    Language.XXX.AbsXXX
    Language.XXX.ParXXX
    Language.XXX.PrintXXX
    Language.XXX.LexXXX
exposed: True
buildable: True
hs-source-dirs: .

Lines 123-127 has the required fields but they are not written then.

Thanks!

pascalh commented 9 years ago

It seems like the function writePackageDescription in cabal is broken or changed its behaviour in a newer version of cabal.

I tried to manually create a package description in ghci (loading the file Bnfc-cabal.hs) as follows

let config = Config [0,1] "bnfc" let pd = updatePd config "Haskell" emptyPackageDescription

Evaluating pd in ghci prints the correct package description (also containing the dependencies). When using the function writePackageDescription to write that very package description to a file, the dependencies are missing in the generated file: writePackageDescription "/tmp/fooooo.cabal" pd

The function writePackageDescription internally uses showPackageDescription, which causes the package dependecies to disappear.

I will ask the cabal developers whether this is a bug or they changed it on purpose.

pascalh commented 9 years ago

The global build depends attribute is depricated, hence I assigned the dependencies to the library.