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

Choosing library in init dialogue still creates exe dir #6772

Closed
emilypi opened this issue May 10, 2020 · 2 comments
Closed

Choosing library in init dialogue still creates exe dir #6772

emilypi opened this issue May 10, 2020 · 2 comments

Comments

@emilypi
Copy link
Member

emilypi commented May 10, 2020

Describe the bug
Choosing the "library" option in the interactive init script still produces a exe directory

To Reproduce
Follow the init steps for a new library. Example:

λ П(a: A) haskell → mkdir foo
λ П(a: A) haskell → cd foo
λ П(a: A) foo → cabal init
Should I generate a simple project with sensible defaults? [default: y] n
What does the package build:
   1) Executable
   2) Library
   3) Library and Executable
Your choice? 2
Package name? foo
This package name is already used by another package on hackage. Do you want to choose a different name? [default: y] n
Package version? [default: 0.1.0.0] 
Author name? [default: Emily Pillmore] 
Maintainer email? [default: emilypi@cohomolo.gy] 
Project homepage URL? 
Project synopsis? 
Project category:
 * 1) (none)
   2) Codec
   3) Concurrency
   4) Control
   5) Data
   6) Database
   7) Development
   8) Distribution
   9) Game
  10) Graphics
  11) Language
  12) Math
  13) Network
  14) Sound
  15) System
  16) Testing
  17) Text
  18) Web
  19) Other (specify)
Your choice? [default: (none)] 
Add informative comments to each field in the cabal file (y/n)? [default: n] n

Guessing dependencies...

Generating LICENSE...
Generating Setup.hs...
Generating CHANGELOG.md...
Generating src/MyLib.hs...
Generating test/MyLibTest.hs...
Generating foo.cabal...

Warning: no synopsis given. You should edit the .cabal file and add one.
You may want to edit the .cabal file and add a Description field.
λ П(a: A) foo → ls -l
total 32
-rw-r--r--  1 emilypi  staff   106 May 10 01:53 CHANGELOG.md
-rw-r--r--  1 emilypi  staff  1526 May 10 01:53 LICENSE
-rw-r--r--  1 emilypi  staff    46 May 10 01:53 Setup.hs
drwxr-xr-x  2 emilypi  staff    64 May 10 01:53 exe
-rw-r--r--  1 emilypi  staff   854 May 10 01:53 foo.cabal
drwxr-xr-x  3 emilypi  staff    96 May 10 01:53 src
drwxr-xr-x  3 emilypi  staff    96 May 10 01:53 test
λ П(a: A) foo → 

Expected behavior
Shouldn't do that.

System information

  • Mac
  • Cabal 3.2
  • GHC 8.10.1
@m-renaud
Copy link
Collaborator

Confirmed this is also an issue on Linux.

This appears to be a poor interaction with setting a default application-dir in the cabal config file (or if you explicitly specify --application-dir=exe from the command line). The following produces the same results:

$ mkdir foo
$ cd foo
$ cabal init --non-interactive --lib --application-dir=exe
$ ls
CHANGELOG.md  exe  MyLib.hs  Setup.hs

It-Is-Jeremy pushed a commit to It-Is-Jeremy/cabal that referenced this issue Oct 8, 2020
Added a statement in getAppDir function for if the package type
is Library, then return Just [] to appDirs else perform normal
return function.

Removed noAppDirIfLibrary function as the new if statement
handles the Library type.

Resolves: haskell#6772
@emilypi
Copy link
Member Author

emilypi commented May 19, 2021

Closed via #7262

@emilypi emilypi closed this as completed May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants