mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Moved the build docs functionality into build.gradle.
Removed redundant parts of the docsite generator. Gradle now calls the docsite requirements installation script when building docs via buildDocs Added docs build script and moved all docs building related code into it Corrected directories for build.
This commit is contained in:
parent
ade9a7dba8
commit
b80aaa0e9d
20
build.gradle
20
build.gradle
@ -73,7 +73,6 @@ apply plugin: 'com.github.ben-manes.versions'
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'net.corda.plugins.quasar-utils'
|
||||
apply plugin: 'net.corda.plugins.cordformation'
|
||||
apply plugin: 'org.jetbrains.dokka'
|
||||
|
||||
// We need the following three lines even though they're inside an allprojects {} block below because otherwise
|
||||
// IntelliJ gets confused when importing the project and ends up erasing and recreating the .idea directory, along
|
||||
@ -222,25 +221,6 @@ bintrayConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// API docs
|
||||
|
||||
dokka {
|
||||
moduleName = 'corda'
|
||||
outputDirectory = 'docs/build/html/api/kotlin'
|
||||
processConfigurations = ['compile']
|
||||
sourceDirs = files('core/src/main/kotlin', 'client/jfx/src/main/kotlin', 'client/mock/src/main/kotlin', 'client/rpc/src/main/kotlin', 'node/src/main/kotlin', 'finance/src/main/kotlin', 'client/jackson/src/main/kotlin')
|
||||
}
|
||||
|
||||
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
|
||||
moduleName = 'corda'
|
||||
outputFormat = "javadoc"
|
||||
outputDirectory = 'docs/build/html/api/javadoc'
|
||||
processConfigurations = ['compile']
|
||||
sourceDirs = files('core/src/main/kotlin', 'client/jfx/src/main/kotlin', 'client/mock/src/main/kotlin', 'client/rpc/src/main/kotlin', 'node/src/main/kotlin', 'finance/src/main/kotlin', 'client/jackson/src/main/kotlin')
|
||||
}
|
||||
|
||||
task apidocs(dependsOn: ['dokka', 'dokkaJavadoc'])
|
||||
|
||||
// Build a ZIP of all JARs required to compile the Cordapp template
|
||||
// Note: corda.jar is used at runtime so no runtime ZIP is necessary.
|
||||
// Resulting ZIP can be found in "build/distributions"
|
||||
|
36
docs/build.gradle
Normal file
36
docs/build.gradle
Normal file
@ -0,0 +1,36 @@
|
||||
apply plugin: 'org.jetbrains.dokka'
|
||||
|
||||
dokka {
|
||||
moduleName = 'corda'
|
||||
outputDirectory = 'docs/build/html/api/kotlin'
|
||||
processConfigurations = ['compile']
|
||||
sourceDirs = files('../core/src/main/kotlin', '../client/jfx/src/main/kotlin', '../client/mock/src/main/kotlin', '../client/rpc/src/main/kotlin', '../node/src/main/kotlin', '../finance/src/main/kotlin', '../client/jackson/src/main/kotlin')
|
||||
}
|
||||
|
||||
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
|
||||
moduleName = 'corda'
|
||||
outputFormat = "javadoc"
|
||||
outputDirectory = 'docs/build/html/api/javadoc'
|
||||
processConfigurations = ['compile']
|
||||
sourceDirs = files('../core/src/main/kotlin', '../client/jfx/src/main/kotlin', '../client/mock/src/main/kotlin', '../client/rpc/src/main/kotlin', '../node/src/main/kotlin', '../finance/src/main/kotlin', '../client/jackson/src/main/kotlin')
|
||||
}
|
||||
|
||||
task apidocs(dependsOn: [':jar', 'dokka', 'dokkaJavadoc'])
|
||||
task buildDocs(dependsOn: ['apidocs', 'copyRobots'])
|
||||
|
||||
task copyRobots(type: Copy) {
|
||||
from "robots.txt"
|
||||
into "build/html"
|
||||
}
|
||||
|
||||
task installDocsiteRequirements(type: Exec) {
|
||||
workingDir 'docs'
|
||||
commandLine 'cmd', '/c', 'sh ./install-docsite-requirements.sh' // Windows
|
||||
commandLine './install-docsite-requirements.sh' // Linux
|
||||
}
|
||||
|
||||
task makeDocs(type: Exec, dependsOn: ['installDocsiteRequirements']) {
|
||||
workingDir 'docs'
|
||||
commandLine 'cmd', '/c', 'make clean html' // Windows
|
||||
commandLine 'make clean html' // Linux
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
if [ ! -e ./gradlew ]; then
|
||||
echo "Run from the root directory please"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
cd docs
|
||||
|
||||
if [ ! -d "virtualenv" ]
|
||||
then
|
||||
# Check if python2.7 is installed explicitly otherwise fall back to the default python
|
||||
if type "python2.7" > /dev/null; then
|
||||
virtualenv -p python2.7 virtualenv
|
||||
else
|
||||
virtualenv virtualenv
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "virtualenv/bin" ]
|
||||
then
|
||||
# it's a Unix system
|
||||
. virtualenv/bin/activate
|
||||
else
|
||||
. virtualenv/Scripts/activate
|
||||
fi
|
||||
|
||||
if [ ! -d "virtualenv/lib/python2.7/site-packages/sphinx" ]
|
||||
then
|
||||
echo "Installing pip dependencies ... "
|
||||
pip install -r requirements.txt
|
||||
fi
|
||||
|
||||
echo "Generating docsite ..."
|
||||
echo
|
||||
|
||||
make clean html
|
||||
)
|
||||
|
||||
echo
|
||||
echo "Generating API docs ..."
|
||||
echo
|
||||
./gradlew apidocs
|
||||
|
||||
echo
|
||||
echo "Writing robots.txt"
|
||||
echo
|
||||
|
||||
cat <<EOF >docs/build/html/robots.txt
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
EOF
|
||||
|
||||
echo "Done"
|
29
docs/install-docsite-requirements.sh
Executable file
29
docs/install-docsite-requirements.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# The purpose of this file is to install the requirements for the docsite
|
||||
# You can call it manually if running make manually, otherwise gradle will run it for you
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
if [ ! -d "virtualenv" ]
|
||||
then
|
||||
# Check if python2.7 is installed explicitly otherwise fall back to the default python
|
||||
if type "python2.7" > /dev/null; then
|
||||
virtualenv -p python2.7 virtualenv
|
||||
else
|
||||
virtualenv virtualenv
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "virtualenv/bin" ]
|
||||
then
|
||||
# it's a Unix system
|
||||
. virtualenv/bin/activate
|
||||
else
|
||||
. virtualenv/Scripts/activate
|
||||
fi
|
||||
|
||||
if [ ! -d "virtualenv/lib/python2.7/site-packages/sphinx" ]
|
||||
then
|
||||
echo "Installing pip dependencies ... "
|
||||
pip install -r requirements.txt
|
||||
fi
|
2
docs/robots.txt
Normal file
2
docs/robots.txt
Normal file
@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow: /
|
@ -38,7 +38,7 @@ documentation by running the following script:
|
||||
|
||||
.. sourcecode:: shell
|
||||
|
||||
docs/generate-docsite.sh
|
||||
./gradlew buildDocs
|
||||
|
||||
Alternatively you can build non-HTML formats from the ``docs`` folder. Change directory to the folder and then run the
|
||||
following to see a list of all available formats:
|
||||
|
@ -4,6 +4,7 @@ rootProject.name = 'corda-project'
|
||||
include 'finance'
|
||||
include 'finance:isolated'
|
||||
include 'core'
|
||||
include 'docs'
|
||||
include 'node-api'
|
||||
include 'node-schemas'
|
||||
include 'node'
|
||||
|
Loading…
Reference in New Issue
Block a user