Detect when user changed .cabal file instead of package.yaml #3383
Comments
A nice way would be to write a checksum into the .cabal file itself (of everything after the header comment), and then compare it before overwriting. That way don't need to keep track of two files (especially if the .cabal file is checked into git in addition to the package.yaml). |
Here's the logic I'd recommend:
Does this seem reasonable to everyone? |
@snoyberg Makes sense! I think that this should be implemented in hpack itself. Marking this as P0 so that commercialhaskell/stack-templates#112 can be done sooner. If this ends up blocking release for too long, we can go ahead and ignore it. It might take a little while to add it to hpack and do a release of hpack. I will hopefully get around to it in the next few days, I have it on my TODO list. |
I hadn't thought about this being in hpack instead. That makes sense, but also makes it pretty difficult to list as a P0 issue, since we have no control over the hpack release schedule. In any event: CCing @sol. This issue is about the fact that a number of users have been tripped up by editing the generated cabal files instead of package.yaml files. We've put together a proposed solution above. How do you feel about including something like this in hpack? |
@snoyberg sounds sensible. I'm looking into it. |
As you guys want this as soon as possible, I implemented this based on the I did some refactoring first, the actual change in behavior is in |
That's much appreciated, thanks @sol! I'll try to look at this today and provide some feedback. |
This looks perfect, exactly what we were hoping for here. Thanks so much for doing this! What would you like from the Stack side before you're ready to make a release? |
@snoyberg I answered on sol/hpack#215. |
…al-changes Upgrade to hpack 0.20.0 (fixes #3383)
Use of
package.yaml
can be confusing when the user doesn't expect it - see #3380 . I think this case should somehow be detected and a noisy warning emitted.One way to do this might be to output a copy of the
*.cabal
on hpack generation. Then, when later re-generating, check if the cabal file changed since the last hpack generation. If so, then the user modified it and a noisy warning should be displayed.The text was updated successfully, but these errors were encountered: