-
Notifications
You must be signed in to change notification settings - Fork 207
Add package to library component in package.yaml #1237
Conversation
c5cb9e0
to
dcc0518
Compare
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.
Other than the hieCommand
thing this LGTM!
Now addPackage will either add the package to all components the module is part of or only to the main "dependencies" object.
It seems that the tests fail for cabal files and ghc versions below 8.4.*. |
The problem can acutally be shown in the Unit-tests. Example .cabal: name: add-package-test
version: 0.1.0.0
license: BSD3
author: Luke Lau
maintainer: luke_lau@icloud.com
build-type: Simple
extra-source-files: ChangeLog.md
cabal-version: >=1.10
executable AddPackage
exposed-modules: ./.
main-is: AddPackage.hs
build-depends: base >=4.7 && <5
default-language: Haskell2010 Normally the result should be: List
[ TextEdit (Range (Position 0 0) (Position 7 27)) $ T.concat
[ "cabal-version: >=1.10\n"
, "name: add-package-test\n"
, "version: 0.1.0.0\n"
, "license: BSD3\n"
, "maintainer: [email protected]\n"
, "author: Luke Lau\n"
, "build-type: Simple\n"
, "extra-source-files:\n"
, " ChangeLog.md"
]
, TextEdit (Range (Position 10 0) (Position 13 34)) $ T.concat
[ " main-is: AddPackage.hs\n"
, " default-language: Haskell2010\n"
, " build-depends:\n"
, " base >=4.7 && <5,\n"
, " text -any"
]
] But on GHC 8.2.* the output is actually: List -- TODO: this seems to indicate that the command does nothing
[ TextEdit (Range (Position 0 0) (Position 7 27)) $ T.concat
[ "name: add-package-test\n"
, "version: 0.1.0.0\n"
, "cabal-version: >=1.10\n"
, "build-type: Simple\n"
, "license: BSD3\n"
, "maintainer: [email protected]\n"
, "author: Luke Lau\n"
, "extra-source-files:\n"
, " ChangeLog.md"
]
, TextEdit (Range (Position 9 0) (Position 13 34)) $ T.concat
[ "executable AddPackage\n"
, " main-is: AddPackage.hs\n"
]
] It seems like the |
I think, we can actually merge this. It adds a bunch of useful tests and the problem this PR uncovered is present anyway. At least, it will be documented via tests now. |
@fendor Please update this branch to work with current master, and we can merge it again. |
…ge-tests"" This reverts commit efe1660.
Revert "Revert "Merge pull request #1237 from fendor/add-package-tests""
Closes #1230.
Adds some unit-tests.
Todo: