@@ -89,15 +89,15 @@ import Stack.Types.SourceMap ( smRelDir )
89
89
import System.PosixCompat.Files
90
90
( getFileStatus , modificationTime , setFileTimes )
91
91
92
- -- | Directory containing files to mark an executable as installed
92
+ -- | Directory containing files to mark an executable as installed.
93
93
exeInstalledDir ::
94
94
(HasEnvConfig env )
95
95
=> InstallLocation
96
96
-> RIO env (Path Abs Dir )
97
97
exeInstalledDir Snap = (</> relDirInstalledPackages) <$> installationRootDeps
98
98
exeInstalledDir Local = (</> relDirInstalledPackages) <$> installationRootLocal
99
99
100
- -- | Get all of the installed executables
100
+ -- | Get all of the installed executables.
101
101
getInstalledExes ::
102
102
(HasEnvConfig env )
103
103
=> InstallLocation
@@ -115,7 +115,7 @@ getInstalledExes loc = do
115
115
map (\ x -> (pkgName x, [x])) $
116
116
mapMaybe (parsePackageIdentifier . toFilePath . filename) files
117
117
118
- -- | Mark the given executable as installed
118
+ -- | Mark the given executable as installed.
119
119
markExeInstalled ::
120
120
(HasEnvConfig env )
121
121
=> InstallLocation
@@ -135,7 +135,7 @@ markExeInstalled loc ident = do
135
135
-- and invalidate this file in getInstalledExes if they no longer exist
136
136
writeBinaryFileAtomic fp " Installed"
137
137
138
- -- | Mark the given executable as not installed
138
+ -- | Mark the given executable as not installed.
139
139
markExeNotInstalled ::
140
140
(HasEnvConfig env )
141
141
=> InstallLocation
@@ -149,7 +149,9 @@ markExeNotInstalled loc ident = do
149
149
buildCacheFile ::
150
150
(HasEnvConfig env , MonadReader env m , MonadThrow m )
151
151
=> Path Abs Dir
152
+ -- ^ Package directory.
152
153
-> NamedComponent
154
+ -- ^ Package component.
153
155
-> m (Path Abs File )
154
156
buildCacheFile dir component = do
155
157
cachesDir <- buildCachesDir dir
@@ -162,7 +164,9 @@ buildCacheFile dir component = do
162
164
tryGetBuildCache ::
163
165
HasEnvConfig env
164
166
=> Path Abs Dir
167
+ -- ^ Package directory.
165
168
-> NamedComponent
169
+ -- ^ Package component.
166
170
-> RIO env (Maybe (Map FilePath FileCacheInfo ))
167
171
tryGetBuildCache dir component = do
168
172
fp <- buildCacheFile dir component
@@ -171,27 +175,30 @@ tryGetBuildCache dir component = do
171
175
decode = Yaml. decodeFileThrow (toFilePath fp)
172
176
either (const Nothing ) (Just . (. times)) <$> liftIO (tryAny decode)
173
177
174
- -- | Try to read the dirtiness cache for the given package directory.
178
+ -- | Try to read the Cabal configuration cache for the given package directory.
175
179
tryGetConfigCache ::
176
180
HasEnvConfig env
177
181
=> Path Abs Dir
182
+ -- ^ Package directory.
178
183
-> RIO env (Maybe ConfigCache )
179
184
tryGetConfigCache dir =
180
185
loadConfigCache $ configCacheKey dir ConfigCacheTypeConfig
181
186
182
- -- | Try to read the mod time of the Cabal file from the last build
187
+ -- | Try to read the modification time of the Cabal file from the last build.
183
188
tryGetCabalMod ::
184
189
HasEnvConfig env
185
190
=> Path Abs Dir
191
+ -- ^ Package directory.
186
192
-> RIO env (Maybe CTime )
187
193
tryGetCabalMod dir = do
188
194
fp <- toFilePath <$> configCabalMod dir
189
195
tryGetFileMod fp
190
196
191
- -- | Try to read the mod time of setup-config file from the last build
197
+ -- | Try to read the modification time of setup-config file from the last build.
192
198
tryGetSetupConfigMod ::
193
199
HasEnvConfig env
194
200
=> Path Abs Dir
201
+ -- ^ Package directory.
195
202
-> RIO env (Maybe CTime )
196
203
tryGetSetupConfigMod dir = do
197
204
fp <- toFilePath <$> configSetupConfigMod dir
@@ -202,7 +209,7 @@ tryGetFileMod fp =
202
209
liftIO $ either (const Nothing ) (Just . modificationTime) <$>
203
210
tryIO (getFileStatus fp)
204
211
205
- -- | Try to read the project root from the last build of a package
212
+ -- | Try to read the project root from the last build of a package.
206
213
tryGetPackageProjectRoot ::
207
214
HasEnvConfig env
208
215
=> Path Abs Dir
@@ -220,17 +227,21 @@ tryReadFileBinary fp =
220
227
writeBuildCache ::
221
228
HasEnvConfig env
222
229
=> Path Abs Dir
230
+ -- ^ Package directory.
223
231
-> NamedComponent
232
+ -- ^ Package component.
224
233
-> Map FilePath FileCacheInfo -> RIO env ()
225
234
writeBuildCache dir component times = do
226
235
fp <- toFilePath <$> buildCacheFile dir component
227
236
liftIO $ Yaml. encodeFile fp BuildCache { times = times }
228
237
229
- -- | Write the dirtiness cache for this package's configuration .
238
+ -- | Write the given Cabal configuration cache for the given package directory .
230
239
writeConfigCache ::
231
240
HasEnvConfig env
232
241
=> Path Abs Dir
242
+ -- ^ Package directory.
233
243
-> ConfigCache
244
+ -- ^ Cabal configuration cache.
234
245
-> RIO env ()
235
246
writeConfigCache dir =
236
247
saveConfigCache (configCacheKey dir ConfigCacheTypeConfig )
@@ -270,15 +281,21 @@ writePackageProjectRoot dir projectRoot = do
270
281
fp <- configPackageProjectRoot dir
271
282
writeBinaryFileAtomic fp (byteString projectRoot)
272
283
273
- -- | Delete the caches for the project.
274
- deleteCaches :: HasEnvConfig env => Path Abs Dir -> RIO env ()
284
+ -- | Delete the Cabal configuration cache for the given package directory.
285
+ deleteCaches ::
286
+ HasEnvConfig env
287
+ => Path Abs Dir
288
+ -- ^ Package directory.
289
+ -> RIO env ()
275
290
deleteCaches dir =
276
291
{- FIXME confirm that this is acceptable to remove
277
292
bfp <- buildCacheFile dir
278
293
removeFileIfExists bfp
279
294
-}
280
295
deactiveConfigCache $ configCacheKey dir ConfigCacheTypeConfig
281
296
297
+ -- | For the given installed item, yields the key used to retrieve a record from
298
+ -- the library Cabal flag cache or executable Cabal flag cache.
282
299
flagCacheKey :: (HasEnvConfig env ) => Installed -> RIO env ConfigCacheKey
283
300
flagCacheKey installed = do
284
301
installationRoot <- installationRootLocal
@@ -289,7 +306,7 @@ flagCacheKey installed = do
289
306
Executable ident -> pure $
290
307
configCacheKey installationRoot (ConfigCacheTypeFlagExecutable ident)
291
308
292
- -- | Loads the flag cache for the given installed extra-deps.
309
+ -- | Loads the Cabal flag cache for the given installed extra-deps.
293
310
tryGetFlagCache ::
294
311
HasEnvConfig env
295
312
=> Installed
@@ -298,7 +315,7 @@ tryGetFlagCache gid = do
298
315
key <- flagCacheKey gid
299
316
loadConfigCache key
300
317
301
- -- | Write the flag cache for the given installed extra-deps.
318
+ -- | Write the Cabal flag cache for the given installed extra-deps.
302
319
writeFlagCache ::
303
320
HasEnvConfig env
304
321
=> Installed
@@ -313,17 +330,22 @@ successBS = "success"
313
330
failureBS = " failure"
314
331
unknownBS = " unknown"
315
332
316
- -- | Status of a test suite
333
+ -- | Status of test suite(s).
317
334
data TestStatus
318
335
= TSSuccess
336
+ -- ^ The test suite(s) succeeded.
319
337
| TSFailure
338
+ -- ^ One or more test suites failed.
320
339
| TSUnknown
340
+ -- ^ The outcome of the test suite(s) is unknown.
321
341
322
- -- | Mark test suite status
342
+ -- | Mark test suite status.
323
343
setTestStatus ::
324
344
HasEnvConfig env
325
345
=> Path Abs Dir
346
+ -- ^ Package directory.
326
347
-> TestStatus
348
+ -- ^ The status of the test suite(s).
327
349
-> RIO env ()
328
350
setTestStatus dir status = do
329
351
fp <- testSuccessFile dir
@@ -333,10 +355,11 @@ setTestStatus dir status = do
333
355
TSFailure -> failureBS
334
356
TSUnknown -> unknownBS
335
357
336
- -- | Check if the test suite already passed
358
+ -- | Check if the test suite(s) already passed.
337
359
getTestStatus ::
338
360
HasEnvConfig env
339
361
=> Path Abs Dir
362
+ -- ^ Package directory.
340
363
-> RIO env TestStatus
341
364
getTestStatus dir = do
342
365
fp <- testSuccessFile dir
0 commit comments