Skip to content

Commit

Permalink
CORDA-4169: Update to Corda 4.5.1, Corda Gradle plugins 5.0.13, Gradl…
Browse files Browse the repository at this point in the history
…e 5.6.4.
  • Loading branch information
chrisr3 committed Oct 18, 2021
1 parent e4a4b85 commit 244dc15
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 190 deletions.
108 changes: 52 additions & 56 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ import static org.gradle.api.JavaVersion.VERSION_1_8
buildscript {
ext {
corda_release_group = 'net.corda'
corda_release_version = '4.3'
corda_release_version = '4.5.1'
tokens_release_group = "com.r3.corda.lib.tokens"
tokens_release_version = "1.2-SNAPSHOT"
corda_gradle_plugins_version = '5.0.8'
kotlin_version = '1.2.71'
junit_version = '4.12'
dokka_version = '0.9.17'
tokens_release_version = "1.2.4-SNAPSHOT"
junit_version = '4.13.2'
slf4j_version = '1.7.25'
log4j_version = '2.9.1'
jackson_version = '2.9.0'
Expand All @@ -19,32 +16,16 @@ buildscript {
mavenVersion = '3.1.0'
maven_resolver_version = "1.1.1"
}

repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-releases" }
maven { url "https://repo.gradle.org/gradle/libs-releases-local/" }
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version"
classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
}
}

plugins {
id "com.jfrog.artifactory" version "4.7.5"
id "org.jetbrains.kotlin.jvm" apply false
id 'com.jfrog.artifactory'
}

