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

Plugin takes a long time to figure out there are no changes #6

Closed StFS closed 6 years ago

StFS commented 6 years ago

We're using this plugin to generate both html and plain text documentation files.

We've been noticing that it takes a very long time (30 seconds or so) for the plugin to figure out that there are no changes that need to be made.

It looks like the plugin starts sphinx and has it do this work of looking at the input and output files to determine the need for generating the documentation.

My question is why the gradle input/output definitions in the task aren't preventing the sphinx application from running altogether when the input files haven't changed at all since the delay seems to be in the startup time of the sphinx executable.

I may be totally misunderstanding this, but I would think that if the input and output files in the SphinxTask were properly defined, it would not even have to start up the sphinx executable and therefore be able to short-circuit the task when nothing has changed.

trustin commented 6 years ago

I agree that it takes too long even if nothing has changed. Would you be interested in sending a PR? Should be as simple as adding some Gradle annotations to the plugin.

StFS commented 6 years ago

I'd be more than willing to try... only "problem" is that I'm not quite sure what the best way to test stuff like this would be. How do I point my gradle project to use a local version of the plugin instead of fetching it from the central repo? Do you just publish the plugin to the local maven cache perhaps?

trustin commented 6 years ago

Yes, I set up a simple site project and add mavenLocal() to the repositories { ... } section to refer to the snapshot build I published to ~/.m2/repository. I'm not sure there's a way to automate this though sadly.

StFS commented 6 years ago

well that was dumb of me... It turns out that the problem was on our end. Our documentation project had the source of the documentation in the root directory. The output was being generated into this same root directory. Since the inputDirectory of the task was set to the root directory, and the output always wrote new files into a subdirectory of that, gradle thought (understandably) that the input had changed every time. Moving our Sphinx source code into a separate directory that was a sibling of the output directory solved the problem for us. Now gradle short-circuits the task if nothing has changed in the input.

Closing as PEBKAC.

trustin commented 6 years ago

Good to hear that the problem is gone after all. Thanks for trying to be helpful!