-
Notifications
You must be signed in to change notification settings - Fork 723
Add 'SimplePackage' package type for cabal init
#5707
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
Conversation
This new 'PackageType' addresses the common use case of getting a package set up as quickly as possible without needing to go through the full interactive prompt. We move the 'getLibOrExec' prompt to the front of the list, and if 'SimpleProject' is selected we bypass the rest of the interactive prompt and use the defaults. This behaviour can also be invoked via: cabal init --simple Testing: - Manually tested
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-7.6.3" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-7.8.4" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-7.10.3" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.2.2" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.0.2" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.4.4" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.6.2" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.4.4-fdebug-expensive-assertions" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"osx-7.8.4" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"osx-7.10.3" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"osx-8.0.2" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-7.8.4" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-7.10.3" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-7.6.3" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.0.2" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.2.2" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.4.4" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.6.2" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"linux-8.4.4-fdebug-expensive-assertions" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"osx-7.8.4" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"osx-7.10.3" }
"url":"pull/5707", "account":"haskell", "repo":"cabal", "commit": "a109809d755bac83a0e43a6022a9e83263e79ea2", "tag":"osx-8.0.2" }
[ci skip]
|
/cc @byorgey |
|
Is this basically the same as running |
|
Currently it's Also, this provides a way of short circuiting the interactive prompt to give a nice default experience for beginners while only running |
|
Maybe make it a single yes/no choice before the package type choice then? Something like: "Should I just generate a simple project with sensible defaults or let you tweak the fine-grained settings? (yes/no)" . It's IMO a bit unclear what a "simple package" is and why one needs to choose between it and a lib/exe. Adding an option for generating a test suite/benchmark and "more modern defaults" sound like good ideas in general, I think all package types could benefit from that. |
|
@23Skidoo Updated, see PR description for new prompt. Also, to sync with updated master branch do you just do a merge or do you rebase on top of master? |
Since nonInteractive is set in the getSimpleProject step we don't need to re-check when selecting the main file.
|
Let me know if there's anything else you'd like me to change. I have some other improvements I'd like to make on top of this so if we could get this merged in soon that would be great :) |
|
Usually PRs are rebased to get rid of spurious merge commits. |
|
I ended up using GitHub's web merge tool, but good to know. This PR is ready for review/merge now. |
|
@23Skidoo the one CI failure |
|
Friendly ping :) |
23Skidoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
Merged, thanks! |
|
Thanks @23Skidoo for the review! There's some more |
Overview
Partially addresses #5696.
Implement's @gbaz's suggestion in #5696 (comment).
This new
PackageTypeaddresses the common use case of getting a package set up as quickly as possible without needing to go through the full interactive prompt. We move thegetLibOrExecprompt to the front of the list, and ifSimpleProjectis selected we bypass the rest of the interactive prompt and use the defaults.This behaviour can also be invoked via:
cabal init --simpleTesting
This change was manually tested, let me know if there's any automated testing for this you'd like me to update.
New
cabal initbehaviour:Documentation
--simpledocumented inDistribution.Client.SetupFollow-ups (out of scope of this PR)
getLibOrExec(such as usingsrc/dir for libraries andapp/dir forMain.hs, default to the most recent2.4cabal version, createcabal.projectfile, etc.)Please include the following checklist in your PR:
[ci skip]is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!
/cc @gbaz @23Skidoo @hvr