Skip to content

Commit 2892da7

Browse files
authored
Merge pull request commercialhaskell#6505 from commercialhaskell/re6492-2
Re commercialhaskell#6492 Further prefer 'project packages' to 'local packages'
2 parents 2adc11c + d007ba3 commit 2892da7

File tree

22 files changed

+59
-56
lines changed

22 files changed

+59
-56
lines changed

src/Stack/Build.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,11 @@ warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do
272272
| not (null otherLocals)
273273
]
274274
where
275-
-- Cases of several local packages having executables with the same name.
275+
-- Cases of several project packages having executables with the same name.
276276
-- The Map entries have the following form:
277277
--
278278
-- executable name: ( package names for executables that are being built
279-
-- , package names for other local packages that have an
279+
-- , package names for other project packages that have an
280280
-- executable with the same name
281281
-- )
282282
warnings :: Map Text ([PackageName],[PackageName])
@@ -285,16 +285,16 @@ warnIfExecutablesWithSameNameCouldBeOverwritten locals plan = do
285285
(\(pkgsToBuild, localPkgs) ->
286286
case (pkgsToBuild, NE.toList localPkgs \\ NE.toList pkgsToBuild) of
287287
(_ :| [], []) ->
288-
-- We want to build the executable of single local package
289-
-- and there are no other local packages with an executable of
288+
-- We want to build the executable of single project package
289+
-- and there are no other project packages with an executable of
290290
-- the same name. Nothing to warn about, ignore.
291291
Nothing
292292
(_, otherLocals) ->
293293
-- We could be here for two reasons (or their combination):
294294
-- 1) We are building two or more executables with the same
295295
-- name that will end up overwriting each other.
296296
-- 2) In addition to the executable(s) that we want to build
297-
-- there are other local packages with an executable of the
297+
-- there are other project packages with an executable of the
298298
-- same name that might get overwritten.
299299
-- Both cases warrant a warning.
300300
Just (NE.toList pkgsToBuild, otherLocals))

src/Stack/Build/ConstructPlan.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ import System.Environment ( lookupEnv )
9797
-- and the interdependencies among the build 'Task's. In particular:
9898
--
9999
-- 1) It determines which packages need to be built, based on the transitive
100-
-- deps of the current targets. For local packages, this is indicated by the
100+
-- deps of the current targets. For project packages, this is indicated by the
101101
-- 'lpWanted' boolean. For extra packages to build, this comes from the
102102
-- @extraToBuild0@ argument of type @Set PackageName@. These are usually
103103
-- packages that have been specified on the command line.
@@ -312,7 +312,7 @@ constructPlan
312312
pure $ pPackages <> deps
313313

314314
-- | Determine which packages to unregister based on the given tasks and
315-
-- already registered local packages.
315+
-- already registered project packages and local extra-deps.
316316
mkUnregisterLocal ::
317317
Map PackageName Task
318318
-- ^ Tasks

src/Stack/Build/Execute.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ executePlan :: HasEnvConfig env
210210
-> [LocalPackage]
211211
-> [DumpPackage] -- ^ global packages
212212
-> [DumpPackage] -- ^ snapshot packages
213-
-> [DumpPackage] -- ^ local packages
213+
-> [DumpPackage] -- ^ project packages and local extra-deps
214214
-> InstalledMap
215215
-> Map PackageName Target
216216
-> Plan

src/Stack/Build/ExecuteEnv.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ withExecuteEnv ::
251251
-> [LocalPackage]
252252
-> [DumpPackage] -- ^ global packages
253253
-> [DumpPackage] -- ^ snapshot packages
254-
-> [DumpPackage] -- ^ local packages
254+
-> [DumpPackage] -- ^ project packages and local extra-deps
255255
-> Maybe Int -- ^ largest package name, for nicer interleaved output
256256
-> (ExecuteEnv -> RIO env a)
257257
-> RIO env a

