From 25567b215af6091d7042e3e77786461cc63047dd Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sat, 13 Jan 2024 23:17:07 +0000 Subject: [PATCH] Remove plan prefix from Plan field names --- src/Stack/Build.hs | 4 ++-- src/Stack/Build/ConstructPlan.hs | 24 ++++++++++++------------ src/Stack/Build/Execute.hs | 30 +++++++++++++++--------------- src/Stack/Types/Build.hs | 8 ++++---- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Stack/Build.hs b/src/Stack/Build.hs index 27217da323..023eaa1e0e 100644 --- a/src/Stack/Build.hs +++ b/src/Stack/Build.hs @@ -215,7 +215,7 @@ justLocals = map taskProvides . filter ((== Local) . taskLocation) . Map.elems . - (.planTasks) + (.tasks) checkCabalVersion :: HasEnvConfig env => RIO env () checkCabalVersion = do @@ -293,7 +293,7 @@ warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do exesToBuild = collect [ (exe, pkgName') - | (pkgName', task) <- Map.toList plan.planTasks + | (pkgName', task) <- Map.toList plan.tasks , TTLocalMutable lp <- [task.taskType] , exe <- (Set.toList . exeComponents . (.components)) lp ] diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs index 8231c2e4c8..9b468a5ba8 100644 --- a/src/Stack/Build/ConstructPlan.hs +++ b/src/Stack/Build/ConstructPlan.hs @@ -174,11 +174,11 @@ constructPlan then do let tasks = Map.fromList $ mapMaybe (toMaybe . second toTask) adrs takeSubset Plan - { planTasks = tasks - , planFinals = Map.fromList finals - , planUnregisterLocal = + { tasks = tasks + , finals = Map.fromList finals + , unregisterLocal = mkUnregisterLocal tasks dirtyReason localDumpPkgs initialBuildSteps - , planInstallExes = + , installExes = if baseConfigOpts0.bcoBuildOpts.installExes || baseConfigOpts0.bcoBuildOpts.installCompilerTool then installExes @@ -234,25 +234,25 @@ constructPlan -- | Strip out anything from the 'Plan' intended for the local database. stripLocals :: Plan -> RIO env Plan stripLocals plan = pure plan - { planTasks = Map.filter checkTask plan.planTasks - , planFinals = Map.empty - , planUnregisterLocal = Map.empty - , planInstallExes = Map.filter (/= Local) plan.planInstallExes + { tasks = Map.filter checkTask plan.tasks + , finals = Map.empty + , unregisterLocal = Map.empty + , installExes = Map.filter (/= Local) plan.installExes } where checkTask task = taskLocation task == Snap stripNonDeps :: Plan -> RIO env Plan stripNonDeps plan = pure plan - { planTasks = Map.filter checkTask plan.planTasks - , planFinals = Map.empty - , planInstallExes = Map.empty -- TODO maybe don't disable this? + { tasks = Map.filter checkTask plan.tasks + , finals = Map.empty + , installExes = Map.empty -- TODO maybe don't disable this? } where deps = Map.keysSet sourceDeps checkTask task = taskProvides task `Set.member` missingForDeps providesDep task = pkgName (taskProvides task) `Set.member` deps - tasks = Map.elems plan.planTasks + tasks = Map.elems plan.tasks missing = Map.fromList $ map (taskProvides &&& (.configOpts.missing)) tasks missingForDeps = flip execState mempty $ diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs index 4f99db0316..8f57f8aa69 100644 --- a/src/Stack/Build/Execute.hs +++ b/src/Stack/Build/Execute.hs @@ -101,7 +101,7 @@ preFetch plan <> mconcat (L.intersperse ", " (display <$> Set.toList pkgLocs)) fetchPackages pkgLocs where - pkgLocs = Set.unions $ map toPkgLoc $ Map.elems plan.planTasks + pkgLocs = Set.unions $ map toPkgLoc $ Map.elems plan.tasks toPkgLoc task = case task.taskType of @@ -111,7 +111,7 @@ preFetch plan -- | Print a description of build plan for human consumption. printPlan :: (HasRunner env, HasTerm env) => Plan -> RIO env () printPlan plan = do - case Map.elems plan.planUnregisterLocal of + case Map.elems plan.unregisterLocal of [] -> prettyInfo $ flow "No packages would be unregistered." <> line @@ -125,7 +125,7 @@ printPlan plan = do <> bulletedList (map unregisterMsg xs) <> line - case Map.elems plan.planTasks of + case Map.elems plan.tasks of [] -> prettyInfo $ flow "Nothing to build." <> line @@ -138,8 +138,8 @@ printPlan plan = do let hasTests = not . Set.null . testComponents . taskComponents hasBenches = not . Set.null . benchComponents . taskComponents - tests = Map.elems $ Map.filter hasTests plan.planFinals - benches = Map.elems $ Map.filter hasBenches plan.planFinals + tests = Map.elems $ Map.filter hasTests plan.finals + benches = Map.elems $ Map.filter hasBenches plan.finals unless (null tests) $ do prettyInfo $ @@ -155,7 +155,7 @@ printPlan plan = do <> bulletedList (map displayTask benches) <> line - case Map.toList plan.planInstallExes of + case Map.toList plan.installExes of [] -> prettyInfo $ flow "No executables to be installed." <> line @@ -238,7 +238,7 @@ executePlan mlargestPackageName (executePlan' installedMap targets plan) - copyExecutables plan.planInstallExes + copyExecutables plan.installExes config <- view configL menv' <- liftIO $ config.processContextSettings EnvSettings @@ -255,7 +255,7 @@ executePlan mlargestPackageName = Set.lookupMax $ Set.map (length . packageNameString) $ - Map.keysSet plan.planTasks <> Map.keysSet plan.planFinals + Map.keysSet plan.tasks <> Map.keysSet plan.finals copyExecutables :: HasEnvConfig env @@ -344,14 +344,14 @@ executePlan' :: HasEnvConfig env executePlan' installedMap0 targets plan ee = do when ee.buildOpts.testOpts.toCoverage deleteHpcReports cv <- view actualCompilerVersionL - case nonEmpty $ Map.toList plan.planUnregisterLocal of + case nonEmpty $ Map.toList plan.unregisterLocal of Nothing -> pure () Just ids -> do localDB <- packageDatabaseLocal unregisterPackages cv localDB ids liftIO $ atomically $ modifyTVar' ee.localDumpPkgs $ \initMap -> - foldl' (flip Map.delete) initMap $ Map.keys plan.planUnregisterLocal + foldl' (flip Map.delete) initMap $ Map.keys plan.unregisterLocal run <- askRunInIO @@ -367,11 +367,11 @@ executePlan' installedMap0 targets plan ee = do (Map.mapMissing (\_ b -> (Just b, Nothing))) (Map.mapMissing (\_ f -> (Nothing, Just f))) (Map.zipWithMatched (\_ b f -> (Just b, Just f))) - plan.planTasks - plan.planFinals + plan.tasks + plan.finals threads <- view $ configL . to (.jobs) let keepGoing = fromMaybe - (not (Map.null plan.planFinals)) + (not (Map.null plan.finals)) ee.buildOpts.keepGoing terminal <- view terminalL terminalWidth <- view termWidthL @@ -439,7 +439,7 @@ executePlan' installedMap0 targets plan ee = do let planPkgs, localPkgs, installedPkgs, availablePkgs :: Map PackageName (PackageIdentifier, InstallLocation) planPkgs = - Map.map (taskProvides &&& taskLocation) plan.planTasks + Map.map (taskProvides &&& taskLocation) plan.tasks localPkgs = Map.fromList [ (p.name, (packageIdentifier p, Local)) @@ -456,7 +456,7 @@ executePlan' installedMap0 targets plan ee = do installedMap' = Map.difference installedMap0 $ Map.fromList $ map (\(ident, _) -> (pkgName ident, ())) - $ Map.elems plan.planUnregisterLocal + $ Map.elems plan.unregisterLocal unregisterPackages :: (HasCompiler env, HasPlatform env, HasProcessContext env, HasTerm env) diff --git a/src/Stack/Types/Build.hs b/src/Stack/Types/Build.hs index c55bd75d13..510e378444 100644 --- a/src/Stack/Types/Build.hs +++ b/src/Stack/Types/Build.hs @@ -223,12 +223,12 @@ installLocationIsMutable Local = Mutable -- | A complete plan of what needs to be built and how to do it data Plan = Plan - { planTasks :: !(Map PackageName Task) - , planFinals :: !(Map PackageName Task) + { tasks :: !(Map PackageName Task) + , finals :: !(Map PackageName Task) -- ^ Final actions to be taken (test, benchmark, etc) - , planUnregisterLocal :: !(Map GhcPkgId (PackageIdentifier, Text)) + , unregisterLocal :: !(Map GhcPkgId (PackageIdentifier, Text)) -- ^ Text is reason we're unregistering, for display only - , planInstallExes :: !(Map Text InstallLocation) + , installExes :: !(Map Text InstallLocation) -- ^ Executables that should be installed after successful building } deriving Show