veracode / gen-ir

Generates LLVM IR for Xcode Projects
MIT License
8 stars 4 forks source link

Support Framework Build Phase, Rework Dependency Mapping #45

Closed NinjaLikesCheez closed 11 months ago

NinjaLikesCheez commented 1 year ago

Gen IR parses through Xcode files that represents the project - pbxproj files - and uses PBXNativeTarget (and others) to represent the main targets. This is also used to do a lot of the dependency tracking as they have a helpful dependency and packageProductDependencies arrays which we can use.

Turns out, as is often the case with this undocumented format, that is not the only way Xcode handles dependencies! There also exists a special build phase (PBXFrameworksBuildPhase - more commonly known to developers as ‘Link Binary with Libraries’) that doesn’t list targets in the dependency arrays. Instead, this phase has a files array - which lists some additional dependencies (some of which are included in either the dependency or package array… but it turns out not all!).

This change adds support for parsing this file list.

In addition, this change also adds a new and improved way of tracking dependencies via a directed graph which improves our ability to control how and when we move files - so as not to miss transitive dependencies.