diff --git a/build.gradle b/build.gradle index 794dfa647b..762bca6e5d 100644 --- a/build.gradle +++ b/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" diff --git a/docs/build.gradle b/docs/build.gradle new file mode 100644 index 0000000000..0accd34c59 --- /dev/null +++ b/docs/build.gradle @@ -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 +} \ No newline at end of file diff --git a/docs/generate-docsite.sh b/docs/generate-docsite.sh deleted file mode 100755 index c6de1d2f02..0000000000 --- a/docs/generate-docsite.sh +++ /dev/null @@ -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 <docs/build/html/robots.txt -User-agent: * -Disallow: / -EOF - -echo "Done" diff --git a/docs/install-docsite-requirements.sh b/docs/install-docsite-requirements.sh new file mode 100755 index 0000000000..77b009f433 --- /dev/null +++ b/docs/install-docsite-requirements.sh @@ -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 \ No newline at end of file diff --git a/docs/robots.txt b/docs/robots.txt new file mode 100644 index 0000000000..1f53798bb4 --- /dev/null +++ b/docs/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/docs/source/building-the-docs.rst b/docs/source/building-the-docs.rst index 769f09d465..5f1eb97f1c 100644 --- a/docs/source/building-the-docs.rst +++ b/docs/source/building-the-docs.rst @@ -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: diff --git a/settings.gradle b/settings.gradle index f12edeb204..18a2b64934 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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'