src/Stack/Build/Haddock.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ shouldHaddockPackage bopts wanted name =
116116
shouldHaddockDeps :: BuildOpts -> Bool
117117
shouldHaddockDeps bopts = fromMaybe bopts.buildHaddocks bopts.haddockDeps
118118

119-
-- | Generate Haddock index and contents for local packages.
119+
-- | Generate Haddock index and contents for project packages.
120120
generateLocalHaddockIndex ::
121121
(HasCompiler env, HasProcessContext env, HasTerm env)
122122
=> BaseConfigOpts
@@ -141,7 +141,7 @@ generateLocalHaddockIndex bco localDumpPkgs locals = do
141141
"."
142142
(localDocDir bco)
143143

144-
-- | Generate Haddock index and contents for local packages and their
144+
-- | Generate Haddock index and contents for project packages and their
145145
-- dependencies.
146146
generateDepsHaddockIndex ::
147147
(HasCompiler env, HasProcessContext env, HasTerm env)
@@ -319,11 +319,11 @@ lookupDumpPackage ghcPkgId dumpPkgs =
319319
haddockIndexFile :: Path Abs Dir -> Path Abs File
320320
haddockIndexFile destDir = destDir </> relFileIndexHtml
321321

322-
-- | Path of local packages documentation directory.
322+
-- | Path of project packages documentation directory.
323323
localDocDir :: BaseConfigOpts -> Path Abs Dir
324324
localDocDir bco = bco.localInstallRoot </> docDirSuffix
325325

326-
-- | Path of documentation directory for the dependencies of local packages
326+
-- | Path of documentation directory for the dependencies of project packages
327327
localDepsDocDir :: BaseConfigOpts -> Path Abs Dir
328328
localDepsDocDir bco = localDocDir bco </> relDirAll
329329

src/Stack/Build/Source.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ depPackageHashableContent dp =
209209
<> getUtf8Builder (mconcat ghcOptions)
210210
<> getUtf8Builder (mconcat cabalConfigOpts)
211211

212-
-- | All flags for a local package.
212+
-- | All flags for a project package.
213213
getLocalFlags ::
214214
BuildOptsCLI
215215
-> PackageName

src/Stack/Build/Target.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ parseRawTargetDirs root locals ri =
171171
[] -> pure $ Left $
172172
fillSep
173173
[ style Dir (fromString $ T.unpack t)
174-
, flow "is not a local package directory and it is not a \
175-
\parent directory of any local package directory."
174+
, flow "is not a local directory for a package and it is not a \
175+
\parent directory of any such directory."
176176
]
177177
names -> pure $ Right $ map ((ri, ) . RTPackage) names
178178
where
@@ -316,7 +316,7 @@ resolveRawTarget sma allLocs (rawInput, rt) =
316316
case Map.lookup name locals of
317317
Nothing -> pure $ Left $
318318
fillSep
319-
[ flow "Unknown local package:"
319+
[ flow "Unknown project package:"
320320
, style Target (fromPackageName name) <> "."
321321
]
322322
Just pp -> do

src/Stack/Clean.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ instance Exception CleanException where
4949
data CleanOpts
5050
= CleanShallow [PackageName]
5151
-- ^ Delete the "dist directories" as defined in
52-
-- 'Stack.Constants.Config.distRelativeDir' for the given local packages. If
53-
-- no packages are given, all project packages should be cleaned.
52+
-- 'Stack.Constants.Config.distRelativeDir' for the given project packages.
53+
-- If no project packages are given, all project packages should be cleaned.
5454
| CleanFull
5555
-- ^ Delete all work directories in the project.
5656

src/Stack/Dot.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ dotCmd dotOpts = do
2727
printGraph dotOpts localNames prunedGraph
2828

2929
-- | Print a graphviz graph of the edges in the Map and highlight the given
30-
-- local packages
30+
-- project packages
3131
printGraph ::
3232
(Applicative m, MonadIO m)
3333
=> DotOpts
34-
-> Set PackageName -- ^ all locals
34+
-> Set PackageName -- ^ All project packages.
3535
-> Map PackageName (Set PackageName, DotPayload)
3636
-> m ()
3737
printGraph dotOpts locals graph = do
@@ -44,7 +44,8 @@ printGraph dotOpts locals graph = do
4444
filteredLocals =
4545
Set.filter (\local' -> local' `Set.notMember` dotOpts.prune) locals
4646

47-
-- | Print the local nodes with a different style depending on options
47+
-- | Print the project packages nodes with a different style, depending on
48+
-- options
4849
printLocalNodes ::
4950
(F.Foldable t, MonadIO m)
5051
=> DotOpts

src/Stack/Ghci.hs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ ghciCmd ghciOpts =
219219
}
220220
local (set buildOptsL boptsLocal) (ghci ghciOpts)
221221

