Gradle plugin for Sphinx. This plugin adds tasks to build your Sphinx documentation.
- Install Sphinx, sphinx-autobuild and create your Sphinx documentation.
pip install Sphinx sphinx-autobuild
sphinx-quickstart
- Create build.gradle into your source directory of Sphinx documentation.
- Include the following in build.gradle:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.mikanbako.gradle.sphinx:sphinx-gradle-plugin:0.2.0"
}
}
apply plugin: "com.github.mikanbako.gradle.sphinx"
or
plugins {
id "com.github.mikanbako.gradle.sphinx" version "0.2.0"
}
- Run task.
gradle build
This plugin adds the following tasks.
Name | Description |
---|---|
build | Build documentation by Sphinx. |
clean | Clean built documentation directory. |
rebuild | Clean and build documentation. |
autobuild | Run sphinx-autobuild. |
When Sphinx or sphinx-autobuild is not installed, the tasks will be failed.
Default assumes that builder is "html" and build directory is "_build".
This plugin allows you to configure custom options for Sphinx and sphinx-autobuild.
The following example configuration closure is for Sphinx configuration.
sphinx {
builder = "html"
buildDir = "_build"
isWarningError = true
configurations = [release: '1.0']
}
Sphinx configuration has the following properties and methods.
Name | Type | Default value | Description |
---|---|---|---|
builder | String | "html" | Name of builder. The value is the same of the value of -b option on sphinx-build. |
sourceDir | Object | "." | Directory of source files. The value is evaluated by Project.file(). |
buildDir | Object | "_build" | Directory of built documentation. The value is evaluated by Project.file(). |
isWarningError | boolean | true | When the value is true, the build is failed by warnings from sphinx-build. |
isProjectBuildDirOverrided | boolean | true | When the value is true, Project.buildDir is set to the value of buildDir property. |
configurations | Map<String, String> | empty | Key and value paired configuration value set. The value is the same of the value of -D option on sphinx-build. |
options | Iterable<String> | empty | Other options for sphinx-build. |
warningsFilename | String | "warnings.txt" | Filename to write warnings from sphinx-build. The file is located on buildDir. |
command | String | "sphinx-build" | Running command for sphinx-build. |
Name | Return type | Parameter types | Description |
---|---|---|---|
options | void | String... | Other options for sphinx-build. |
The following example configuration closure is for Sphinx configuration.
sphinxAutobuild {
host = "localhost"
port = 8000
}
sphinx-autobuild configuration has the following properties and methods.
Name | Type | Default value | Description |
---|---|---|---|
host | String | "localhost" | The host on which the documentation shall be served. |
port | int | 8000 | The port on which the documentation shall be served. |
options | Iterable<String> | empty | Options for sphix-autobuild. |
command | String | "sphinx-autobuild" | Running command for sphinx-autobuild. |
Moreover, sphinx-autobuild configuration uses the following Sphinx configuration to run Sphinx.
- builder
- configurations
- options
Name | Return type | Parameter types | Description |
---|---|---|---|
options | void | String... | Options for sphix-autobuild. |
This software is released under the MIT License. See LICENSE.txt for detail.
- Install the plugin to local maven repository:
./gradlew install
- Include the following in your build.gradle to build the documentation:
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath "com.github.mikanbako.gradle.sphinx:sphinx-gradle-plugin:0.2.0"
}
}
apply plugin: "com.github.mikanbako.gradle.sphinx"