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

22 files changed

+59
-56
lines changed

Diff for: src/Stack/Build.hs

+5-5
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))

Diff for: src/Stack/Build/ConstructPlan.hs

+2-2
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

Diff for: src/Stack/Build/Execute.hs

+1-1
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

Diff for: src/Stack/Build/ExecuteEnv.hs

+1-1
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

Diff for: src/Stack/Build/Haddock.hs

+4-4
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

Diff for: src/Stack/Build/Source.hs

+1-1
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

Diff for: src/Stack/Build/Target.hs

+3-3
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

Diff for: src/Stack/Clean.hs

+2-2
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

Diff for: src/Stack/Dot.hs

+4-3
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

Diff for: src/Stack/Ghci.hs

+12-12
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: " <>

Diff for: src/Stack/Init.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,8 @@ cabalPackagesCheck cabaldirs = do
671671
when (null cabaldirs) $
672672
prettyWarn $
673673
fillSep
674-
[ flow "Stack did not find any local package directories. You may \
675-
\want to create a package with"
674+
[ flow "Stack did not find any local directories containing a \
675+
\package description. You may want to create a package with"
676676
, style Shell (flow "stack new")
677677
, flow "instead."
678678
]

Diff for: src/Stack/Ls.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ data ListDepsTextFilter
131131
= FilterPackage PackageName
132132
-- ^ Item is a package name.
133133
| FilterLocals
134-
-- ^ Item represents all local packages.
134+
-- ^ Item represents all project packages.
135135

136136
-- | Type representing command line options for the @stack ls stack-colors@ and
137137
-- @stack ls stack-colours@ commands.

Diff for: src/Stack/Options/BuildMonoidParser.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,9 @@ buildOptsMonoidParser hide0 = BuildOptsMonoid
172172
hide
173173
forceDirty = firstBoolFlagsFalse
174174
"force-dirty"
175-
"forcing the treatment of all local packages as having dirty files. \
176-
\Useful for cases where Stack can't detect a file change."
175+
"forcing the treatment of all project packages and local extra-deps as \
176+
\having dirty files. Useful for cases where Stack can't detect a file \
177+
\change."
177178
hide
178179
tests = firstBoolFlagsFalse
179180
"test"

Diff for: src/Stack/SDist.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ sdistCmd sdistOpts =
186186
createDirectoryIfMissing True $ FP.takeDirectory targetTarPath
187187
copyFile (toFilePath tarPath) targetTarPath
188188

189-
-- | Given the path to a local package, creates its source distribution tarball.
189+
-- | Given the path to a package directory, creates a source distribution
190+
-- tarball for the package.
190191
--
191192
-- While this yields a 'FilePath', the name of the tarball, this tarball is not
192193
-- written to the disk and instead yielded as a lazy bytestring.
@@ -195,7 +196,7 @@ getSDistTarball ::
195196
=> Maybe PvpBounds
196197
-- ^ Override Config value
197198
-> Path Abs Dir
198-
-- ^ Path to local package
199+
-- ^ Path to package directory
199200
-> RIO
200201
env
201202
( FilePath

Diff for: src/Stack/Types/ApplyGhcOptions.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import Stack.Prelude
1010

1111
-- | Which packages do ghc-options on the command line apply to?
1212
data ApplyGhcOptions
13-
= AGOTargets -- ^ all local targets
14-
| AGOLocals -- ^ all local packages, even non-targets
15-
| AGOEverything -- ^ every package
13+
= AGOTargets -- ^ All project packages that are targets.
14+
| AGOLocals -- ^ All project packages, even non-targets.
15+
| AGOEverything -- ^ All packages, project packages and dependencies.
1616
deriving (Bounded, Enum, Eq, Ord, Read, Show)
1717

1818
instance FromJSON ApplyGhcOptions where

Diff for: src/Stack/Types/ApplyProgOptions.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import Stack.Prelude
1111
-- | Which packages do all and any --PROG-option options on the command line
1212
-- apply to?
1313
data ApplyProgOptions
14-
= APOTargets -- ^ All local packages that are targets.
15-
| APOLocals -- ^ All local packages (targets or otherwise).
16-
| APOEverything -- ^ All packages (local or otherwise).
14+
= APOTargets -- ^ All project packages that are targets.
15+
| APOLocals -- ^ All project packages (targets or otherwise).
16+
| APOEverything -- ^ All packages (project packages or dependencies).
1717
deriving (Bounded, Enum, Eq, Ord, Read, Show)
1818

1919
instance FromJSON ApplyProgOptions where

Diff for: src/Stack/Types/Build/ConstructPlan.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ instance HasCompiler Ctx where
236236
instance HasEnvConfig Ctx where
237237
envConfigL = lens (.ctxEnvConfig) (\x y -> x { ctxEnvConfig = y })
238238

239-
-- | State to be maintained during the calculation of local packages to
240-
-- unregister.
239+
-- | State to be maintained during the calculation of project packages and local
240+
-- extra-deps to unregister.
241241
data UnregisterState = UnregisterState
242242
{ toUnregister :: !(Map GhcPkgId (PackageIdentifier, Text))
243243
, toKeep :: ![DumpPackage]

Diff for: src/Stack/Types/Build/Exception.hs

+2-3
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,8 @@ pprintTargetParseErrors errs =
456456
, style Shell "my-package-0.1.2.3" <> "),"
457457
, flow "a package component (e.g."
458458
, style Shell "my-package:test:my-test-suite" <> "),"
459-
, flow "or, failing that, a relative path to a directory that is a \
460-
\local package directory or a parent directory of one or more \
461-
\local package directories."
459+
, flow "or, failing that, a relative path to a local directory for a \
460+
\package or a parent directory of one or more such directories."
462461
]
463462

464463
pprintExceptions ::

Diff for: src/Stack/Types/BuildOpts.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ data BuildOpts = BuildOpts
5252
, keepTmpFiles :: !Bool
5353
-- ^ Keep intermediate files and build directories
5454
, forceDirty :: !Bool
55-
-- ^ Force treating all local packages as having dirty files
55+
-- ^ Force treating all project packages and local extra-deps as having
56+
-- dirty files.
5657
, tests :: !Bool
5758
-- ^ Turn on tests for local targets
5859
, testOpts :: !TestOpts

Diff for: src/Stack/Types/EnvConfig.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ packageDatabaseDeps = do
231231
root <- installationRootDeps
232232
pure $ root </> relDirPkgdb
233233

234-
-- | Package database for installing local packages into
234+
-- | Package database for installing project packages and local extra-deps into.
235235
packageDatabaseLocal :: HasEnvConfig env => RIO env (Path Abs Dir)
236236
packageDatabaseLocal = do
237237
root <- installationRootLocal

Diff for: src/Stack/Types/EnvSettings.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Stack.Prelude
1313
-- | Controls which version of the environment is used
1414
data EnvSettings = EnvSettings
1515
{ includeLocals :: !Bool
16-
-- ^ include local project bin directory, GHC_PACKAGE_PATH, etc
16+
-- ^ include project's local bin directory, GHC_PACKAGE_PATH, etc
1717
, includeGhcPackagePath :: !Bool
1818
-- ^ include the GHC_PACKAGE_PATH variable
1919
, stackExe :: !Bool

Diff for: tests/integration/tests/cabal-sublibrary-dependency/Main.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Control.Monad (unless)
22
import Data.List (isInfixOf)
33
import StackTest
44

5-
-- This tests building two local packages, one of which depends on the other
5+
-- This tests building two project packages, one of which depends on the other
66
-- (subproject). The dependency has a library and a visible sub-library named
77
-- sub, each of which exposes a module that exports a function.
88

0 commit comments

Comments
 (0)