222-
-- | Launch a GHCi session for the given local package targets with the
223-
-- given options and configure it with the load paths and extensions
224-
-- of those targets.
222+
-- | Launch a GHCi session for the given project package targets with the given
223+
-- options and configure it with the load paths and extensions of those targets.
225224
ghci :: HasEnvConfig env => GhciOpts -> RIO env ()
226225
ghci opts = do
227226
let buildOptsCLI = defaultBuildOptsCLI
@@ -280,7 +279,7 @@ ghci opts = do
280279
case targets of
281280
TargetAll _ -> [T.pack (packageNameString pn)]
282281
TargetComps comps -> [renderPkgComponent (pn, c) | c <- toList comps]
283-
-- Build required dependencies and setup local packages.
282+
-- Build required dependencies and setup project packages.
284283
buildDepsAndInitialSteps opts $
285284
concatMap (\(pn, (_, t)) -> pkgTargets pn t) localTargets
286285
targetWarnings localTargets nonLocalTargets mfileTargets
@@ -472,11 +471,11 @@ getAllNonLocalTargets targets = do
472471
buildDepsAndInitialSteps :: HasEnvConfig env => GhciOpts -> [Text] -> RIO env ()
473472
buildDepsAndInitialSteps ghciOpts localTargets = do
474473
let targets = localTargets ++ map T.pack ghciOpts.additionalPackages
475-
-- If necessary, do the build, for local packagee targets, only do
474+
-- If necessary, do the build, for project packagee targets, only do
476475
-- 'initialBuildSteps'.
477476
whenJust (nonEmpty targets) $ \nonEmptyTargets ->
478477
unless ghciOpts.noBuild $ do
479-
-- only new local targets could appear here
478+
-- only new project package targets could appear here
480479
eres <- buildLocalTargets nonEmptyTargets
481480
case eres of
482481
Right () -> pure ()
@@ -1133,19 +1132,20 @@ targetWarnings localTargets nonLocalTargets mfileTargets = do
11331132
, parens $ fillSep $ punctuate "," $ map
11341133
(style Good . fromPackageName)
11351134
nonLocalTargets
1136-
, flow "are not local packages, and so cannot be directly loaded. In \
1135+
, flow "are not project packages, and so cannot be directly loaded. In \
11371136
\future versions of Stack, this might be supported - see"
1138-
, style Url "https://github.com/commercialhaskell/stack/issues/1441"
1139-
, "."
1137+
, style Url "https://github.com/commercialhaskell/stack/issues/1441" <> "."
11401138
, flow "It can still be useful to specify these, as they will be passed \
1141-
\to ghci via -package flags."
1139+
\to ghci via"
1140+
, style Shell "-package"
1141+
, "flags."
11421142
]
11431143
when (null localTargets && isNothing mfileTargets) $ do
11441144
smWanted <- view $ buildConfigL . to (.smWanted)
11451145
stackYaml <- view stackYamlL
11461146
prettyNote $ vsep
1147-
[ flow "No local targets specified, so a plain ghci will be started with \
1148-
\no package hiding or package options."
1147+
[ flow "No project package targets specified, so a plain ghci will be \
1148+
\started with no package hiding or package options."
11491149
, ""
11501150
, flow $ T.unpack $ utf8BuilderToText $
11511151
"You are using snapshot: " <>

0 commit comments

Comments
 (0)