swift-index-store
swift-index-store copied to clipboard
Add example tool for "dependency tightness"
This tool uses to index to determine how many reference a module has on its dependencies. It outputs json formatted as:
{
"A": {
"B": 5,
"C": 1
}
}
Which indicates the module named A has 1 reference to something
defined in C and 5 references to things defined in B.
Could this be used to find the inverse? In a target can we determine which definitions are the easiest to extract?
hrm probably. can you provide an example?
I think with a similar tool you could definitely find cases where a definition in 1 module is only used in another module so it should likely be moved there
Its tricky because what I have working locally has to parse raw USRs to determine what a symbol belongs to (unless I am holding it wrong)
hrm probably. can you provide an example?
I think with a similar tool you could definitely find cases where a definition in 1 module is only used in another module so it should likely be moved there
Basically I want a linear path of files that can be moved from one target it its next most adjacent target based on the number of inner references of a file to the rest of its target
Its tricky because what I have working locally has to parse raw USRs to determine what a symbol belongs to (unless I am holding it wrong)
In this case you don't need to parse the USR because you can just collect all definitions and at that point you know what module they're defined in from the index unit.
Basically I want a linear path of files that can be moved from one target it its next most adjacent target based on the number of inner references of a file to the rest of its target
yea i think that's definitely possible with something like this. I think it would be a matter of tracking what modules reference what USRs and if there is only 1 that isn't where the definition is, it can be moved.
here's an example https://github.com/lyft/swift-index-store/pull/44