allprojects {
version "$tokens_release_version"
group "$tokens_release_group"
version tokens_release_version
group tokens_release_group

configurations.all {
resolutionStrategy {
Expand All @@ -62,21 +43,30 @@ allprojects {

subprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven { url 'https://jitpack.io' }
maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-dev" }
maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-releases" }
maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib" }
maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib-dev" }
maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/corda-lib" }
jcenter {
content {
includeGroup 'com.beust'
}
}
maven { url "$artifactory_contextUrl/corda-releases" }
maven { url "$artifactory_contextUrl/corda-dependencies" }
maven { url "$artifactory_contextUrl/corda-lib" }
maven { url "https://repo.gradle.org/gradle/libs-releases-local/" }
}

apply plugin: 'kotlin'
pluginManager.withPlugin('org.jetbrains.kotlin.plugin.allopen') {
allOpen {
annotations(
'javax.persistence.Entity',
'javax.persistence.Embeddable',
'javax.persistence.MappedSuperclass'
)
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
Expand All @@ -85,15 +75,18 @@ subprojects {
}
}

tasks.withType(Jar) {
jar {
exclude "**/log4j2*.xml"
}
tasks.withType(Jar).configureEach {
exclude "**/log4j2*.xml"
}

tasks.withType(Test){
tasks.withType(Test).configureEach {
minHeapSize = "128m"
maxHeapSize = "4096m"

doFirst {
// Prevent the project from creating temporary files outside of the build directory.
systemProperty 'java.io.tmpdir', buildDir.absolutePath
}
}
}

Expand All @@ -107,27 +100,30 @@ configure(publishProjects) { subproject ->
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'

task sourceJar(type: Jar, dependsOn: subproject.classes) {
classifier = 'sources'
from sourceSets.main.allSource
tasks.register('install') {
dependsOn 'publishToMavenLocal'
}

task javadocJar(type: Jar, dependsOn: subproject.javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

task install(dependsOn: 'publishToMavenLocal')

publishing {
publications {
create(subproject.name, MavenPublication) {
from components.java
pluginManager.withPlugin('java') {
from components.java

artifact tasks.create('sourceJar', Jar) {
dependsOn subproject.classes
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
artifact tasks.create('javadocJar', Jar) {
dependsOn subproject.javadoc
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
}

groupId subproject.group
artifactId "tokens-${subproject.name}"
artifact tasks.sourceJar
artifact tasks.javadocJar

pom {
description = subproject.description
Expand All @@ -140,7 +136,7 @@ configure(publishProjects) { subproject ->

artifactory {
publish {
contextUrl = 'https://ci-artifactory.corda.r3cev.com/artifactory'
contextUrl = artifactory_contextUrl
repository {
repoKey = 'corda-lib-dev'
username = System.getenv('CORDA_ARTIFACTORY_USERNAME') ?: System.getProperty('corda.artifactory.username')
Expand All @@ -156,8 +152,8 @@ artifactory {
}

wrapper {
gradleVersion = "5.6"
distributionType = Wrapper.DistributionType.ALL
gradleVersion = "5.6.4"
distributionType = Wrapper.DistributionType.BIN
}

//add for test re-run
16 changes: 9 additions & 7 deletions contracts/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
apply plugin: 'kotlin-jpa'
apply plugin: 'net.corda.plugins.cordapp'
plugins {
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.jpa'
id 'org.jetbrains.kotlin.plugin.allopen'
id 'net.corda.plugins.cordapp'
}

if (!(corda_release_version in ['4.1'])) {
apply from: "${rootProject.projectDir}/deterministic.gradle"
Expand All @@ -23,9 +27,7 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

// Corda dependencies.
cordaCompile("$corda_release_group:corda-core:$corda_release_version") {
changing = true
}
cordaCompile "$corda_release_group:corda-core:$corda_release_version"

// Logging.
testCompile "org.apache.logging.log4j:log4j-slf4j-impl:${log4j_version}"
Expand All @@ -52,5 +54,5 @@ cordapp {
}

jar {
baseName "tokens-contracts"
}
archiveBaseName = "tokens-contracts"
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ abstract class ContractTestCommon {
val testSerialization = SerializationEnvironmentRule()

protected val aliceServices = MockServices(
cordappPackages = listOf("com.r3.corda.lib.tokens.contracts", "com.r3.corda.lib.tokens.money"),
cordappPackages = listOf("com.r3.corda.lib.tokens.contracts"),
initialIdentity = ALICE,
identityService = mock<IdentityService>().also {
doReturn(ALICE.party).whenever(it).partyFromKey(ALICE.publicKey)
Expand Down
49 changes: 27 additions & 22 deletions freighter-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'kotlin'
apply plugin: 'idea'

plugins {
id 'org.jetbrains.kotlin.jvm'
id 'idea'
}

repositories {
maven { url "http://ci-artifactory.corda.r3cev.com/artifactory/freighter-dev" }
maven { url "$artifactory_contextUrl/freighter-dev" }
}

sourceSets {
Expand All @@ -18,10 +19,8 @@ sourceSets {
}
}

evaluationDependsOn(":workflows")
task freighterTest(type: Test, dependsOn: [project(":workflows").jar]) {
tasks.register('freighterTest', Test) {
maxParallelForks 2
systemProperty "java.util.concurrent.ForkJoinPool.common.parallelism", "128"
testClassesDirs = sourceSets.freighterTest.output.classesDirs
classpath = sourceSets.freighterTest.runtimeClasspath
useJUnitPlatform {
Expand All @@ -36,29 +35,35 @@ task freighterTest(type: Test, dependsOn: [project(":workflows").jar]) {
excludeTags "FULL_LINUX_KERNEL"
}
}

doFirst {
systemProperty "java.util.concurrent.ForkJoinPool.common.parallelism", "128"
systemProperty 'test.corda.release.version', corda_release_version
}
}

configurations {
freighterTestCompile.extendsFrom testCompile
freighterTestRuntime.extendsFrom testRuntime
freighterTestCompile {
canBeConsumed = false
canBeResolved = false
extendsFrom testCompile
}
freighterTestRuntime {
canBeConsumed = false
canBeResolved = false
extendsFrom testRuntime
}
freighterTestCompileClasspath {
attributes { attr ->
attr.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
}
}
}

dependencies {
freighterTestCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
freighterTestCompile "freighter:freighter-testing-core-junit5:0.4.5-SNAPSHOT"
freighterTestCompile "freighter:freighter-testing-core-junit5:$freighter_version"

freighterTestCompile project(":contracts")
freighterTestCompile project(":workflows")
}


tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
jvmTarget = "1.8"
javaParameters = true // Useful for reflection.
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,24 @@ package freighter.testing
import com.r3.corda.lib.tokens.contracts.states.FungibleToken
import com.r3.corda.lib.tokens.contracts.types.IssuedTokenType
import com.r3.corda.lib.tokens.contracts.types.TokenType
import com.r3.corda.lib.tokens.workflows.OwnerMigration
import com.r3.corda.lib.tokens.workflows.flows.rpc.IssueTokens
import freighter.deployments.DeploymentContext
import freighter.deployments.NodeBuilder
import freighter.deployments.SingleNodeDeployment
import freighter.deployments.UnitOfDeployment.DeploymentVersion
import freighter.machine.DeploymentMachineProvider
import freighter.machine.generateRandomString
import liquibase.database.DatabaseConnection
import liquibase.database.core.PostgresDatabase
import net.corda.core.contracts.Amount
import net.corda.core.messaging.startFlow
import net.corda.core.utilities.getOrThrow
import net.corda.nodeapi.internal.persistence.DatabaseConfig
import org.hamcrest.MatcherAssert
import org.hamcrest.core.Is
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import utility.LoggingUtils
import utility.Retry
import utility.getArtifactAndDependencies
import org.junit.jupiter.api.fail
import utility.getOrThrow
import java.net.URLClassLoader
import java.sql.Connection
import java.sql.Driver
import java.time.Duration
import java.util.*
import java.util.concurrent.CompletableFuture

class TokenSDKDBCompatibility : DockerRemoteMachineBasedTest() {
private val testCordaReleaseVersion: String = System.getProperty("test.corda.release.version")
?: fail("test.corda.release.version system property missing.")

val tokenContracts =
NodeBuilder.DeployedCordapp.fromClassPath("tokens-contracts")
Expand Down Expand Up @@ -90,7 +79,7 @@ class TokenSDKDBCompatibility : DockerRemoteMachineBasedTest() {
.withCordapp(tokenSelection)
.withCordapp(modernCiV1)
.withDatabase(machineProvider.requestDatabase(db))
).withVersion("4.3")
).withVersion(DeploymentVersion(testCordaReleaseVersion, false))
.deploy(deploymentContext)

val nodeMachine = deploymentResult.getOrThrow().nodeMachines.single()
Expand All @@ -110,6 +99,4 @@ class TokenSDKDBCompatibility : DockerRemoteMachineBasedTest() {
}
println("Successfully issued tokens: ${issueTx.coreTransaction.outputs}")
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.stress.flows.CreateNewCIFlow
import freighter.deployments.DeploymentContext
import freighter.deployments.NodeBuilder
import freighter.deployments.SingleNodeDeployment
import freighter.deployments.UnitOfDeployment.DeploymentVersion
import freighter.machine.DeploymentMachineProvider
import freighter.machine.generateRandomString
import net.corda.core.contracts.Amount
Expand All @@ -18,13 +19,14 @@ import net.corda.core.messaging.startFlow
import net.corda.core.utilities.getOrThrow
import org.hamcrest.MatcherAssert
import org.hamcrest.Matchers.*
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.fail
import utility.getOrThrow
import java.time.Duration
import java.util.concurrent.CompletableFuture

class TokenSDKUpgradeDBCompatibility : DockerRemoteMachineBasedTest() {
private val testCordaReleaseVersion: String = System.getProperty("test.corda.release.version")
?: fail("test.corda.release.version system property missing.")

//remove the prod key and sign with freighter key
val tokensV1Contracts = NodeBuilder.DeployedCordapp.fromGradleArtifact(
Expand Down Expand Up @@ -97,10 +99,10 @@ class TokenSDKUpgradeDBCompatibility : DockerRemoteMachineBasedTest() {
.withCordapp(tokensV1Contracts)
.withCordapp(tokensV1Workflows)
.withCordapp(tokensV1Selection)
.withCordapp(modernCiV1)
//.withCordapp(modernCiV1)
.withCordapp(freighterHelperCordapp)
.withDatabase(machineProvider.requestDatabase(db))
).withVersion("4.3")
).withVersion(DeploymentVersion(testCordaReleaseVersion, false))
.deploy(deploymentContext)

val nodeMachine = deploymentResult.getOrThrow().nodeMachines.single()
Expand Down
Loading

0 comments on commit 244dc15

Please sign in to comment.