Parsing .swiftinterface form xcframework #1035
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Issue: #87
Our project is really big so we decided to use it's dependencies as binary XCFrameworks.
The problem is to mock types declared in modules from such binary frameworks which we manage with CocoaPods.
The idea to work this limitation around was to scan
.swiftinterface
file inside the xcframework.Line of thought
At first I considered I could use
sources
key to set this up. Butsources
is mutually exclusivewith
project
which is an issue in our case. I gave it a try to makesources
usable along withproject
but it didn't work quite well. The thing is we need to use module name to namespace types in mocks. The case of matching
type names is not so rare. So
sources
was not entirely working. Another consideration was to scan.xcodeproj
to find a pathto xcframework and add it to sources list. But CocoaPods makes target so placeholder-ish that there is no way that I could find
to extract that path.
Proposed solution
Finally I introduced optional key
xcframework
to configuration.This path is added to target and gets scaned. Some messy fiddling with paths inside
.xcframework
file could be avoided butfor now it just works. Also the
xcframework
key could be made an array (not done yet)This Pull Request might not be the the right way to do it, but might as well be the starting point for a discussion.
I am sure there is a better way to achieve this.