Document warning cleanup + new version of docs builder

This commit is contained in:
Ben Wyeth 2019-04-11 14:43:47 +01:00 committed by Anthony Keenan
parent 87720163f8
commit f9916e673c
30 changed files with 1895 additions and 47 deletions

View File

@ -0,0 +1 @@
Pygments*.whl

View File

@ -0,0 +1,13 @@
FROM python:2-stretch
RUN apt-get update \
&& apt-get --no-install-recommends install -y texlive preview-latex-style texlive-generic-extra texlive-latex-extra latexmk dos2unix \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV PATH="/opt/docs_builder:${PATH}"
WORKDIR /opt/docs_builder
COPY requirements.txt requirements.txt
COPY docs_builder/lexer-fix/Pygments*.whl .
RUN pip install -r requirements.txt
RUN pip install Pygments*.whl --force-reinstall

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
# Pygments lexer
We were getting a lot of warnings in the docs build, and people were unable to see the real warnings due to this. So we're on a mission
to sort all of these out.
A lot of the errors were because the kotlin lexer in Pygments (the syntax highlighter that sphinx uses) didn't cope with a lot of the
kotlin syntax that we use.
We have fixes for the kotlin lexer that we are trying to get checked into Pygments, but while this is taking place we need to maintain a
slightly hacked corda/docs-build docker image in which to build the docs.
## Some notes on building and testing
The sphinx/pygments brigade have delightfully decided that mercurial is a good idea. So broadly speaking, to build/test a fix:
* checkout pygments from [here](https://bitbucket.org/birkenfeld/pygments-main/overview)
* copy the two python files in (might be worth diffing - they're based on 2.3.1 - nb the kotlin test is entirely new)
* build pygments whl file
```
cd /path/to/pygments/
python setup.py install
pip install wheel
wheel convert dist/Pygments-2.3.1.dev20190 # obviously use your version
cp Pygments-2.3.1.dev20190401-py27-none-any.whl /path/to/corda/docs/source/docs_builder/lexer-fix
```
* build the latest docker build (see docs readme)
```
cd docs
docker build -t corda/docs-builder:latest -f docs_builder/lexer-fix/Dockerfile .
```
* push the new image up to docker hub (nb you can also test by going to /opt/docs and running `./make-docsite.sh`)

View File

@ -0,0 +1,131 @@
# -*- coding: utf-8 -*-
"""
Basic JavaLexer Test
~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import unittest
from pygments.token import Text, Name, Operator, Keyword, Number, Punctuation, String
from pygments.lexers import KotlinLexer
class KotlinTest(unittest.TestCase):
def setUp(self):
self.lexer = KotlinLexer()
self.maxDiff = None
def testCanCopeWithBackTickNamesInFunctions(self):
fragment = u'fun `wo bble`'
tokens = [
(Keyword, u'fun'),
(Text, u' '),
(Name.Function, u'`wo bble`'),
(Text, u'\n')
]
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
def testCanCopeWithCommasAndDashesInBackTickNames(self):
fragment = u'fun `wo,-bble`'
tokens = [
(Keyword, u'fun'),
(Text, u' '),
(Name.Function, u'`wo,-bble`'),
(Text, u'\n')
]
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
def testCanCopeWithDestructuring(self):
fragment = u'val (a, b) = '
tokens = [
(Keyword, u'val'),
(Text, u' '),
(Punctuation, u'('),
(Name.Property, u'a'),
(Punctuation, u','),
(Text, u' '),
(Name.Property, u'b'),
(Punctuation, u')'),
(Text, u' '),
(Punctuation, u'='),
(Text, u' '),
(Text, u'\n')
]
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
def testCanCopeGenericsInDestructuring(self):
fragment = u'val (a: List<Something>, b: Set<Wobble>) ='
tokens = [
(Keyword, u'val'),
(Text, u' '),
(Punctuation, u'('),
(Name.Property, u'a'),
(Punctuation, u':'),
(Text, u' '),
(Name.Property, u'List'),
(Punctuation, u'<'),
(Name, u'Something'),
(Punctuation, u'>'),
(Punctuation, u','),
(Text, u' '),
(Name.Property, u'b'),
(Punctuation, u':'),
(Text, u' '),
(Name.Property, u'Set'),
(Punctuation, u'<'),
(Name, u'Wobble'),
(Punctuation, u'>'),
(Punctuation, u')'),
(Text, u' '),
(Punctuation, u'='),
(Text, u'\n')
]
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
def testCanCopeWithGenerics(self):
fragment = u'inline fun <reified T : ContractState> VaultService.queryBy(): Vault.Page<T> {'
tokens = [
(Keyword, u'inline fun'),
(Text, u' '),
(Punctuation, u'<'),
(Keyword, u'reified'),
(Text, u' '),
(Name, u'T'),
(Text, u' '),
(Punctuation, u':'),
(Text, u' '),
(Name, u'ContractState'),
(Punctuation, u'>'),
(Text, u' '),
(Name.Class, u'VaultService'),
(Punctuation, u'.'),
(Name.Function, u'queryBy'),
(Punctuation, u'('),
(Punctuation, u')'),
(Punctuation, u':'),
(Text, u' '),
(Name, u'Vault'),
(Punctuation, u'.'),
(Name, u'Page'),
(Punctuation, u'<'),
(Name, u'T'),
(Punctuation, u'>'),
(Text, u' '),
(Punctuation, u'{'),
(Text, u'\n')
]
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
def testShouldCopeWithMultilineComments(self):
fragment = u'"""\nthis\nis\na\ncomment"""'
tokens = [
(String, u'"""\nthis\nis\na\ncomment"""'),
(Text, u'\n')
]
self.assertEqual(tokens, list(self.lexer.get_tokens(fragment)))
if __name__ == '__main__':
unittest.main()

View File

@ -14,7 +14,7 @@ mistune==0.8.3
packaging==17.1
pdfrw==0.4
Pillow==5.1.0
Pygments==2.2.0
Pygments==2.3.1
pyparsing==2.2.0
pytz==2016.4
reportlab==3.4.0

View File

@ -37,7 +37,7 @@ Step 2. Adjust the version numbers in your Gradle build files
Alter the versions you depend on in your Gradle file like so:
.. code:: groovy
.. code-block:: groovy
ext.corda_release_version = '|corda_version|'
ext.corda_gradle_plugins_version = '|gradle_plugins_version|'
@ -49,7 +49,9 @@ Alter the versions you depend on in your Gradle file like so:
for us to risk an upgrade. Sorry! Future work on app isolation will make it easier for apps to use newer Kotlin versions than
the node itself uses.
You should also ensure you're using Gradle 4.10 (but not 5). If you use the Gradle wrapper, run::
You should also ensure you're using Gradle 4.10 (but not 5). If you use the Gradle wrapper, run:
.. code:: shell
./gradlew wrapper --gradle-version 4.10.3
@ -62,7 +64,9 @@ There are several adjustments that are beneficial to make to your Gradle build f
as described in step 1.
**Provide app metadata.** This is used by the Corda Gradle build plugin to populate your app JAR with useful information.
It should look like this::
It should look like this:
.. code-block:: groovy
cordapp {
targetPlatformVersion 4

View File

@ -98,9 +98,9 @@ language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['./design/README.md']
exclude_patterns = ['design/README.md']
if tags.has('pdfmode'):
exclude_patterns = ['./design', './design/README.md']
exclude_patterns = ['design', 'design/README.md']
# The reST default role (used for this markup: `text`) to use for all
# documents.
@ -141,7 +141,7 @@ html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_add_permalinks = True
# html_add_permalinks = True
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the

View File

@ -97,7 +97,7 @@ Bank A and Bank B decide to upgrade the contract to ``DummyContractV2``:
.. container:: codeset
.. sourcecode:: kotlin
.. sourcecode:: none
val rpcClient : CordaRPCClient = << Bank A's Corda RPC Client >>
val rpcA = rpcClient.proxy()
@ -109,7 +109,7 @@ Bank A and Bank B decide to upgrade the contract to ``DummyContractV2``:
.. container:: codeset
.. sourcecode:: kotlin
.. sourcecode:: none
val rpcClient : CordaRPCClient = << Bank B's Corda RPC Client >>
val rpcB = rpcClient.proxy()

View File

@ -117,7 +117,8 @@ Let's assume we made a mistake in our summing operation:
The operation now throws a rude exception. If we modify the example flow to use this and run the same test we will get
a lot of logs about the error condition (as we are in dev mode). The interesting bit looks like this:
.. parsed-literal::
.. code-block:: none
[WARN ] 18:38:52,613 [Node thread-1] (DumpHistoryOnErrorInterceptor.kt:39) interceptors.DumpHistoryOnErrorInterceptor.executeTransition - Flow [03ab886e-3fd3-4667-b944-ab6a3b1f90a7] errored, dumping all transitions:
--- Transition of flow [03ab886e-3fd3-4667-b944-ab6a3b1f90a7] ---

View File

@ -153,7 +153,9 @@ You should merge the changes back into Corda as follows:
Developer Certificate of Origin
-------------------------------
All contributions to this project are subject to the terms of the Developer Certificate of Origin, available
`here <https://developercertificate.org/>`_ and reproduced below::
`here <https://developercertificate.org/>`_ and reproduced below:
.. code-block:: none
Developer Certificate of Origin
Version 1.1

View File

@ -138,7 +138,7 @@ database
dataSourceProperties
This section is used to configure the JDBC connection and database driver used for the node's persistence.
:ref:`Node database <standalone_database_config_examples_ref>` contains example configurations for other database providers.
To add additional data source properties (for a specific JDBC driver) use the ``dataSource.`` prefix with the property name (e.g. `dataSource.customProperty = value`).
To add additional data source properties (for a specific JDBC driver) use the ``dataSource.`` prefix with the property name (e.g. ``dataSource.customProperty = value``).
dataSourceClassName
JDBC Data Source class name.
@ -154,7 +154,7 @@ dataSourceProperties
*Default:*
.. parsed-literal::
.. code-block:: none
dataSourceClassName = org.h2.jdbcx.JdbcDataSource
dataSource.url = "jdbc:h2:file:"${baseDirectory}"/persistence;DB_CLOSE_ON_EXIT=FALSE;WRITE_DELAY=0;LOCK_TIMEOUT=10000"
@ -554,6 +554,7 @@ Any options you do not specify in your own ``node.conf`` file will use these def
Here are the contents of the ``reference.conf`` file:
.. literalinclude:: ../../node/src/main/resources/reference.conf
:language: none
Configuration examples
@ -564,11 +565,12 @@ Node configuration hosting the IRSDemo services
General node configuration file for hosting the IRSDemo services
.. literalinclude:: example-code/src/main/resources/example-node.conf
:language: none
Simple notary configuration file
`````````````````````````````````
.. parsed-literal::
.. code-block:: none
myLegalName = "O=Notary Service,OU=corda,L=London,C=GB"
keyStorePassword = "cordacadevpass"
@ -595,5 +597,6 @@ Node configuration with diffrent URL for NetworkMap and Doorman
Configuring a node where the Corda Compatibility Zone's registration and Network Map services exist on different URLs
.. literalinclude:: example-code/src/main/resources/example-node-with-networkservices.conf
:language: none

View File

@ -16,3 +16,4 @@ Nodes
clientrpc
generating-a-node
running-a-node
node-flow-hospital

View File

@ -106,27 +106,23 @@ Developer Notes
Developers wishing to run DemoBench *without* building a new installer each time can install it locally using Gradle:
.. parsed-literal::
.. code-block:: shell
$ gradlew tools:demobench:installDist
$ cd tools/demobench/build/install/demobench
$ bin/demobench
..
Unfortunately, DemoBench's ``$CLASSPATH`` may be too long for the Windows shell . In which case you can still run DemoBench as follows:
.. parsed-literal::
.. code-block:: shell
> java -Djava.util.logging.config.class=net.corda.demobench.config.LoggingConfig -jar lib/demobench-$version.jar
..
While DemoBench *can* be executed within an IDE, it would be up to the Developer to install all of its runtime
dependencies beforehand into their correct locations relative to the value of the ``user.dir`` system property (i.e. the
current working directory of the JVM):
.. parsed-literal::
.. parsed-literal:: none
corda/
corda.jar
@ -136,5 +132,4 @@ current working directory of the JVM):
cordapps/
bank-of-corda.jar
..

View File

@ -34,7 +34,9 @@ handling, and ensures the Corda service is run at boot.
5. Create a directory called ``cordapps`` in ``/opt/corda`` and save your CorDapp jar file to it. Alternatively, download one of
our `sample CorDapps <https://www.corda.net/samples/>`_ to the ``cordapps`` directory
6. Save the below as ``/opt/corda/node.conf``. See :doc:`corda-configuration-file` for a description of these options::
6. Save the below as ``/opt/corda/node.conf``. See :doc:`corda-configuration-file` for a description of these options:
.. code-block:: none
p2pAddress = "example.com:10002"
rpcSettings {
@ -188,7 +190,9 @@ at boot, and means the Corda service stays running with no users connected to th
* A supported Java distribution. The supported versions are listed in :doc:`getting-set-up`
1. Create a Corda directory and download the Corda jar. Here's an
example using PowerShell::
example using PowerShell:
.. code-block:: shell
mkdir C:\Corda
wget http://jcenter.bintray.com/net/corda/corda/|corda_version|/corda-|corda_version|.jar -OutFile C:\Corda\corda.jar
@ -196,7 +200,9 @@ at boot, and means the Corda service stays running with no users connected to th
2. Create a directory called ``cordapps`` in ``C:\Corda\`` and save your CorDapp jar file to it. Alternatively,
download one of our `sample CorDapps <https://www.corda.net/samples/>`_ to the ``cordapps`` directory
3. Save the below as ``C:\Corda\node.conf``. See :doc:`corda-configuration-file` for a description of these options::
3. Save the below as ``C:\Corda\node.conf``. See :doc:`corda-configuration-file` for a description of these options:
.. code-block:: none
p2pAddress = "example.com:10002"
rpcSettings {

View File

@ -163,7 +163,7 @@ Creating the Deterministic SDK
Configuring the Corda Project
#. Open the root ``build.gradle`` file and define this property:
.. code-block:: gradle
.. code-block:: groovy
buildscript {
ext {

View File

@ -26,9 +26,7 @@ class IOUFlowResponder(val otherPartySession: FlowSession) : FlowLogic<Unit>() {
"The IOU's value can't be too high." using (iou.value < 100)
}
}
val expectedTxId = subFlow(signTransactionFlow).id
subFlow(ReceiveFinalityFlow(otherPartySession, expectedTxId))
// DOCEND 01
}

View File

@ -107,7 +107,7 @@ The configuration section is named ``flowOverrides`` and it accepts an array of
.. container:: codeset
.. code-block:: json
.. code-block:: none
flowOverrides {
overrides=[

View File

@ -16,7 +16,7 @@ Let's take a look at the nodes we're going to deploy. Open the project's ``build
``PartyB``), plus a special network map/notary node that is running the network map service and advertises a validating notary
service.
.. code:: bash
.. code-block:: none
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {

View File

@ -298,7 +298,7 @@ Command-line Tool
Open your terminal and navigate to the ``djvm`` directory in the Corda source tree. Then issue the following command:
::
:: shell
$ djvm/shell/install
@ -306,7 +306,7 @@ Open your terminal and navigate to the ``djvm`` directory in the Corda source tr
This will build the DJVM tool and install a shortcut on Bash-enabled systems. It will also generate a Bash completion
file and store it in the ``shell`` folder. This file can be sourced from your Bash initialisation script.
::
:: shell
$ cd ~
$ djvm
@ -314,7 +314,7 @@ file and store it in the ``shell`` folder. This file can be sourced from your Ba
Now, you can create a new Java file from a skeleton that ``djvm`` provides, compile the file, and consequently run it
by issuing the following commands:
::
:: shell
$ djvm new Hello
$ vim tmp/net/corda/sandbox/Hello.java

View File

@ -23,6 +23,7 @@ Note that these points could and should be relaxed as needed.
The load test Main expects a single command line argument that points to a configuration file specifying the cluster hosts and optional overrides for the default configuration:
.. literalinclude:: ../../tools/loadtest/src/main/resources/loadtest-reference.conf
:language: none
Running the load tests
----------------------

View File

@ -163,7 +163,7 @@ A frequent requirement is that configuration files must not expose passwords to
Take a simple node config that wishes to protect the node cryptographic stores:
.. parsed-literal::
.. code-block:: none
myLegalName = "O=PasswordProtectedNode,OU=corda,L=London,C=GB"
keyStorePassword = ${KEY_PASS}

View File

@ -245,9 +245,11 @@ Automatic error codes
Errors generated in Corda are now hashed to produce a unique error code that can be
used to perform a lookup into a knowledge base. The lookup URL will be printed to the logs when an error
occur. Here's an example::
occur. Here's an example:
[ERROR] 2018-12-19T17:18:39,199Z [main] internal.NodeStartupLogging.invoke - Exception during node startup: The name 'O=Wawrzek Test C4, L=London, C=GB' for identity doesn't match what's in the key store: O=Wawrzek Test C4, L=Ely, C=GB [errorCode=wuxa6f, moreInformationAt=https://errors.corda.net/OS/4.0/wuxa6f]
.. code-block:: none
[ERROR] 2018-12-19T17:18:39,199Z [main] internal.NodeStartupLogging.invoke - Exception during node startup: The name 'O=Wawrzek Test C4, L=London, C=GB' for identity doesn't match what's in the key store: O=Wawrzek Test C4, L=Ely, C=GB [errorCode=wuxa6f, moreInformationAt=https://errors.corda.net/OS/4.0/wuxa6f]
The hope is that common error conditions can quickly be resolved and opaque errors explained in a more
user friendly format to facilitate faster debugging and trouble shooting.

View File

@ -46,7 +46,9 @@ anything set earlier.
:Default arguments in capsule: The capsuled corda node has default flags set to ``-Xmx512m -XX:+UseG1GC`` - this gives the node (a relatively
low) 512 MB of heap space and turns on the G1 garbage collector, ensuring low pause times for garbage collection.
:Node configuration: The node configuration file can specify custom default JVM arguments by adding a section like::
:Node configuration: The node configuration file can specify custom default JVM arguments by adding a section like:
.. code-block:: none
custom = {
jvmArgs: [ '-Xmx1G', '-XX:+UseG1GC' ]

View File

@ -24,7 +24,7 @@ couple of resources.
#. Stop the Corda node(s) running on your cloud instance.
.. code:: bash
.. code-block:: bash
ps aux | grep corda.jar | awk '{ print $2 }' | xargs sudo kill
@ -32,7 +32,7 @@ couple of resources.
In the terminal on your cloud instance run:
.. code:: bash
.. code-block:: bash
wget https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases/net/corda/corda-finance-contracts/|corda_version|/corda-finance-contracts-|corda_version|.jar
wget https://ci-artifactory.corda.r3cev.com/artifactory/corda-releases/net/corda/corda-finance-workflows/|corda_version|/corda-finance-workflows-|corda_version|.jar
@ -40,13 +40,13 @@ couple of resources.
This is required to run some flows to check your connections, and to issue/transfer cash to counterparties. Copy it to
the Corda installation location:
.. code:: bash
.. code-block:: bash
sudo cp /home/<USER>/corda-finance-*-|corda_version|.jar /opt/corda/cordapps/
#. Run the following to create a config file for the finance CorDapp:
.. code:: bash
.. code-block:: bash
echo "issuableCurrencies = [ USD ]" > /opt/corda/cordapps/config/corda-finance-|corda_version|.conf

View File

@ -89,7 +89,6 @@ to respond, we need to update its responder flow to first receive the partially
:language: kotlin
:start-after: DOCSTART 01
:end-before: DOCEND 01
:dedent: 8
.. literalinclude:: example-code/src/main/java/net/corda/docs/java/tutorial/twoparty/IOUFlowResponder.java
:language: java

View File

@ -69,7 +69,7 @@ The ``and`` and ``or`` operators can be used to build complex queries. For examp
:language: kotlin
:start-after: DOCSTART AttachmentQueryExample1
:end-before: DOCEND AttachmentQueryExample1
:dedent: 12
:dedent: 8
Protocol
--------

View File

@ -27,7 +27,7 @@ as ``ValidatingNotaryFlow``, ``NonValidatingNotaryFlow``, or implement your own
To enable the service, add the following to the node configuration:
.. parsed-literal::
.. code-block:: none
notary : {
validating : true # Set to false if your service is non-validating

View File

@ -180,7 +180,7 @@ When run, that code produces the following error:
.. sourcecode:: kotlin
net.corda.core.contracts.TransactionVerificationException$ContractRejection: java.lang.IllegalArgumentException: Failed requirement: the state is propagated
"net.corda.core.contracts.TransactionVerificationException$ContractRejection: java.lang.IllegalArgumentException: Failed requirement: the state is propagated"
.. sourcecode:: java

View File

@ -66,7 +66,7 @@ Module one - cordapp-contracts-states
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is the structure of the ``src`` directory for the ``cordapp-contracts-states`` module of the Java template:
.. parsed-literal::
.. code-block:: none
.
└── main
@ -88,7 +88,7 @@ Module two - cordapp
~~~~~~~~~~~~~~~~~~~~
Here is the structure of the ``src`` directory for the ``cordapp`` module of the Java template:
.. parsed-literal::
.. code-block:: none
.
├── main