@@ -331,11 +331,37 @@ sanityCheckElaboratedPackage
331
331
`optStanzaSetIsSubset` pkgStanzasEnabled
332
332
)
333
333
334
- ------------------------------------------------------------------------------
335
-
336
- -- * Deciding what to do: making an 'ElaboratedInstallPlan'
337
-
338
- ------------------------------------------------------------------------------
334
+ -- Note [reading project configuration]
335
+ --
336
+ -- The project configuration is assembled into a ProjectConfig as follows:
337
+ --
338
+ -- CLI arguments are converted using commandLineFlagsToProjectConfig in the
339
+ -- v2 command entrypoints and passed to establishProjectBaseContext which
340
+ -- then calls rebuildProjectConfig.
341
+ --
342
+ -- rebuildProjectConfig then calls readProjectConfig to read the project
343
+ -- files. Because of conditionals, this output is in the form of a
344
+ -- ProjectConfigSkeleton and will be resolved by rebuildProjectConfig using
345
+ -- instantiateProjectConfigSkeletonFetchingCompiler.
346
+ --
347
+ -- readProjectConfig also loads the global configuration, which is read with
348
+ -- loadConfig and convertd to a ProjectConfig with convertLegacyGlobalConfig.
349
+ --
350
+ -- *Important*
351
+ --
352
+ -- You can notice how some project config options are needed to read the
353
+ -- project config! This is evident by the fact that rebuildProjectConfig
354
+ -- takes HttpTransport and DistDirLayout as parameters. Two arguments are
355
+ -- infact determined from the CLI alone (in establishProjectBaseContext).
356
+ -- Consequently, project files (including global configuration) cannot
357
+ -- affect those parameters.
358
+ --
359
+ -- Furthermore, the project configuration can specify a compiler to use,
360
+ -- which we need to resolve the conditionals in the project configuration!
361
+ -- To solve this, we configure the compiler from what is obtained by applying
362
+ -- the CLI configuration over the the configuration obtained by "flattening"
363
+ -- ProjectConfigSkeleton. This means collapsing all conditionals by taking
364
+ -- both branches.
339
365
340
366
-- | Return the up-to-date project config and information about the local
341
367
-- packages within the project.
@@ -513,6 +539,11 @@ configureCompiler
513
539
)
514
540
$ defaultProgramDb
515
541
542
+
543
+ ------------------------------------------------------------------------------
544
+ -- * Deciding what to do: making an 'ElaboratedInstallPlan'
545
+ ------------------------------------------------------------------------------
546
+
516
547
-- | Return an up-to-date elaborated install plan.
517
548
--
518
549
-- Two variants of the install plan are returned: with and without packages
0 commit comments