Bridgecraft
Bridgecraft copied to clipboard
Find out how the generated interface is actually useful
Sudden realization: the generated interface is not valid swift because:
- class definitions don't have method bodies
- protocol definitions are syntactically incorrect (because of the
public
modifier) - global
let
constants don't have a value - global functions don't have a body
At least enums are fine...
OK actually Sourcery is laid back enough to not care about this 😎 However, it is still a problem to process the generated interface together with the files of a given project target, the configuration only allows one or the other.
In my case, I don't had the output of Bridgecraft to the project, I only use the output of Bridgecraft run Sourcery and it's working.
Good for you, but if you have a mixed codebase then the two must be processed at the same time for Sourcery to be able to resolve crossreferenced types properly. Otherwise they just appear as placeholders without real type information.
Hum, I see... Maybe this is not the ideal solution, but I think you can try to add multiple sources to Sourcery, like the output of Bridgecraft and the directories of your directory (if the directories are scanned recursively this would help, but I'm not sure if this is the case for Sourcery.)
Project patching is now supported in 0.1.0, the only issue yet to be resolved is that huge generated interfaces make Sourcery eat up all the resources and stall indefinitely (see https://github.com/krzysztofzablocki/Sourcery/issues/420). A workaround could be splitting the generated file into smaller pieces but that's not a trivial task due to type interdependencies.
Any news about this? Should we ping sourcery about the related issue?
I have a pending PR in SourceKitten (https://github.com/jpsim/SourceKitten/pull/495) that is one step to the right direction, although it is not sufficient. I haven't had time lately to further optimize Sourcery.
Oh, I didn't know that, thanks for sharing 👍
Just curious, now that Sourcery 0.12.0 and SourceKitten 0.20.0 are out, with some performance improvements you made, is Bridgecraft and Sourcery working in your project? 🙂
Yeah it would be interesting to try, let's see if I can find some time in the weekend
Well, when parsing a generated header of 500KB, Sourcery still inflates to ~15 GB but at least it now exits within a reasonable time. So this may make it feasible in my project as well.