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

cabal clean ignored #1890

Open
deech opened this issue Mar 9, 2016 · 5 comments
Open

cabal clean ignored #1890

deech opened this issue Mar 9, 2016 · 5 comments

Comments

@deech
Copy link
Contributor

deech commented Mar 9, 2016

I have a cleanHook function that deletes some extra files. It runs fine when I do cabal clean but not stack clean. If this isn't a known bug I'll work up a small example.

@mgsloan
Copy link
Contributor

mgsloan commented Mar 9, 2016

This is because stack clean does not even invoke cabal, it just blows away the dist dir. How about putting your extra files in the dist dir, which is probably where they belong?

We could have it invoke Setup.hs for custom build types. I'm not sure if this case was considered when stack clean was implemented. There may be a reason we are avoiding using cabal's clean. Feel free to open a PR implementing this, it has good chances of getting merged. Particularly if it avoids any extra overhead for simple build types.

I do not consider this a bug, as it is not a goal of stack to support every aspect of Custom build types, as that would be prohibitively restrictive and complicated.

SideNote: I'd prefer that we move away from the Custom build type, it causes a ton of extra complication and generally has an ill-designed hooks system (e.g. having both preCopy and preInstall, and not running preCopy hooks during install). Ezyang created an interesting issue about lessons learned from the custom build type - haskell/cabal#3065 .

Wouldn't it be crazy if to use hooks with git, you had to compile something that links in git and uses your hooks? That's the kind of situation we have with Cabal...

I think we should consider adding a simple hook system to stack, which avoids these problems by directly using stack's CLI for information query and mutation. This way we can have hooks that are independent of stack version and even write them in languages other than Haskell (like bash! hah)

@mgsloan mgsloan added this to the P3: Optional milestone Mar 9, 2016
@mgsloan
Copy link
Contributor

mgsloan commented Mar 9, 2016

I noticed that cabal does have a extra-tmp-files list. Would having stack support that be sufficient for your usecase? (it currently doesn't, but it'd be more straightforward than invoking cabal clean)

@deech
Copy link
Contributor Author

deech commented Mar 10, 2016

Possibly. The wrinkle is that the files are generated by the cabal build step, so if stack will not build because the files don't exist before the build step that wouldn't help my particular use-case. In general though this seems a good idea.

@mgsloan
Copy link
Contributor

mgsloan commented Mar 10, 2016

Oh yeah, we definitely wouldn't require that the extra-tmp-files exist.

@deech
Copy link
Contributor Author

deech commented Mar 10, 2016

Also in my case part of the build step is delegated to make so the clean step also invokes make clean. There was talk on another issue about having hooks that run arbitrary code. The *hooks part of the Cabal's design came in very handy for my project.

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