DIKit icon indicating copy to clipboard operation
DIKit copied to clipboard

Graph validation at compile-time

Open benjohnde opened this issue 6 years ago • 6 comments

Could be implemented by traversing the Sources and collect each @Inject for creating the dependency-graph. If no circular dependencies are found, continue with collecting information about the dependency container creations and derive the final module catalogue. From here on it is rather easy to validate.

benjohnde avatar Sep 19 '19 15:09 benjohnde

Should potentially work with https://github.com/jpsim/SourceKitten/pull/615/files

benjohnde avatar Sep 19 '19 19:09 benjohnde

SourceKitten still seems to not print out information about annotations. Postponing this one to 1.5.0 (or later).

benjohnde avatar Oct 18 '19 09:10 benjohnde

I am going to tackle that one again, version 0.26.0: Cinco de Gato did not print out information about annotations. Let's see!

benjohnde avatar Apr 06 '20 17:04 benjohnde

Could potentially work with 0.30.0: Cats Don't Wear Masks, still need to test that thing out.

benjohnde avatar Aug 26 '20 19:08 benjohnde

In a nutshell @brototyp: my idea was as described above to check for circular dependencies and to check if all desired injections can be resolved successfully. I did not want to do any type of preprocessing magic in terms of what Java or Kotlin offers with the annotation preprocessor magic as it would not feel idiomatic for Swift / Xcode. So I thought about using something like SourceKitten to traverse the Sources, collect the use of DIKit with the AST (which is provided by SourceKitten) and then infer the actual graph for some validation.

benjohnde avatar Aug 26 '20 19:08 benjohnde

Hm. I see. And then the users of DIKit would add a build phase that basically just calls a script? I'll try to understand this on a high level, maybe I can help out 😊

brototyp avatar Aug 27 '20 07:08 brototyp