During the lifetime of analysing source-breaking changes, we may compare
the equality of two SDKNodes more than once, which makes the comprison
results amenable for caching. This patch implemented it. NFC
[Tools] Add a tool to detect source-breaking API changes introduced from libraries.
swift-api-digester is a test utility to detect source-breaking API changes
during the evolution of a swift library. The tool works on two phases:
(1) dumping library contents as a json file, and (2) comparing two json
files textually to report interesting changes.
During phase (1), the api-digester looks up every declarations inside
a module and outputs a singly-rooted tree that encloses interesting
details of the API level.
During phase (2), api-digester applies structure-information comparision
algorithms on two given singly root trees, trying to figure out, as
precise as possible, the branches/leaves in the trees that differ from
each other. Further analysis decides whether the changed leaves/branches
can be reflected as source-breaking changes for API users. If they are,
the output of api-digester will include such changes.
Also, this commit includes a regression test that make sure API changes
from the Swift stdlib are expected.