haskell / haskell/cabal

cabal v2-clean does not run pre or postClean nor use the field extra-tmp-files.

Open
#6,112 5 comments 0 reactions 1 assignee Claimed by @typedrat View on GitHub
cabal-install: cmd/clean cabal-install: v2-build system Cabal: hooks type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
For cabal 2.4.1.0, cabal v2-clean does not execute the preClean nor the postClean hooks whereas cabal v1-clean does execute them. Also, cabal v2-clean does not use the field extra-tmp-files in the project.cabal file whereas cabal v1-clean does use it to remove temporary files.

Note that cabal v2-build and cabal v1-build both execute the preBuild and postBuild hooks.

**To Reproduce**
Setup.hs:
> main = defaultMainWithHooks simpleUserHooks
> {preBuild = do { putStrLn "My preBuild"; return emptyHookedBuildInfo}
> ,postBuild = putStrLn "My postBuild"
> ,preClean = do { putStrLn "My preClean"; return emptyHookedBuildInfo}
> ,postClean = putStrLn "My postClean"
> }

project.cabal:
> extra-tmp-files:
> aTmpFileToRemoveOnClean

Essentially, cabal v1-build and cabal v2-build will both print "My preBuild" and "My postBuild" whereas cabal v1-clean will print "My preClean" and "My postClean" but cabal v2-clean will not print these two messages. Finally, cabal v1-clean will remove "aTmpFileToRemoveOnClean" but cabal v2-clean will not remove the file.

**Expected behavior**
I expect cabal v2-clean to execute the preClean and postClean hooks and to use the field
extra-tmp-files of the package.cabal file as does cabal v1-clean. If this is not the goal for v2, then I need a procedure to clean up after a cabal v2-build with cabal v2-clean.

**System informataion**
- Operating system
Ubuntu 16.04.6 LTS (Xenial Xerus)
- `cabal`, `ghc` versions
$ cabal --version
cabal-install version 2.4.1.0
compiled using version 2.4.1.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5

**Additional context**
The issue was discovered with a cabal package that I am creating that uses `bnfc --haskell` via the hookedPreProcessors record.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.