Skip to content

Commit f70fc98

Browse files
committed
Refactor ProjectBuilding into Package Phases
This refactor of Distribution.Client.ProjectBuilding does the following: * Moves package file monitoring logic to Distribution.Client.ProjectBuilding.PackageFileMonitor * Moves the `buildInplaceUnpackedPackage` and `buildAndInstallUnpackedPackage` with auxiliary functions to Distribution.Client.ProjectBuilding.UnpackedPackage * Refactors the common bits of `buildInplaceUnpackedPackage` and `buildAndInstallUnpackedPackage` to remove considerable code duplication while simplifying and making both functions more structured. Namely, to better structure build inplace vs build and install, I've introduced: * `PackageBuildingPhase` describes the various phases of processing the unpacked package both inplace and on install * Configure * Build * Install (copy + register) * Test * Bench * Repl * Haddock * Then, `buildAndRegisterUnpackedPackage` implements the common logic between the two functions (such as calls to ./Setup and the order of the phases) but delegates the logic specific to each phase to an argument function which maps `PackageBuildingPhase` to `IO` actions. * Now, build inplace and build and install functions are comprised as: * A wrapper around `buildAndRegisterUnpackedPackage` which does things specific to each before and after the main phases are processed * A delegate function which maps an action to each package processing phase Fixes #9499
1 parent 49e3d18 commit f70fc98

File tree

4 files changed

+1224
-1061
lines changed

4 files changed

+1224
-1061
lines changed

cabal-install/cabal-install.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ library
154154
Distribution.Client.PackageHash
155155
Distribution.Client.ParseUtils
156156
Distribution.Client.ProjectBuilding
157+
Distribution.Client.ProjectBuilding.UnpackedPackage
158+
Distribution.Client.ProjectBuilding.PackageFileMonitor
157159
Distribution.Client.ProjectBuilding.Types
158160
Distribution.Client.ProjectConfig
159161
Distribution.Client.ProjectConfig.Legacy

0 commit comments

Comments
 (0)