[CORDA-2077] Use latest gradle plugin version (4.0.32), set target version in core and sample CorDapps (#4038)

* Upgrade gradle plugin; add target version attribute to finance and sample cordapps.
* Remove '-SNAPSHOT' from gradlePluginsVersion.
* Fix naming.
* Update docs.
* Respond to feedback.
* Fix irs demo
* Fix more samples
* Fix more samples
* Fix deployNodes
* Fix deployNodes
* more fixes
* fix simm valuation
* more fixes
* more fixes
* more fixes
* more fixes
* Publication should have *nothing* to do with cordformation and deployNodes.
Remove it! And if this exposes a bug then "so be it".
* Disable CorDapp signing for Cordapp Configuration and Network Verifier.
* Disable CorDapp signing for SIMM Valuation Demo.
* Remove remaining publishing nonsense from samples.
* Workarounds fpr cordapp-configuration, network-verifier and simm-valuation-demo:
JarSigner rejects jars with duplicates inside, so remove them.
* Upgrade to Gradle plugin 4.0.32 and reenable CorDapp signing for samples.
This commit is contained in:
Florian Friemel 2018-10-15 21:11:52 +01:00 committed by Chris Rankin
parent 2248f54f9f
commit 47068e6b7a
17 changed files with 199 additions and 90 deletions

View File

@ -1,4 +1,4 @@
gradlePluginsVersion=4.0.29
gradlePluginsVersion=4.0.32
kotlinVersion=1.2.51
# ***************************************************************#
# When incrementing platformVersion make sure to update #

View File

@ -198,11 +198,23 @@ CorDapps can advertise their minimum and target platform version. The minimum pl
.. sourcecode:: groovy
'Min-Platform-Version': 3
'Min-Platform-Version': 4
'Target-Platform-Version': 4
Using the `cordapp` Gradle plugin, this can be achieved by putting this in your CorDapp's `build.gradle`:
In gradle, this can be achieved by modifying the jar task as shown in this example:
.. container:: codeset
.. sourcecode:: groovy
cordapp {
info {
targetPlatformVersion 4
minimumPlatformVersion 4
}
}
Without using the `cordapp` plugin, you can achieve the same by modifying the jar task as shown in this example:
.. container:: codeset
@ -211,7 +223,7 @@ In gradle, this can be achieved by modifying the jar task as shown in this examp
jar {
manifest {
attributes(
'Min-Platform-Version': 3
'Min-Platform-Version': 4
'Target-Platform-Version': 4
)
}

View File

@ -33,3 +33,13 @@ idea {
publish {
name 'corda-notary-bft-smart'
}
cordapp {
info {
name "net/corda/experimental/notary-bft-smart"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -33,3 +33,12 @@ idea {
publish {
name 'corda-notary-raft'
}
cordapp {
info {
name "net/corda/experimental/notary-raft"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -87,6 +87,8 @@ cordapp {
info {
name "net/corda/finance"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -1,11 +1,8 @@
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'maven-publish'
sourceSets {
integrationTest {
@ -27,14 +24,16 @@ dependencies {
testCompile "junit:junit:$junit_version"
// Corda integration dependencies
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaCompile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
cordaCompile project(':webserver')
cordaCompile project(':node-driver')
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
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]) {
ext.rpcUsers = [['username': "demo", 'password': "demo", 'permissions': ["StartFlow.net.corda.attachmentdemo.AttachmentDemoFlow",
"InvokeRpc.wellKnownPartyFromX500Name",
"InvokeRpc.attachmentExists",
@ -92,18 +91,6 @@ idea {
}
}
publishing {
publications {
jarAndSources(MavenPublication) {
from components.java
artifactId 'attachmentdemo'
artifact sourceJar
artifact javadocJar
}
}
}
task runSender(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.corda.attachmentdemo.AttachmentDemoKt'
@ -125,3 +112,12 @@ jar {
)
}
}
cordapp {
info {
name "net/corda/samples/attachment-demo"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -2,10 +2,8 @@ apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'maven-publish'
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
@ -14,8 +12,8 @@ dependencies {
cordapp project(':finance')
// Corda integration dependencies
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaCompile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
cordaCompile project(':client:jfx')
cordaCompile project(':client:rpc')
@ -32,7 +30,9 @@ dependencies {
testCompile "junit:junit:$junit_version"
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
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')
}
@ -82,18 +82,6 @@ idea {
}
}
publishing {
publications {
jarAndSources(MavenPublication) {
from components.java
artifactId 'bankofcorda'
artifact sourceJar
artifact javadocJar
}
}
}
task runRPCCashIssue(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.corda.bank.IssueCash'
@ -123,3 +111,12 @@ jar {
)
}
}
cordapp {
info {
name "net/corda/samples/bank-of-corda-demo"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -1,17 +1,20 @@
apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
dependencies {
cordaCompile project(":core")
cordaCompile project(":node-api")
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
cordaCompile project(':node-api')
runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
// Corda integration dependencies
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
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]) {
directory file("$buildDir/nodes")
nodeDefaults {
cordapps = []
@ -25,7 +28,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
port 10003
adminPort 10004
}
rpcUsers = []
extraConfig = ['h2Settings.address' : 'localhost:10005']
}
node {
@ -55,3 +57,12 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
extraConfig = ['h2Settings.address' : 'localhost:10013']
}
}
cordapp {
info {
name "net/corda/samples/cordapp-configuration"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -1,8 +1,14 @@
package net.corda.configsample
import co.paralleluniverse.fibers.Suspendable
import net.corda.core.contracts.CommandData
import net.corda.core.contracts.Contract
import net.corda.core.contracts.ContractState
import net.corda.core.flows.FlowLogic
import net.corda.core.flows.StartableByRPC
import net.corda.core.identity.AbstractParty
import net.corda.core.serialization.CordaSerializable
import net.corda.core.transactions.LedgerTransaction
import net.corda.core.utilities.ProgressTracker
@StartableByRPC
@ -17,3 +23,22 @@ class GetStringConfigFlow(private val configKey: String) : FlowLogic<String>() {
return config.getString(configKey)
}
}
@CordaSerializable
data class GetStringTestState(val responses: List<String>, val issuer: AbstractParty) : ContractState {
override val participants: List<AbstractParty>
get() = listOf(issuer)
}
@CordaSerializable
object GetStringTestCommand : CommandData
class GetStringTestContract : Contract {
override fun verify(tx: LedgerTransaction) {
}
}

View File

@ -21,7 +21,6 @@ ext['jackson.version'] = "$jackson_version"
ext['dropwizard-metrics.version'] = "$metrics_version"
ext['mockito.version'] = "$mockito_version"
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'

View File

@ -1,11 +1,8 @@
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'maven-publish'
apply plugin: 'application'
mainClassName = 'net.corda.irs.IRSDemo'
@ -31,7 +28,7 @@ dependencies {
cordapp project(':finance')
// Corda integration dependencies
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
// Cordapp dependencies
@ -57,7 +54,8 @@ def rpcUsersList = [
]]
]
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
def nodeTask = tasks.getByPath(':node:capsule:assemble')
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) {
node {
name "O=Notary Service,L=Zurich,C=CH"
@ -112,7 +110,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
}
task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar']) {
task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar', nodeTask]) {
node {
name "O=Notary Service,L=Zurich,C=CH"
@ -159,15 +157,25 @@ tasks.withType(CreateStartScripts).each { task ->
idea {
module {
downloadJavadoc = true // defaults to false
downloadJavadoc = true
downloadSources = true
}
}
jar {
from sourceSets.test.output
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
artifacts {
demoArtifacts jar
}
cordapp {
info {
name "net/corda/irs-demo"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -1,18 +1,20 @@
apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
dependencies {
cordaCompile project(":core")
cordaCompile project(":node-api")
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
cordaCompile project(':node-api')
testCompile project(":test-utils")
testCompile "junit:junit:$junit_version"
// Corda integration dependencies
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
def nodeTask = tasks.getByPath(':node:capsule:assemble')
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) {
ext.rpcUsers = [['username': "default", 'password': "default", 'permissions': [ 'ALL' ]]]
directory "./build/nodes"
@ -49,3 +51,12 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
extraConfig = ['h2Settings.address' : 'localhost:0']
}
}
cordapp {
info {
name "net/corda/samples/network-verifier"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -16,8 +16,8 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// Corda integration dependencies
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaCompile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
cordaCompile project(':client:jfx')
cordaCompile project(':client:rpc')
@ -28,9 +28,12 @@ dependencies {
cordapp project(':experimental:notary-bft-smart')
}
def nodeTask = tasks.getByPath(':node:capsule:assemble')
def webTask = tasks.getByPath(':webserver:webcapsule:assemble')
task deployNodes(dependsOn: ['deployNodesSingle', 'deployNodesRaft', 'deployNodesBFT', 'deployNodesCustom'])
task deployNodesSingle(type: Cordform, dependsOn: 'jar') {
task deployNodesSingle(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) {
directory file("$buildDir/nodes/nodesSingle")
nodeDefaults {
extraConfig = [h2Settings: [address: "localhost:0"]]
@ -55,7 +58,7 @@ task deployNodesSingle(type: Cordform, dependsOn: 'jar') {
}
}
task deployNodesCustom(type: Cordform, dependsOn: 'jar') {
task deployNodesCustom(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) {
directory file("$buildDir/nodes/nodesCustom")
nodeDefaults {
extraConfig = [h2Settings: [address: "localhost:0"]]
@ -83,7 +86,7 @@ task deployNodesCustom(type: Cordform, dependsOn: 'jar') {
}
}
task deployNodesRaft(type: Cordform, dependsOn: 'jar') {
task deployNodesRaft(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) {
def className = "net.corda.notary.raft.RaftNotaryService"
directory file("$buildDir/nodes/nodesRaft")
nodeDefaults {
@ -151,7 +154,7 @@ task deployNodesRaft(type: Cordform, dependsOn: 'jar') {
}
}
task deployNodesBFT(type: Cordform, dependsOn: 'jar') {
task deployNodesBFT(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) {
def clusterAddresses = ["localhost:11000", "localhost:11010", "localhost:11020", "localhost:11030"]
def className = "net.corda.notary.bftsmart.BftSmartNotaryService"
directory file("$buildDir/nodes/nodesBFT")
@ -250,3 +253,12 @@ jar {
)
}
}
cordapp {
info {
name "net/corda/samples/notary-demo"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}

View File

@ -4,7 +4,6 @@ allprojects {
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.quasar-utils'
@ -27,7 +26,7 @@ configurations {
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
cordaCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
// The SIMM demo CorDapp depends upon Cash CorDapp features
cordapp project(':finance')
@ -62,7 +61,9 @@ dependencies {
testCompile "org.assertj:assertj-core:$assertj_version"
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
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]) {
directory file("$buildDir/nodes")
nodeDefaults {
cordapp project(':finance')
@ -70,6 +71,9 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
cordapp project(':samples:simm-valuation-demo:flows')
rpcUsers = [['username': "default", 'password': "default", 'permissions': [ 'ALL' ]]]
}
signing {
enabled false
}
node {
name "O=Notary Service,L=Zurich,C=CH"
notary = [validating : true]
@ -137,3 +141,10 @@ task integrationTest(type: Test, dependsOn: []) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}
cordapp {
info {
vendor = 'R3'
targetPlatformVersion = corda_platform_version.toInteger()
}
}

View File

@ -6,6 +6,12 @@ def shrinkJar = file("$buildDir/libs/${project.name}-${project.version}-tiny.jar
cordapp {
info {
vendor = 'R3'
targetPlatformVersion = corda_platform_version.toInteger()
}
signing {
// We need to sign the output of the "shrink" task,
// but the jar signer doesn't support that yet.
enabled false
}
}

View File

@ -4,6 +4,10 @@ apply plugin: 'net.corda.plugins.cordapp'
cordapp {
info {
vendor = 'R3'
targetPlatformVersion = corda_platform_version.toInteger()
}
signing {
enabled false
}
}

View File

@ -1,11 +1,8 @@
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.cordapp'
apply plugin: 'net.corda.plugins.cordformation'
apply plugin: 'maven-publish'
sourceSets {
integrationTest {
@ -29,8 +26,8 @@ dependencies {
cordapp project(':finance')
// Corda integration dependencies
cordaCompile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaCompile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
cordaCompile project(':core')
// Corda Plugins: dependent flows and services
@ -41,7 +38,9 @@ dependencies {
testCompile "org.assertj:assertj-core:${assertj_version}"
}
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
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]) {
ext.rpcUsers = [['username': "demo", 'password': "demo", 'permissions': ["ALL"]]]
directory "./build/nodes"
@ -104,18 +103,6 @@ idea {
}
}
publishing {
publications {
jarAndSources(MavenPublication) {
from components.java
artifactId 'traderdemo'
artifact sourceJar
artifact javadocJar
}
}
}
task runBank(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.corda.traderdemo.TraderDemoKt'
@ -137,3 +124,12 @@ jar {
)
}
}
cordapp {
info {
name "net/corda/samples/trader-demo"
vendor "Corda Open Source"
targetPlatformVersion corda_platform_version.toInteger()
minimumPlatformVersion 1
}
}