Skip to content

The discover pragma seems to always include project root (esp. Setup.hs) #93

@konn

Description

@konn

Summary

The recent versions of cabal-gild discovers modules not only in DIRECTORY but also in ..
In particular, we need --exclude=Setup.hs to avoid cabal's Setup module is wrongly included.

Version Info

  • cabal-gild-1.5.0.0
  • macOS Sonoma 14.5
  • MacBook Pro with Apple M3 Pro chip

Reproduction Procedure

Suppose we have the project with the following structure:

  • /gild-setup.cabal with the following content:

    cabal-version: 2.2
    name: gild-setup
    version: 0.1.0.0
    homepage: https://github.com/konn/gild-setup#readme
    author: Hiromi ISHII
    maintainer: konn.jinro_at_gmail.com
    copyright: 2024 (c) Hiromi ISHII
    category: Web
    build-type: Simple
    
    library
      hs-source-dirs: src
      -- cabal-gild: discover src
      exposed-modules:
      build-depends: base >=4.7 && <5
  • Setup.hs:

    import Distribution.Simple
    main = defaultMain
  • src/Lib.hs

    module Lib () where

Then, in the project root, run:

cabal-gild --io gild-setup.cabal

Expected behaviour

The field exposed-modules must be expanded to:

  -- cabal-gild: discover src
  exposed-modules: Lib

Actual behaviour

It contains Setup too:

  -- cabal-gild: discover src
  exposed-modules:
    Lib
    Setup

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions