Open smagellan opened 8 years ago
This would certainly be possible and AFAIK all one needs for this is a maven plugin for Degraph. Although I never wrote a Maven plugin, it's supposedly rather easy.
Unfortunately my time is very limited and a Maven plugin isn't very high on my list of priorities. So I won't implement this in the foreseeable future.
But if somebody else wants to do it, I'll support the effort (setting it up in the build file, making modifications to the core if necessary, accepting the pull request ..).
I did not write them before, too. Excellent reason to try.
If you want to do it you have two options:
If you want follow one of these roads, let me know, I can put together some pointers how to get started with the degraph side of things
The implementation of the plugin would be rather easy I guess, however, building a maven plugin using gradle is not directly possible (AFAIK). You can have a look at the jgiven-maven-plugin, which also uses gradle, but requires maven behind the scenes for building the plugin: https://github.com/TNG/JGiven/tree/master/jgiven-maven-plugin
@janschaefer, thank you, I will take a look.
@schauder, I like option no. 2: new module in this project. I have 2 questions: 1) How to embed degraph into application? How gradle plugin embeds and runs core? It is good idea to share execution interface between gradle and maven plugins. 2) How to build settings and feed it into core?
The plugin would have a dependency on degraph-core so it can use the Degraph functionality.
For how to use it, probably the best is to look at the Degraph main method: https://github.com/schauder/degraph/blob/master/degraph/src/main/scala/de/schauderhaft/degraph/app/Degraph.scala
You create a Configuration instance, pass in an (Analyzer)[https://github.com/schauder/degraph/blob/master/core/src/main/scala/de/schauderhaft/degraph/analysis/asm/Analyzer.scala] and get out a (Graph)[https://github.com/schauder/degraph/blob/master/core/src/main/scala/de/schauderhaft/degraph/graph/Graph.scala], which contains information about violations of Constraints.
E.g. look at sonar: it is possible to invoke sonar analysis even without altering project's pom.xml: just alter your global setting.xml(example: https://gist.github.com/nkabir/2159177 ), then execute mvn sonar:sonar. Is it hard to introduce same functionality(degraph maven plugin) into Degraph suite?