finalizePD :: FlagAssignmentExplicitly specified flag assignments
-> ComponentRequestedSpec-> (Dependency -> Bool)Is a given dependency satisfiable from the set of available packages? If this is unknown then use True.
-> Platform-> CompilerInfoCompiler information
-> [PackageVersionConstraint]Additional constraints
-> GenericPackageDescription-> Either [Dependency] (PackageDescription, FlagAssignment)Either missing dependencies or the resolved package description along with the flag assignments chosen.
Create a package description with all configurations resolved.
This function takes a GenericPackageDescription and several environment parameters and tries to generate PackageDescription by finding a flag assignment that result in satisfiable dependencies.
It takes as inputs a not necessarily complete specifications of flags assignments, an optional package index as well as platform parameters. If some flags are not assigned explicitly, this function will try to pick an assignment that causes this function to succeed. The package index is optional since on some platforms we cannot determine which packages have been installed before. When no package index is supplied, every dependency is assumed to be satisfiable, therefore all not explicitly assigned flags will get their default values.
This function will fail if it cannot find a flag assignment that leads to satisfiable dependencies. (It will not try alternative assignments for explicitly specified flags.) In case of failure it will return the missing dependencies that it encountered when trying different flag assignments. On success, it will return the package description and the full flag assignment chosen.
Note that this drops any stanzas which have buildable: False. While
this is arguably the right thing to do, it means we give bad error
messages in some situations, see #3858.