Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cabal new-clean #3835
This is my first major contribution to
The code for
I'm not sure if the flags for
I think that in the case of
Sorry, I don't understand this comment. Are you saying that I need to add hooks for
Or are you saying I need to change the way the
Maybe. That would be something like, running
Nope. The point is that some Custom setup scripts may drop build files in NOT dist-newstyle. Like a configure script might stick a header file somewhere random. A Custom clean would be able to remove the file, even if deleting dist isn't enough.
FWIW, I think custom clean is a mistake and if you want something cleaned put it in the dist directory. And it's a pain in the ass because you end up building the Setup script, JUST to run clean. That's no fun.
@RyanGlScott thanks for the contribution!
I agree with @ezyang that we probably want to approach it from afresh. One significant change with the new-* commands is that they mostly work at the level of a whole project, and only sometimes at individual package level.
So I think for new-clean the main thing we want to do is clean the whole project, which means rm -r'ing the dist-newstyle directory. That gets us 90% of the way there. Then there are some other bits and bobs. Package .cabal files can specify extra files to clean, and so those should be removed too.
The equivalent of
Whether or not we should run the "clean" hook of custom Setup scripts is a bit of an open question. It's rather annoying to have to compile a Setup script just so we can run clean, which 99% of the time does nothing more than rm the dist dir. What if we cannot configure the project or build the Setup scripts, does cleaning fail? I could be persuaded that clean being part of custom Setup is just a design flaw, and all generated files should live in dist except for those few listed in the extra clean files in the .cabal file.
So I'd focus on whole-project clean first. If we really want to later we could think about adding "clean, but only this bit, not everything", e.g `cabal clean ./" to mean this target (in the same way we have build targets). But that's a bonus not a necessity.