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

new-freeze: write with-compiler line to freeze file #4071

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions cabal-install/Distribution/Client/CmdFreeze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Distribution.PackageDescription
import Distribution.Client.Setup
( GlobalFlags, ConfigFlags(..), ConfigExFlags, InstallFlags )
import Distribution.Simple.Setup
( HaddockFlags, fromFlagOrDefault )
( HaddockFlags, fromFlagOrDefault, toFlag )
import Distribution.Simple.Utils
( die, notice )
import Distribution.Verbosity
Expand All @@ -47,6 +47,8 @@ import System.FilePath

import Distribution.Simple.Command
( CommandUI(..), usageAlternatives )
import Distribution.Simple.Compiler
( showCompilerId )
import Distribution.Simple.Utils
( wrapText )
import qualified Distribution.Client.Setup as Client
Expand Down Expand Up @@ -94,12 +96,12 @@ freezeAction (configFlags, configExFlags, installFlags, haddockFlags)
installFlags haddockFlags


(_, elaboratedPlan, _, _) <-
(_, elaboratedPlan, elaboratedSharedConfig, _) <-
rebuildInstallPlan verbosity
projectRootDir distDirLayout cabalDirLayout
cliConfig

let freezeConfig = projectFreezeConfig elaboratedPlan
let freezeConfig = projectFreezeConfig elaboratedPlan elaboratedSharedConfig
writeProjectLocalFreezeConfig projectRootDir freezeConfig
notice verbosity $
"Wrote freeze file: " ++ projectRootDir </> "cabal.project.freeze"
Expand All @@ -112,10 +114,12 @@ freezeAction (configFlags, configExFlags, installFlags, haddockFlags)
-- | Given the install plan, produce a config value with constraints that
-- freezes the versions of packages used in the plan.
--
projectFreezeConfig :: ElaboratedInstallPlan -> ProjectConfig
projectFreezeConfig elaboratedPlan =
projectFreezeConfig :: ElaboratedInstallPlan -> ElaboratedSharedConfig -> ProjectConfig
projectFreezeConfig elaboratedPlan elaboratedSharedConfig =
Monoid.mempty {
projectConfigShared = Monoid.mempty {
projectConfigHcPath =
toFlag (showCompilerId . pkgConfigCompiler $ elaboratedSharedConfig),
projectConfigConstraints =
concat (Map.elems (projectFreezeConstraints elaboratedPlan))
}
Expand Down