Fix inconsistent serialization state when resolution cache expires Resolution results are cached, but the cache may expire or entries in the cache may be evicted, in case there are many configurations resolved. This has the consequence that the streaming resolution builder root factory may be called multiple times for the same configuration, and therefore the file may be read several times within a build.
This commit fixes a bug with attribute serialization where the state of the serializer would make the 2d read incorrect.
Sort module selectors This commit reworks module selectors so that they are sorted in an order which reduces the cost of module selection. We make sure to put local (project) selectors first, then we use selectors from locks (if any).
The next selectors are "latest" version selectors because even if they are dynamic, they are likely to "win" selection. Then, exact version selectors are sorted by version descending , and last we add dynamic version selectors.