CORDA-2331 Split Workflow and contracts of Finance App into separate Cordapps (#4422)

* Split Workflow and contracts of Finance App into separate Cordapps, part 1 - content which is different between OS and ENT is still in contract Cordapp.

* Move CashSelection implementations to workflow module.

* Move CashSelection implmentations to workflow module.

* Move finance module to finance-flows, top level finance module is empty.

* Move finance module to finance-flows, top level finance module is empty.

* Updated build comment.

* Revert publication of combined (contracts and flows) corda-finance.jar (to maintain backwards compatibility with 3rd party cordapps dependent on finance)

* Added backwards compatibility clarification comment.

* Re-instate new cordapp metadata.

* Global rename of `finance-flows` to `finance-workflows` to follow adopted naming conventions.

* Addressed final review comments.

* Rename application to "Corda Finance Demo"

* Generation of original corda-finance jar from new sub-modules.

* Fixed and tested demobench with new split finance contract and workflow jars.

* Renamed finance sub-modules to contracts and workflows.

* Remove Michele!!!

* Minor fix to filtering logic.

* Align CorDapp configuration filename with workflows jar.

* Fix breaks caused by finance module naming changes.

* Final alignment between OS/ENT of finance contract code.
This commit is contained in:
szymonsztuka 2018-12-19 18:02:51 +00:00 committed by josecoll
parent a4037b374d
commit 4aaefb4fe9
92 changed files with 299 additions and 129 deletions

View File

@ -2,4 +2,4 @@
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
</component>

20
.idea/compiler.xml generated
View File

@ -42,6 +42,10 @@
<module name="corda-core_integrationTest" target="1.8" />
<module name="corda-core_smokeTest" target="1.8" />
<module name="corda-finance_integrationTest" target="1.8" />
<module name="corda-project_buildSrc_main" target="1.8" />
<module name="corda-project_buildSrc_test" target="1.8" />
<module name="corda-project_canonicalizer_main" target="1.8" />
<module name="corda-project_canonicalizer_test" target="1.8" />
<module name="corda-project_main" target="1.8" />
<module name="corda-project_test" target="1.8" />
<module name="corda-smoke-test-utils_main" target="1.8" />
@ -100,6 +104,16 @@
<module name="explorer-capsule_test" target="1.6" />
<module name="explorer_main" target="1.8" />
<module name="explorer_test" target="1.8" />
<module name="finance-contracts-states_main" target="1.8" />
<module name="finance-contracts-states_test" target="1.8" />
<module name="finance-contracts_main" target="1.8" />
<module name="finance-contracts_test" target="1.8" />
<module name="finance-flows_integrationTest" target="1.8" />
<module name="finance-flows_main" target="1.8" />
<module name="finance-flows_test" target="1.8" />
<module name="finance-workflows_integrationTest" target="1.8" />
<module name="finance-workflows_main" target="1.8" />
<module name="finance-workflows_test" target="1.8" />
<module name="finance_integrationTest" target="1.8" />
<module name="finance_main" target="1.8" />
<module name="finance_test" target="1.8" />
@ -138,6 +152,10 @@
<module name="loadtest_test" target="1.8" />
<module name="mock_main" target="1.8" />
<module name="mock_test" target="1.8" />
<module name="net.corda-blobinspector_main" target="1.8" />
<module name="net.corda-blobinspector_test" target="1.8" />
<module name="net.corda-finance-contracts-states_main" target="1.8" />
<module name="net.corda-finance-contracts-states_test" target="1.8" />
<module name="net.corda-verifier_main" target="1.8" />
<module name="net.corda-verifier_test" target="1.8" />
<module name="net.corda_buildSrc_main" target="1.8" />
@ -193,6 +211,8 @@
<module name="shell_integrationTest" target="1.8" />
<module name="shell_main" target="1.8" />
<module name="shell_test" target="1.8" />
<module name="simm-valuation-demo-contracts-states_main" target="1.8" />
<module name="simm-valuation-demo-contracts-states_test" target="1.8" />
<module name="simm-valuation-demo_integrationTest" target="1.8" />
<module name="simm-valuation-demo_main" target="1.8" />
<module name="simm-valuation-demo_test" target="1.8" />

View File

@ -302,7 +302,8 @@ dependencies {
runtime project(':client:rpc')
runtime project(':core')
runtime project(':confidential-identities')
runtime project(':finance')
runtime project(':finance:workflows')
runtime project(':finance:contracts')
runtime project(':webserver')
testCompile project(':test-utils')
}
@ -362,7 +363,9 @@ bintrayConfig {
'corda-deterministic-verifier',
'corda-djvm',
'corda',
'corda-finance',
'corda-finance', // maintained for backwards compatibility only
'corda-finance-workflows',
'corda-finance-contracts',
'corda-node',
'corda-node-api',
'corda-test-common',

View File

@ -26,7 +26,8 @@ sourceSets {
dependencies {
compile project(':core')
compile project(':finance')
compile project(':finance:contracts')
compile project(':finance:workflows')
compile project(':client:rpc')
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

View File

@ -10,7 +10,8 @@ description 'Corda client mock modules'
dependencies {
compile project(":core")
compile project(':finance')
compile project(':finance:workflows')
compile project(':finance:contracts')
// Unit testing helpers.
testCompile "junit:junit:$junit_version"

View File

@ -56,8 +56,11 @@ processSmokeTestResources {
from(project(':node:capsule').tasks['buildCordaJAR']) {
rename 'corda-(.*)', 'corda.jar'
}
from(project(':finance').tasks['jar']) {
rename 'finance-(.*)', 'finance.jar'
from(project(':finance:workflows').tasks['jar']) {
rename 'finance-workflows-(.*)', 'finance-workflows.jar'
}
from(project(':finance:contracts').tasks['jar']) {
rename 'finance-contracts-(.*)', 'finance-contracts.jar'
}
}
@ -82,7 +85,8 @@ dependencies {
// Smoke tests do NOT have any Node code on the classpath!
smokeTestCompile project(':smoke-test-utils')
smokeTestCompile project(':finance')
smokeTestCompile project(':finance:contracts')
smokeTestCompile project(':finance:workflows')
smokeTestCompile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
smokeTestCompile "org.apache.logging.log4j:log4j-core:$log4j_version"
smokeTestCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"

View File

@ -89,10 +89,10 @@ class StandaloneCordaRPClientTest {
private fun copyFinanceCordapp() {
val cordappsDir = (factory.baseDirectory(notaryConfig) / NodeProcess.CORDAPPS_DIR_NAME).createDirectories()
// Find the finance jar file for the smoke tests of this module
val financeJar = Paths.get("build", "resources", "smokeTest").list {
it.filter { "corda-finance" in it.toString() }.toList().single()
val financeJars = Paths.get("build", "resources", "smokeTest").list {
it.filter { "corda-finance" in it.toString() }.toList()
}
financeJar.copyToDirectory(cordappsDir)
financeJars.forEach { it.copyToDirectory(cordappsDir) }
}

View File

@ -5,7 +5,10 @@ dependencies {
testCompile project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts')
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'deterministicArtifacts')
testCompile project(path: ':core-deterministic:testing:data', configuration: 'testData')
testCompile(project(':finance')) {
testCompile(project(':finance:contracts')) {
transitive = false
}
testCompile(project(':finance:workflows')) {
transitive = false
}

View File

@ -6,7 +6,7 @@ configurations {
dependencies {
testCompile project(':core')
testCompile project(':finance')
testCompile project(':finance:workflows')
testCompile project(':node-driver')
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'runtimeArtifacts')

View File

@ -20,7 +20,7 @@ def internalPackagePrefixes(sourceDirs) {
ext {
// TODO: Add '../client/jfx/src/main/kotlin' and '../client/mock/src/main/kotlin' if we decide to make them into public API
dokkaSourceDirs = files('../core/src/main/kotlin', '../client/rpc/src/main/kotlin', '../finance/src/main/kotlin', '../client/jackson/src/main/kotlin',
dokkaSourceDirs = files('../core/src/main/kotlin', '../client/rpc/src/main/kotlin', '../finance/workflows/src/main/kotlin', '../finance/contracts/src/main/kotlin', '../client/jackson/src/main/kotlin',
'../testing/test-utils/src/main/kotlin', '../testing/node-driver/src/main/kotlin')
internalPackagePrefixes = internalPackagePrefixes(dokkaSourceDirs)
}

View File

@ -41,8 +41,9 @@ dependencies {
compile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
// Corda Plugins: dependent flows and services
compile project(':finance')
// CorDapps: dependent flows and services
compile project(':finance:contracts')
compile project(':finance:workflows')
}
mainClassName = "net.corda.docs.ClientRpcTutorialKt"

View File

@ -58,7 +58,8 @@ dependencies {
compile "com.spotify:docker-client:$docker_client_version"
compile "io.reactivex:rxjava:$rxjava_version"
compile project(':finance')
compile project(':finance:contracts')
compile project(':finance:workflows')
compile project(':node-api')
compile project(':client:rpc')

View File

@ -12,7 +12,8 @@ compileTestKotlin {
dependencies {
compile project(':core')
compile project(':finance')
compile project(':finance:contracts')
compile project(':finance:workflows')
// ObjectWeb Asm: a library for synthesising and working with JVM bytecode.
compile "org.ow2.asm:asm:$asm_version"

View File

@ -10,77 +10,45 @@ apply plugin: 'com.jfrog.artifactory'
description 'Corda finance modules'
sourceSets {
integrationTest {
kotlin {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/kotlin')
}
resources {
srcDir file('src/integration-test/resources')
}
}
}
/**
* NOTE: this build.gradle file is maintained for backwards compatibility purposes.
* It will build a `corda-finance.jar` including all Contracts and Flows.
* From Corda 4 it is strongly recommended that CorDapps dependent on the `corda-finance.jar`
* explicitly declare dependencies on either/both of the corda finance sub-modules:
* corda-finance-contract => generates `corda-finance-contract.jar`
* corda-finance-workflows => generates `corda-finance-workflows.jar`
* Third party CorDapps should remember to include these sub-module dependencies using the `cordapp` Corda Gradle plug-in
* cordapp project(':finance:workflows')
* cordapp project(':finance:contracts')
*/
dependencies {
// Note the :finance module is a CorDapp in its own right
// and CorDapps using :finance features should use 'cordapp' not 'compile' linkage.
cordaCompile project(':core')
compile project(':confidential-identities')
// For JSON
compile "com.fasterxml.jackson.core:jackson-databind:${jackson_version}"
testCompile project(':test-utils')
testCompile project(path: ':core', configuration: 'testArtifacts')
testCompile "junit:junit:$junit_version"
// AssertJ: for fluent assertions for testing
testCompile "org.assertj:assertj-core:$assertj_version"
}
configurations {
testArtifacts.extendsFrom testRuntime
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
task testJar(type: Jar) {
classifier "tests"
from sourceSets.test.output
}
task integrationTest(type: Test, dependsOn: []) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}
artifacts {
testArtifacts testJar
}
def mainProjects = [':finance:contracts',':finance:workflows', ':confidential-identities']
jar.dependsOn mainProjects.collect{ it+":compileJava"}
jar {
baseName 'corda-finance'
from files(mainProjects.collect{ project(it).sourceSets.main.output })
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
cordapp {
signing {
enabled false
}
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
contract {
name "net/corda/finance/contracts"
name "Corda Finance Demo"
versionId 1
vendor "R3"
licence "Open Source (Apache 2)"
}
workflow {
name "net/corda/finance/flows"
name "Corda Finance Demo"
versionId 1
vendor "R3"
licence "Open Source (Apache 2)"
}
// By default the Cordapp is signed by Corda development certificate, for production build pass the following system properties to Gradle to use specific keystore e.g:
// ./gradlew -Dsigning.enabled="true" -Dsigning.keystore="/path/to/keystore.jks" -Dsigning.alias="alias" -Dsigning.storepass="password" -Dsigning.keypass="password"
}
publish {

View File

@ -0,0 +1,62 @@
apply plugin: 'kotlin'
// Java Persistence API support: create no-arg constructor
// see: http://stackoverflow.com/questions/32038177/kotlin-with-jpa-default-constructor-hell
apply plugin: 'kotlin-jpa'
apply plugin: CanonicalizerPlugin
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'com.jfrog.artifactory'
description 'Corda finance module - contracts'
dependencies {
// Note: 3rd party CorDapps should remember to include the relevant Finance CorDapp dependencies using `cordapp`
// cordapp project(':finance:workflows')
// cordapp project(':finance:contracts')
cordaCompile project(':core')
compile project(':confidential-identities')
// For JSON
compile "com.fasterxml.jackson.core:jackson-databind:${jackson_version}"
testCompile project(':test-utils')
testCompile project(path: ':core', configuration: 'testArtifacts')
testCompile "junit:junit:$junit_version"
// AssertJ: for fluent assertions for testing
testCompile "org.assertj:assertj-core:$assertj_version"
}
configurations {
testArtifacts.extendsFrom testRuntime
}
task testJar(type: Jar) {
classifier "tests"
from sourceSets.test.output
}
jar {
baseName 'corda-finance-contracts'
}
artifacts {
testArtifacts testJar
}
cordapp {
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
contract {
name "Corda Finance Demo"
versionId 1
vendor "R3"
licence "Open Source (Apache 2)"
}
// By default the Cordapp is signed by Corda development certificate, for production build pass the following system properties to Gradle to use specific keystore e.g:
// ./gradlew -Dsigning.enabled="true" -Dsigning.keystore="/path/to/keystore.jks" -Dsigning.alias="alias" -Dsigning.storepass="password" -Dsigning.keypass="password"
}
publish {
name jar.baseName
}

View File

@ -1,4 +1,4 @@
package net.corda.finance.contracts.asset.cash.selection
package net.corda.finance.contracts.asset
import co.paralleluniverse.fibers.Suspendable
import net.corda.core.contracts.Amount
@ -12,7 +12,6 @@ import net.corda.core.internal.uncheckedCast
import net.corda.core.node.ServiceHub
import net.corda.core.node.services.StatesNotAvailableException
import net.corda.core.utilities.*
import net.corda.finance.contracts.asset.Cash
import java.sql.Connection
import java.sql.DatabaseMetaData
import java.sql.ResultSet
@ -21,11 +20,13 @@ import java.util.concurrent.atomic.AtomicReference
/**
* Pluggable interface to allow for different cash selection provider implementations
* Default implementation [CashSelectionH2Impl] uses H2 database and a custom function within H2 to perform aggregation.
* Default implementation in finance workflow module uses H2 database and a custom function within H2 to perform aggregation.
* Custom implementations must implement this interface and declare their implementation in
* META-INF/services/net.corda.contracts.asset.CashSelection
*/
abstract class AbstractCashSelection {
// TODO: make parameters configurable when we get CorDapp configuration.
abstract class AbstractCashSelection(private val maxRetries : Int = 8, private val retrySleep : Int = 100,
private val retryCap : Int = 2000) {
companion object {
val instance = AtomicReference<AbstractCashSelection>()
@ -46,12 +47,6 @@ abstract class AbstractCashSelection {
private val log = contextLogger()
}
// coin selection retry loop counter, sleep (msecs) and lock for selecting states
// TODO: make parameters configurable when we get CorDapp configuration.
private val MAX_RETRIES = 8
private val RETRY_SLEEP = 100
private val RETRY_CAP = 2000
/**
* Upon dynamically loading configured Cash Selection algorithms declared in META-INF/services
* this method determines whether the loaded implementation is compatible and usable with the currently
@ -102,13 +97,13 @@ abstract class AbstractCashSelection {
val stateAndRefs = mutableListOf<StateAndRef<Cash.State>>()
// DOCSTART CASHSELECT 1
for (retryCount in 1..MAX_RETRIES) {
for (retryCount in 1..maxRetries) {
if (!attemptSpend(services, amount, lockId, notary, onlyFromIssuerParties, withIssuerRefs, stateAndRefs)) {
log.warn("Coin selection failed on attempt $retryCount")
// TODO: revisit the back off strategy for contended spending.
if (retryCount != MAX_RETRIES) {
if (retryCount != maxRetries) {
stateAndRefs.clear()
val durationMillis = (minOf(RETRY_SLEEP.shl(retryCount), RETRY_CAP / 2) * (1.0 + Math.random())).toInt()
val durationMillis = (minOf(retrySleep.shl(retryCount), retryCap / 2) * (1.0 + Math.random())).toInt()
FlowLogic.sleep(durationMillis.millis)
} else {
log.warn("Insufficient spendable states identified for $amount")
@ -167,4 +162,4 @@ abstract class AbstractCashSelection {
}
return false
}
}
}

View File

@ -16,10 +16,8 @@ import net.corda.core.node.ServiceHub
import net.corda.core.schemas.MappedSchema
import net.corda.core.schemas.PersistentState
import net.corda.core.schemas.QueryableState
import net.corda.core.serialization.SerializableCalculatedProperty
import net.corda.core.transactions.LedgerTransaction
import net.corda.core.transactions.TransactionBuilder
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
import net.corda.finance.schemas.CashSchemaV1
import net.corda.finance.utils.sumCash
import net.corda.finance.utils.sumCashOrNull

View File

@ -0,0 +1,88 @@
apply plugin: 'kotlin'
// Java Persistence API support: create no-arg constructor
// see: http://stackoverflow.com/questions/32038177/kotlin-with-jpa-default-constructor-hell
apply plugin: 'kotlin-jpa'
apply plugin: CanonicalizerPlugin
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'com.jfrog.artifactory'
description 'Corda finance module - flows'
sourceSets {
integrationTest {
kotlin {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/kotlin')
}
resources {
srcDir file('src/integration-test/resources')
}
}
}
dependencies {
// Note: 3rd party CorDapps should remember to include the relevant Finance CorDapp dependencies using `cordapp`
// cordapp project(':finance:workflows')
// cordapp project(':finance:contracts')
cordaCompile project(':core')
compile project(':confidential-identities')
cordapp project(':finance:contracts')
testCompile project(':test-utils')
testCompile project(path: ':core', configuration: 'testArtifacts')
testCompile "junit:junit:$junit_version"
// AssertJ: for fluent assertions for testing
testCompile "org.assertj:assertj-core:$assertj_version"
}
configurations {
testArtifacts.extendsFrom testRuntime
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
task testJar(type: Jar) {
classifier "tests"
from sourceSets.test.output
}
task integrationTest(type: Test, dependsOn: []) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}
artifacts {
testArtifacts testJar
}
jar {
baseName 'corda-finance-workflows'
}
configurations {
testArtifacts.extendsFrom testRuntime
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
cordapp {
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
workflow {
name "Corda Finance Demo"
versionId 1
vendor "R3"
licence "Open Source (Apache 2)"
}
// By default the Cordapp is signed by Corda development certificate, for production build pass the following system properties to Gradle to use specific keystore e.g:
// ./gradlew -Dsigning.enabled="true" -Dsigning.keystore="/path/to/keystore.jks" -Dsigning.alias="alias" -Dsigning.storepass="password" -Dsigning.keypass="password"
}
publish {
name jar.baseName
}

View File

@ -7,6 +7,7 @@ import net.corda.core.identity.Party
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.contextLogger
import net.corda.core.utilities.debug
import net.corda.finance.contracts.asset.AbstractCashSelection
import java.sql.Connection
import java.sql.DatabaseMetaData
import java.sql.ResultSet

View File

@ -7,6 +7,7 @@ import net.corda.core.identity.Party
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.contextLogger
import net.corda.core.utilities.debug
import net.corda.finance.contracts.asset.AbstractCashSelection
import java.sql.Connection
import java.sql.DatabaseMetaData
import java.sql.ResultSet

View File

@ -7,6 +7,7 @@ import net.corda.core.identity.Party
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.contextLogger
import net.corda.core.utilities.debug
import net.corda.finance.contracts.asset.AbstractCashSelection
import java.sql.Connection
import java.sql.DatabaseMetaData
import java.sql.ResultSet

View File

@ -13,7 +13,7 @@ import net.corda.core.transactions.TransactionBuilder
import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.ProgressTracker
import net.corda.finance.contracts.asset.Cash
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
import net.corda.finance.contracts.asset.AbstractCashSelection
import net.corda.finance.flows.AbstractCashFlow.Companion.FINALISING_TX
import net.corda.finance.flows.AbstractCashFlow.Companion.GENERATING_TX
import net.corda.finance.flows.AbstractCashFlow.Companion.SIGNING_TX

View File

@ -1,4 +1,4 @@
package net.corda.finance.contracts.asset.cash.selection
package net.corda.finance.contracts.asset.selection
import net.corda.core.internal.concurrent.transpose
import net.corda.core.utilities.OpaqueBytes

View File

@ -8,7 +8,7 @@ import net.corda.core.utilities.OpaqueBytes
import net.corda.core.utilities.getOrThrow
import net.corda.finance.DOLLARS
import net.corda.finance.contracts.asset.Cash
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
import net.corda.finance.contracts.asset.AbstractCashSelection
import net.corda.finance.contracts.getCashBalance
import net.corda.finance.issuedBy
import net.corda.testing.core.singleIdentity

View File

@ -128,11 +128,12 @@ dependencies {
testCompile "org.assertj:assertj-core:${assertj_version}"
testCompile project(':test-utils')
testCompile project(':client:jfx')
testCompile project(':finance')
testCompile project(':finance:contracts')
testCompile project(':finance:workflows')
testCompile project(':finance:isolated')
// sample test schemas
testCompile project(path: ':finance', configuration: 'testArtifacts')
testCompile project(path: ':finance:contracts', configuration: 'testArtifacts')
// For H2 database support in persistence
compile "com.h2database:h2:$h2_version"

View File

@ -18,7 +18,7 @@ import net.corda.finance.contracts.CommercialPaper
import net.corda.finance.contracts.Commodity
import net.corda.finance.contracts.DealState
import net.corda.finance.contracts.asset.Cash
import net.corda.finance.contracts.asset.cash.selection.AbstractCashSelection
import net.corda.finance.contracts.asset.AbstractCashSelection
import net.corda.finance.schemas.CashSchemaV1
import net.corda.finance.schemas.CashSchemaV1.PersistentCashState
import net.corda.finance.schemas.CommercialPaperSchemaV1

View File

@ -9,7 +9,8 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// The bank of corda CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
cordapp project(':finance:contracts')
cordapp project(':finance:workflows')
// Corda integration dependencies
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
@ -34,7 +35,8 @@ def nodeTask = tasks.getByPath(':node:capsule:assemble')
def webTask = tasks.getByPath(':webserver:webcapsule:assemble')
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) {
nodeDefaults {
cordapp project(':finance')
cordapp project(':finance:workflows')
cordapp project(':finance:contracts')
}
node {
name "O=Notary Service,L=Zurich,C=CH"
@ -58,7 +60,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
extraConfig = [
h2Settings: [address: "localhost:10017"]
]
cordapp(project(':finance')) {
cordapp(project(':finance:workflows')) {
config "issuableCurrencies = [ USD ]"
}
}

View File

@ -25,7 +25,8 @@ configurations {
dependencies {
// The irs demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
cordapp project(':finance:contracts')
cordapp project(':finance:workflows')
// Corda integration dependencies
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
@ -65,7 +66,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask])
address("localhost:10003")
adminAddress("localhost:10023")
}
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
rpcUsers = rpcUsersList
useTestClock true
extraConfig = ['h2Settings.address' : 'localhost:10024']
@ -77,7 +78,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask])
address("localhost:10006")
adminAddress("localhost:10026")
}
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
rpcUsers = rpcUsersList
useTestClock true
extraConfig = ['h2Settings.address' : 'localhost:10027']
@ -89,7 +90,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask])
address("localhost:10009")
adminAddress("localhost:10029")
}
cordapps = ["${project.group}:finance:$corda_release_version"]
cordapps = ["${project.group}:contracts:$corda_release_version", "${project.group}:workflows:$corda_release_version"]
rpcUsers = rpcUsersList
useTestClock true
extraConfig = ['h2Settings.address' : 'localhost:10030']
@ -101,8 +102,8 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask])
address("localhost:10012")
adminAddress("localhost:10032")
}
cordapps = ["${project.group}:finance:$corda_release_version"]
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
cordapps = ["${project.group}:contracts:$corda_release_version", "${project.group}:workflows:$corda_release_version"]
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
rpcUsers = rpcUsersList
useTestClock true
extraConfig = ['h2Settings.address' : 'localhost:10033']
@ -115,25 +116,25 @@ task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar', n
node {
name "O=Notary Service,L=Zurich,C=CH"
notary = [validating : true]
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
rpcUsers = rpcUsersList
useTestClock true
}
node {
name "O=Bank A,L=London,C=GB"
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
rpcUsers = rpcUsersList
useTestClock true
}
node {
name "O=Bank B,L=New York,C=US"
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
cordapps = ["${project(":finance").group}:contracts:$corda_release_version", "${project(":finance").group}:workflows:$corda_release_version"]
rpcUsers = rpcUsersList
useTestClock true
}
node {
name "O=Regulator,L=Moscow,C=RU"
cordapps = ["${project.group}:finance:$corda_release_version"]
cordapps = ["${project.group}:contracts:$corda_release_version", "${project.group}:workflows:$corda_release_version"]
rpcUsers = rpcUsersList
useTestClock true
}

View File

@ -29,7 +29,8 @@ dependencies {
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// The SIMM demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
cordapp project(':finance:contracts')
cordapp project(':finance:workflows')
cordapp project(path: ':samples:simm-valuation-demo:contracts-states', configuration: 'shrinkArtifacts')
cordapp project(':samples:simm-valuation-demo:flows')
@ -66,7 +67,8 @@ def webTask = tasks.getByPath(':webserver:webcapsule:assemble')
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, webTask]) {
directory file("$buildDir/nodes")
nodeDefaults {
cordapp project(':finance')
cordapp project(':finance:contracts')
cordapp project(':finance:workflows')
cordapp project(':samples:simm-valuation-demo:contracts-states')
cordapp project(':samples:simm-valuation-demo:flows')
rpcUsers = [['username': "default", 'password': "default", 'permissions': [ 'ALL' ]]]

View File

@ -30,7 +30,7 @@ dependencies {
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// The SIMM demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
cordapp project(':finance:contracts')
// Corda integration dependencies
cordaCompile project(':core')

View File

@ -20,7 +20,8 @@ dependencies {
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// The SIMM demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
cordapp project(':finance:workflows')
cordapp project(':finance:contracts')
cordapp project(path: ':samples:simm-valuation-demo:contracts-states', configuration: 'shrinkArtifacts')
// Corda integration dependencies

View File

@ -23,7 +23,8 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// The trader demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
cordapp project(':finance:contracts')
cordapp project(':finance:workflows')
// Corda integration dependencies
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
@ -54,12 +55,12 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
adminAddress "localhost:10004"
}
extraConfig = ['h2Settings.address' : 'localhost:10014']
cordapps = ["$project.group:finance:$corda_release_version"]
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
}
node {
name "O=Bank A,L=London,C=GB"
p2pPort 10005
cordapps = ["$project.group:finance:$corda_release_version"]
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
rpcUsers = ext.rpcUsers
rpcSettings {
address "localhost:10006"
@ -70,7 +71,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
node {
name "O=Bank B,L=New York,C=US"
p2pPort 10008
cordapps = ["$project.group:finance:$corda_release_version"]
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
rpcUsers = ext.rpcUsers
rpcSettings {
address "localhost:10009"
@ -81,7 +82,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
node {
name "O=BankOfCorda,L=New York,C=US"
p2pPort 10011
cordapps = ["$project.group:finance:$corda_release_version"]
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
rpcUsers = ext.rpcUsers
rpcSettings {
address "localhost:10012"
@ -94,7 +95,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask,
node {
name "O=LoggingBank,L=London,C=GB"
p2pPort 10025
cordapps = ["$project.group:finance:$corda_release_version"]
cordapps = ["$project.group:workflows:$corda_release_version", "$project.group:contracts:$corda_release_version"]
rpcUsers = ext.rpcUsers
rpcSettings {
address "localhost:10026"

View File

@ -2,7 +2,9 @@
// output JAR from the capsule then the buildCordaJAR task goes into an infinite loop.
rootProject.name = 'corda-project'
include 'confidential-identities'
include 'finance'
include 'finance' // maintained for backwards compatibility only
include 'finance:contracts'
include 'finance:workflows'
include 'finance:isolated'
include 'core'
include 'docs'

View File

@ -12,7 +12,7 @@ dependencies {
testCompile(project(':test-utils')) {
exclude module: 'node-api'
exclude module: 'finance'
exclude module: 'contracts'
}
}

View File

@ -50,7 +50,8 @@ dependencies {
compile "org.controlsfx:controlsfx:$controlsfx_version"
compile project(':client:rpc')
compile project(':finance')
compile project(':finance:contracts')
compile project(':finance:workflows')
compile "com.h2database:h2:$h2_version"
compile "net.java.dev.jna:jna-platform:$jna_version"
@ -126,8 +127,13 @@ distributions {
into 'corda'
fileMode = 0444
}
from(project(':finance').tasks.jar) {
rename 'corda-finance-(.*)', 'corda-finance.jar'
from(project(':finance:contracts').tasks.jar) {
rename 'corda-finance-contracts(.*)', 'corda-finance-contracts.jar'
into 'cordapps'
fileMode = 0444
}
from(project(':finance:workflows').tasks.jar) {
rename 'corda-finance-workflows(.*)', 'corda-finance-workflows.jar'
into 'cordapps'
fileMode = 0444
}

View File

@ -119,7 +119,7 @@ class NodeController(check: atRuntime = ::checkExists) : Controller() {
(config.nodeDir / "node.conf").writeText(config.nodeConfig.toNodeConfText())
(config.nodeDir / "web-server.conf").writeText(config.nodeConfig.toWebServerConfText())
(cordappConfigDir / "${CordappController.FINANCE_CORDAPP_FILENAME}.conf").writeText(config.nodeConfig.toFinanceConfText())
(cordappConfigDir / "${CordappController.FINANCE_WORKFLOWS_CORDAPP_FILENAME}.conf").writeText(config.nodeConfig.toFinanceConfText())
// Execute the Corda node
val cordaEnv = System.getenv().toMutableMap().apply {

View File

@ -13,12 +13,13 @@ import kotlin.streams.toList
class CordappController : Controller() {
companion object {
const val FINANCE_CORDAPP_FILENAME = "corda-finance"
const val FINANCE_CONTRACTS_CORDAPP_FILENAME = "corda-finance-contracts"
const val FINANCE_WORKFLOWS_CORDAPP_FILENAME = "corda-finance-workflows"
}
private val jvm by inject<JVMConfig>()
private val cordappDir: Path = jvm.applicationDir / NodeConfig.CORDAPP_DIR_NAME
private val financeCordappJar: Path = cordappDir / "$FINANCE_CORDAPP_FILENAME.jar"
private val financeCordappJars = setOf(cordappDir / "$FINANCE_CONTRACTS_CORDAPP_FILENAME.jar", cordappDir / "$FINANCE_WORKFLOWS_CORDAPP_FILENAME.jar")
/**
* Install any built-in cordapps that this node requires.
@ -28,9 +29,11 @@ class CordappController : Controller() {
if (!config.cordappsDir.exists()) {
config.cordappsDir.createDirectories()
}
if (financeCordappJar.exists()) {
financeCordappJar.copyToDirectory(config.cordappsDir, StandardCopyOption.REPLACE_EXISTING)
log.info("Installed 'Finance' cordapp")
financeCordappJars.forEach {financeCordappJar ->
if (financeCordappJar.exists()) {
financeCordappJar.copyToDirectory(config.cordappsDir, StandardCopyOption.REPLACE_EXISTING)
log.info("Installed 'Finance' cordapp: $financeCordappJar")
}
}
}
@ -42,7 +45,7 @@ class CordappController : Controller() {
if (!config.cordappsDir.isDirectory()) return emptyList()
return config.cordappsDir.walk(1) { paths ->
paths.filter(Path::isCordapp)
.filter { !financeCordappJar.endsWith(it.fileName) }
.filter { financeCordappJars.any { !it.endsWith(it.fileName) } }
.toList()
}
}

View File

@ -24,7 +24,8 @@ dependencies {
compile project(':client:jfx')
compile project(':client:mock')
compile project(':node-driver')
compile project(':finance')
compile project(':finance:contracts')
compile project(':finance:workflows')
// Capsule is a library for building independently executable fat JARs.
// We only need this dependency to compile our Caplet against.

View File

@ -63,7 +63,8 @@ dependencies {
testCompile "junit:junit:$junit_version"
testCompile "org.assertj:assertj-core:$assertj_version"
testCompile project(':test-utils')
testCompile project(':finance')
testCompile project(':finance:contracts')
testCompile project(':finance:workflows')
// Jsh: Testing SSH server.
integrationTestCompile "com.jcraft:jsch:$jsch_version"