@@ -354,6 +354,7 @@ rebuildProjectConfig
354
354
-> HttpTransport
355
355
-> DistDirLayout
356
356
-> ProjectConfig
357
+ -> CurrentCommand
357
358
-> IO
358
359
( ProjectConfig
359
360
, [PackageSpecifier UnresolvedSourcePackage ]
@@ -368,7 +369,8 @@ rebuildProjectConfig
368
369
, distProjectCacheDirectory
369
370
, distProjectFile
370
371
}
371
- cliConfig = do
372
+ cliConfig
373
+ currentCommand = do
372
374
progsearchpath <- liftIO $ getSystemSearchPath
373
375
374
376
let fileMonitorProjectConfig = newFileMonitor (distProjectCacheFile " config" )
@@ -415,14 +417,22 @@ rebuildProjectConfig
415
417
notice (verboseStderr verbosity) . render . vcat $
416
418
text " Configuration is affected by the following files:" : configfiles
417
419
418
- return (projectConfig <> cliConfig, localPackages)
420
+ return (commandDefaults currentCommand <> projectConfig <> cliConfig, localPackages)
419
421
where
420
422
ProjectConfigShared {projectConfigHcFlavor, projectConfigHcPath, projectConfigHcPkg, projectConfigIgnoreProject, projectConfigConfigFile} =
421
423
projectConfigShared cliConfig
422
424
423
425
PackageConfig {packageConfigProgramPaths, packageConfigProgramPathExtra} =
424
426
projectConfigLocalPackages cliConfig
425
427
428
+ -- Some commands may require special defaults
429
+ commandDefaults HaddockCommand = -- `cabal haddock` emplies --enable-documentation, #7462
430
+ mempty
431
+ { projectConfigAllPackages = mempty { packageConfigDocumentation = pure True }
432
+ , projectConfigLocalPackages = mempty { packageConfigDocumentation = pure True }
433
+ }
434
+ commandDefaults _ = mempty
435
+
426
436
-- Read the cabal.project (or implicit config) and combine it with
427
437
-- arguments from the command line
428
438
--
0 commit comments