From 17544934903de6105165e23921bf9c9aca5bc7e2 Mon Sep 17 00:00:00 2001 From: Clinton Alexander Date: Mon, 10 Oct 2016 16:25:48 +0100 Subject: [PATCH] Fixed review issues. --- docs/source/creating-a-cordapp.rst | 107 ++++++++++++++---- gradle-plugins/cordformation/README.rst | 59 +--------- .../resources/com/r3corda/plugins/runnodes | 3 +- gradle-plugins/publish-utils/README.rst | 4 - gradle-plugins/quasar-utils/README.rst | 5 - 5 files changed, 87 insertions(+), 91 deletions(-) diff --git a/docs/source/creating-a-cordapp.rst b/docs/source/creating-a-cordapp.rst index 6f21e3dfb4..e90ded7468 100644 --- a/docs/source/creating-a-cordapp.rst +++ b/docs/source/creating-a-cordapp.rst @@ -106,23 +106,6 @@ root directory of Corda This will publish corda-$version.jar, contracts-$version.jar, core-$version.jar and node-$version.jar to the group com.r3corda. You can now depend on these as you normally would a Maven dependency. -In Gradle you can depend on these by adding/modifying your build.gradle file to contain the following: - -.. code-block:: groovy - - repositories { - mavenLocal() - ... other repositories here ... - } - - dependencies { - compile "com.r3corda:core:$corda_version" - compile "com.r3corda:contracts:$corda_version" - compile "com.r3corda:node:$corda_version" - compile "com.r3corda:corda:$corda_version" - ... other dependencies here ... - } - Gradle Plugins for Cordapps =========================== @@ -147,24 +130,102 @@ Using Gradle Plugins To use the plugins, if you are not already using the Cordapp template project, you must modify your build.gradle. Add the following segments to the relevant part of your build.gradle. -.. code-block:: +Template Build.gradle +===================== + +To build against Corda and the plugins that cordapps use, update your build.gradle to contain the following: + +.. code-block:: groovy buildscript { ext.corda_version = '' - ... (your buildscript) + ... your buildscript ... repositories { - ... (other repositories) + ... other repositories ... mavenLocal() } dependencies { - ... (your dependencies) - classpath "com.r3corda.plugins::$corda_version" + ... your dependencies ... + classpath "com.r3corda.plugins:cordformation:$corda_version" + classpath "com.r3corda.plugins:quasar-utils:$corda_version" + classpath "com.r3corda.plugins:publish-utils:$corda_version" } } - apply plugin: 'com.r3corda.plugins.' + apply plugin: 'com.r3corda.plugins.cordformation' + apply plugin: 'com.r3corda.plugins.quasar-utils' + apply plugin: 'com.r3corda.plugins.publish-utils' + + repositories { + mavenLocal() + ... other repositories here ... + } + + dependencies { + compile "com.r3corda:core:$corda_version" + compile "com.r3corda:contracts:$corda_version" + compile "com.r3corda:node:$corda_version" + compile "com.r3corda:corda:$corda_version" + ... other dependencies here ... + } + +.. code-block:: ... +Cordformation +============= + +Cordformation is the local node deployment system for Cordapps, the nodes generated are intended to be used for +experimenting, debugging, and testing node configurations and setups but not intended for production or testnet +deployment. + +To use this plugin you must add a new task that is of the type `com.r3corda.plugins.Cordform` and then configure +the nodes you wish to deploy with the Node and nodes configuration DSL. This DSL is specified in the +`JavaDoc `_. An example of this is in the template-cordapp and below is a three node example; + +.. code-block:: text + + task deployNodes(type: com.r3corda.plugins.Cordform, dependsOn: ['build']) { + directory "./build/nodes" // The output directory + networkMap "Notary" // The artemis address of the node named here will be used as the networkMapAddress on all other nodes. + node { + name "Notary" + dirName "notary" + nearestCity "London" + notary true // Sets this node to be a notary + advertisedServices = [] + artemisPort 12345 + webPort 12346 + cordapps = [] + } + node { + name "NodeA" + dirName "nodea" + nearestCity "London" + advertisedServices = [] + artemisPort 31337 + webPort 31339 + cordapps = [] + } + node { + name "NodeB" + dirName "nodeb" + nearestCity "New York" + advertisedServices = [] + artemisPort 31338 + webPort 31340 + cordapps = [] + } + } + +You can create more configurations with new tasks that extend Cordform. + +New nodes can be added by simply adding another node block and giving it a different name, directory and ports. When you +run this task it will install the nodes to the directory specified and a script will be generated (for UNIX users only +at present) to run the nodes with one command. + +Other cordapps can also be specified if they are already specified as classpath or compile dependencies in your +build.gradle. \ No newline at end of file diff --git a/gradle-plugins/cordformation/README.rst b/gradle-plugins/cordformation/README.rst index ab9f91bd76..77671f5a26 100644 --- a/gradle-plugins/cordformation/README.rst +++ b/gradle-plugins/cordformation/README.rst @@ -1,58 +1 @@ -Cordformation -============= - -Plugin Maven Name:: - - cordformation - -Cordformation is the local node deployment system for Cordapps, the nodes generated are intended to be used for -experimenting, debugging, and testing node configurations and setups but not intended for production or testnet -deployment. - -To use this plugin you must add a new task that is of the type `com.r3corda.plugins.Cordform` and then configure -the nodes you wish to deploy with the Node and nodes configuration DSL. This DSL is specified in the JavaDoc but -an example of this is in the template-cordapp and below is a three node example; - -.. code-block:: text - - task deployNodes(type: com.r3corda.plugins.Cordform, dependsOn: ['build']) { - directory "./build/nodes" // The output directory - networkMap "Notary" // The artemis address of the node named here will be used as the networkMapAddress on all other nodes. - node { - name "Notary" - dirName "notary" - nearestCity "London" - notary true // Sets this node to be a notary - advertisedServices = [] - artemisPort 12345 - webPort 12346 - cordapps = [] - } - node { - name "NodeA" - dirName "nodea" - nearestCity "London" - advertisedServices = [] - artemisPort 31337 - webPort 31339 - cordapps = [] - } - node { - name "NodeB" - dirName "nodeb" - nearestCity "New York" - advertisedServices = [] - artemisPort 31338 - webPort 31340 - cordapps = [] - } - } - -You can create more configurations with new tasks that extend Cordform. - -New nodes can be added by simply adding another node block and giving it a different name, directory and ports. When you -run this task it will install the nodes to the directory specified and a script will be generated (for UNIX users only -at present) to run the nodes with one command. - -Other cordapps can also be specified if they are already specified as classpath or compile dependencies in your -build.gradle. \ No newline at end of file +Please refer to the documentation in /doc/build/html/creating-a-cordapp.html#cordformation. \ No newline at end of file diff --git a/gradle-plugins/cordformation/src/main/resources/com/r3corda/plugins/runnodes b/gradle-plugins/cordformation/src/main/resources/com/r3corda/plugins/runnodes index 0e35591945..9db806a649 100644 --- a/gradle-plugins/cordformation/src/main/resources/com/r3corda/plugins/runnodes +++ b/gradle-plugins/cordformation/src/main/resources/com/r3corda/plugins/runnodes @@ -1,8 +1,9 @@ #!/usr/bin/env bash # Will attempt to execute a corda node within all subdirectories in the current working directory. +# TODO: Use screens or separate windows when starting instances. set -euo pipefail -trap 'kill $(jobs -p)' SIGINT SIGTERM EXIT +trap 'kill $(jobs -p)' EXIT export CAPSULE_CACHE_DIR=cache function runNode { diff --git a/gradle-plugins/publish-utils/README.rst b/gradle-plugins/publish-utils/README.rst index a83a37361b..e75667abc9 100644 --- a/gradle-plugins/publish-utils/README.rst +++ b/gradle-plugins/publish-utils/README.rst @@ -1,10 +1,6 @@ Publish Utils ============= -Plugin Maven Name:: - - publish-utils - Publishing utilities adds a couple of tasks to any project it is applied to that hide some boilerplate that would otherwise be placed in the Cordapp template's build.gradle. diff --git a/gradle-plugins/quasar-utils/README.rst b/gradle-plugins/quasar-utils/README.rst index eb13e17bdf..f542385326 100644 --- a/gradle-plugins/quasar-utils/README.rst +++ b/gradle-plugins/quasar-utils/README.rst @@ -1,11 +1,6 @@ Quasar Utils ============ - -Plugin Maven Name:: - - quasar-utils - Quasar utilities adds several tasks and configuration that provide a default Quasar setup and removes some boilerplate. One line must be added to your build.gradle once you apply this plugin: