SourceKit's 'indexsource' request type requires swiftc compiler arguments in order to compile the given source file on demand (I assume). However, the exact arguments required are numerous, not documented and highly specific to the requested source file.
Advanced users of 'indexsource' do not typically attempt to construct this set of arguments manually, and instead 'spy' on Xcode in order to determine the necessary arguments. Both SourceKitten[1] and Periphery[2] rely upon parsing the output from xcodebuild to identify the appropriate swiftc call, parse the argument set, and then remove specific arguments that 'indexsource' does not appear to accept[3].
This approach is problematic for a number of reasons:
- Building a project simply to obtain the swiftc arguments is extremely inefficient. With regard to Periphery, the xcodebuild step accounts for over 95% of total runtime.
- xcodebuild must also perform a 'clean' build, since th