@@ -42,8 +42,7 @@ import Stack.Package
4242import Stack.PackageFile ( getPackageFile )
4343import Stack.Prelude
4444import Stack.Types.BuildOpts ( BuildOpts (.. ) )
45- import Stack.Types.BuildOptsCLI
46- ( ApplyCLIFlag (.. ), BuildOptsCLI (.. ) )
45+ import Stack.Types.BuildOptsCLI ( ApplyCLIFlag (.. ) )
4746import Stack.Types.Config ( Config (.. ), HasConfig (.. ), buildOptsL )
4847import Stack.Types.EnvConfig
4948 ( EnvConfig (.. ), HasEnvConfig (.. ), actualCompilerVersionL )
@@ -74,7 +73,11 @@ findFileTargets ::
7473 -- ^ All project packages
7574 -> [Path Abs File ]
7675 -- ^ File targets to find
77- -> RIO env (Map PackageName Target , Map PackageName [Path Abs File ], [Path Abs File ])
76+ -> RIO
77+ env
78+ ( Map PackageName Target
79+ , Maybe (Map PackageName [Path Abs File ], [Path Abs File ])
80+ )
7881findFileTargets locals fileTargets = do
7982 filePackages <- forM locals $ \ lp -> do
8083 PackageComponentFile _ compFiles _ _ <- getPackageFile lp. package lp. cabalFP
@@ -126,7 +129,7 @@ findFileTargets locals fileTargets = do
126129 foldl' (M. unionWith (<>) ) M. empty $
127130 map (\ (fp, (name, _)) -> M. singleton name [fp])
128131 associatedFiles
129- pure (targetMap, infoMap, extraFiles)
132+ pure (targetMap, Just ( infoMap, extraFiles) )
130133
131134-- | Yields all of the targets that are local, those that are directly wanted
132135-- and those that are extra dependencies to load.
@@ -175,23 +178,25 @@ getAllNonLocalTargets targets = do
175178-- v'GhciPkgDesc'.
176179loadGhciPkgDescs ::
177180 HasEnvConfig env
178- => BuildOptsCLI
181+ => Map ApplyCLIFlag (Map FlagName Bool )
182+ -- ^ Flags specified on the command line.
179183 -> [(PackageName , (Path Abs File , Target ))]
180184 -- ^ Local targets.
181185 -> RIO env [GhciPkgDesc ]
182- loadGhciPkgDescs buildOptsCLI localTargets =
186+ loadGhciPkgDescs cliFlags localTargets =
183187 forM localTargets $ \ (name, (cabalFP, target)) ->
184- loadGhciPkgDesc buildOptsCLI name cabalFP target
188+ loadGhciPkgDesc cliFlags name cabalFP target
185189
186190-- | Load package description information for a ghci target.
187191loadGhciPkgDesc ::
188192 HasEnvConfig env
189- => BuildOptsCLI
193+ => Map ApplyCLIFlag (Map FlagName Bool )
194+ -- ^ Flags specified on the command line.
190195 -> PackageName
191196 -> Path Abs File
192197 -> Target
193198 -> RIO env GhciPkgDesc
194- loadGhciPkgDesc buildOptsCLI name cabalFP target = do
199+ loadGhciPkgDesc cliFlags name cabalFP target = do
195200 econfig <- view envConfigL
196201 compilerVersion <- view actualCompilerVersionL
197202 let sm = econfig. sourceMap
@@ -242,7 +247,6 @@ loadGhciPkgDesc buildOptsCLI name cabalFP target = do
242247 , target
243248 }
244249 where
245- cliFlags = buildOptsCLI. flags
246250 -- | All CLI Cabal flags for a package.
247251 getCliFlags :: Map FlagName Bool
248252 getCliFlags = Map. unions
0 commit comments