dagger icon indicating copy to clipboard operation
dagger copied to clipboard

Example use of the visualized DAG output

Open jameswald opened this issue 12 years ago • 5 comments

Jesse's talk at QCon talk touched on a really great feature that visualizes the DAG. Maybe it's just me, but I didn't know I was looking for a dot file nor did I know where the mythical file was saved. After looking through the code I was able to track it down. It would be helpful to showcase this neat feature on the website.

By default, the dot file is saved as:

target/classes/com/yourapp/YourappModule.dot

You can view this file with GraphViz here http://www.graphviz.org/Download..php.

jameswald avatar Feb 11 '13 21:02 jameswald

It's default is actually "wherever your ModuleAdapter is generated" which seems to differ depending on your maven configuration.

When I do

<dependencies>
   <dependency>
     <groupId>com.squareup</groupId>
     <artifactId>dagger-compiler</artifactId>
     <version>some-version</version>
     <optional>true</optional>
   </dependency>
</dependencies>

then it puts my generated code into target/generated-sources/annotation and the .dot file is beside the module adapter.

On 11 Feb 2013, at 16:39, James Wald wrote:

Jesse's talk at QCon talk touched on a really great feature that visualizes the DAG. Maybe it's just me, but I didn't know I was looking for a dot file nor did I know where the mythical file was saved. After looking through the code I was able to track it down.
It would be helpful to showcase this neat feature on the website.

By default, the dot file is saved as:

target/classes/com/yourapp/YourappModule.dot

You can view this file with GraphViz here http://www.graphviz.org/Download..php.


Reply to this email directly or view it on GitHub: https://github.com/square/dagger/issues/158

cgruber avatar Feb 11 '13 21:02 cgruber

Pointing this out on the website is a good idea. We should also clean it up some; currently the graphs could use a little love.

swankjesse avatar Feb 13 '13 04:02 swankjesse

This is a very cool feature, is there a .dot file per module? Or one merged graph starting from the root (even more awesome)?


EDIT: I tried for fun to merge the dot files with the following command: gvpack -n GLarmModule.dot ServicesModule.dot XmlServiceModule.dot But no luck. Still, it's good to have them especially in large projects.

arichiardi avatar Mar 16 '13 16:03 arichiardi

@arichiardi if you want to see a merged graph, just create a module that includes all of the modules you want in your graph. The graph will include everything.

swankjesse avatar Mar 16 '13 16:03 swankjesse

Yeah you are right, currently I have: GLarmModule includes ServiceModule includes XmlServiceModule But dotty (graphviz dispaly tool) doesn't really show all the dependencies. Probably some branch is not there because it is not used in the code (I am in "developing" mode and some feature is commented out).

arichiardi avatar Mar 16 '13 16:03 arichiardi