trustin / sphinx-gradle-plugin

Sphinx site generation plugin for Gradle
https://trustin.github.io/sphinx-gradle-plugin/
Apache License 2.0
18 stars 7 forks source link

Ability to provide graphviz bin dir #7

Closed Johnlon closed 6 years ago

Johnlon commented 6 years ago

With the old tomdz implementation I have a custom gradle task that overrides PATH to provide location of graphviz. This allows me to avoid having to preinstall graphviz and have it on the path because I can declare a dependency on graphviz.zip and have a task unpack it into a defined location. But I need to provide that location on path when invoking the sphinx runner.

Can I have a property that allows me to provide the graphviz bin dir location please and can your plugin add that dir to the path.

trustin commented 6 years ago

Would specifying -graphvizdot option in conf.py work?

plantuml = [ os.getenv('plantuml'), '-graphvizdot', path_to_dot_executable ]

Source: https://github.com/sphinx-contrib/plantuml/blob/master/sphinxcontrib/plantuml.py#L149

Johnlon commented 6 years ago

Incidentally the way I achieved this work the old maven plugin was by adding graphviz to the path by running sphinxrunner as a sub process which works on Unix and windows. The old sphinx plugin has a main on the runner which makes this possible

Johnlon commented 6 years ago

Is that thing already an option? One benefit of the approach I used before was I didn't hard code paths in cfg files which meant I had OS portability

Johnlon commented 6 years ago

So I would need os.getenv('dotpath') But that means I need a way to supply that value from gradle

trustin commented 6 years ago

Yes, the Gradle plugin needs a new option that lets a user specify the path to dot.

trustin commented 6 years ago

Didn't have a chance to work on this, but perhaps we could solve this problem completely if we bundle a standalone dot binary in the plugin?

Unfortunately, dot is known to be pretty hard to build, especially when you want a statically-linked binary.

Perhaps we could use https://github.com/nexe/nexe and https://github.com/mdaines/viz.js to build an alternative. Created an issue just in case the author of viz.js is interested in this idea: https://github.com/mdaines/viz.js/issues/124

trustin commented 6 years ago

There's also https://github.com/nidi3/graphviz-java, which could be integrated into PlantUML directly.

trustin commented 6 years ago

A little more Googling reveals that PlantUML already has it already: http://plantuml.com/vizjs

https://github.com/plantuml/vizjs doesn't seem to have a release, but the code is so small that we can just copy it over here.

trustin commented 6 years ago

Left a question in PlantUML Q&A forum to know the status of viz.js integration.

Johnlon commented 6 years ago

Recommend an extra flag as this worked well in the past.

On Mon, 16 Apr 2018, 4:17 pm Trustin Lee, notifications@github.com wrote:

Left a question in PlantUML Q&A forum to know the status of viz.js integration.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/trustin/sphinx-gradle-plugin/issues/7#issuecomment-381641691, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzCmNWG_MOgTfe6Hv-GBdyeSD0B7Kyuks5tpLYEgaJpZM4Rw7p4 .

trustin commented 6 years ago

Yep, let me implement that option first.

trustin commented 6 years ago

Just released the version 2.1.0 which should fix this issue: https://github.com/trustin/sphinx-gradle-plugin/releases/tag/sphinx-gradle-plugin-2.1.0

trustin commented 6 years ago

Please feel free to open a new issue if you still have a problem specifying alternative dot binary.