From 633be8d63147d3f1abd721b0c62f2b3eab940682 Mon Sep 17 00:00:00 2001 From: lemjclarke Date: Fri, 25 Feb 2022 15:13:04 +0000 Subject: [PATCH] Add transaction serialization dependencies --- build.gradle | 6 +++- common/enclave/build.gradle | 6 +++- enclave/build.gradle | 31 +++++++++++++++++++ .../cordapp/sample/enclave/CommandEnclave.kt | 3 +- gradle.properties | 3 +- settings.gradle | 5 ++- 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index f877f50f18..cb217b023c 100644 --- a/build.gradle +++ b/build.gradle @@ -193,6 +193,8 @@ buildscript { } maven { + // TODO: fix conclaveRepo property + // (none of the conclave properties seem to be sourced from gradle.properties, they appear to be coming from somewhere else) def path = Paths.get(rootDir.absolutePath).resolve("./repo").toAbsolutePath().normalize() if (!Files.isDirectory(path.resolve("com"))) { if (Files.isDirectory(Paths.get("/repo/com"))) { @@ -440,7 +442,9 @@ allprojects { jcenter() maven { - def path = Paths.get(rootDir.absolutePath).resolve(conclaveRepo).toAbsolutePath().normalize() + // TODO: fix conclaveRepo property + // (none of the conclave properties seem to be sourced from gradle.properties, they appear to be coming from somewhere else) + def path = Paths.get(rootDir.absolutePath).resolve("./repo").toAbsolutePath().normalize() if (!Files.isDirectory(path.resolve("com"))) { if (Files.isDirectory(Paths.get("/repo/com"))) { path = Paths.get("/repo") diff --git a/common/enclave/build.gradle b/common/enclave/build.gradle index 79dc483ac3..c340e25869 100644 --- a/common/enclave/build.gradle +++ b/common/enclave/build.gradle @@ -1,7 +1,11 @@ apply plugin: 'kotlin' dependencies { - implementation "com.r3.conclave:conclave-common:$conclaveVersion" + // TODO: fix conclaveVersion property + // (none of the conclave properties seem to be sourced from gradle.properties, they appear to be coming from somewhere else) + implementation "com.r3.conclave:conclave-common:1.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation "net.i2p.crypto:eddsa:0.3.0" + + implementation project(':core') } diff --git a/enclave/build.gradle b/enclave/build.gradle index 385c4424bb..bdcfb38036 100644 --- a/enclave/build.gradle +++ b/enclave/build.gradle @@ -1,6 +1,20 @@ plugins { id 'kotlin' id 'com.r3.conclave.enclave' + id 'org.jetbrains.kotlin.jvm' + id 'org.jetbrains.kotlin.plugin.allopen' +} + +apply plugin: 'kotlin' +apply plugin: 'java' +apply plugin: 'kotlin-allopen' +apply plugin: 'kotlin-noarg' + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + jvmTarget = "1.8" + javaParameters = true + } } /** @@ -10,6 +24,11 @@ tasks.withType(JavaCompile) { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 options.encoding = 'UTF-8' + options.compilerArgs << '-parameters' +} + +noArg { + annotations("net.corda.core.serialization.CordaSerializable", "net.corda.core.contracts.BelongsToContract") } /** @@ -31,9 +50,21 @@ tasks.withType(AbstractCompile) { dependencies { implementation project(':common-enclave') + implementation project(':node-api') + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" implementation 'junit:junit:4.13.1' + implementation "com.r3.conclave:conclave-enclave" + + implementation ("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72") { + exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-serialization-json' + } + + implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.72" + implementation "org.bouncycastle:bcprov-jdk15on:1.68" + implementation "com.github.ben-manes.caffeine:caffeine:2.7.0" + testImplementation(platform('org.junit:junit-bom:5.7.0')) } diff --git a/enclave/src/main/kotlin/com/r3/conclave/cordapp/sample/enclave/CommandEnclave.kt b/enclave/src/main/kotlin/com/r3/conclave/cordapp/sample/enclave/CommandEnclave.kt index f85c118b7f..c6d4fb6ac9 100644 --- a/enclave/src/main/kotlin/com/r3/conclave/cordapp/sample/enclave/CommandEnclave.kt +++ b/enclave/src/main/kotlin/com/r3/conclave/cordapp/sample/enclave/CommandEnclave.kt @@ -47,8 +47,9 @@ abstract class CommandEnclave : Enclave() { * @param mail the received [EnclaveMail]. * @param routingHint a [String] containing the executing flowId and enclave command to execute. * @throws [IllegalArgumentException] if [routingHint] is null, or cannot be parsed. + * @throws [IllegalStateException] if attempting to execute a command when the host has not been registered. */ - override fun receiveMail(mail: EnclaveMail, routingHint: String?) { + override fun receiveMail(id: Long, mail: EnclaveMail, routingHint: String?) { routingHint ?: throw IllegalArgumentException( "routingHint must be set for this enclave: ${this.javaClass.simpleName}") diff --git a/gradle.properties b/gradle.properties index 87325104aa..2ba3018b52 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,5 @@ owasp.failOnError=false owasp.failBuildOnCVSS=11.0 compilation.allWarningsAsErrors=false test.parallel=false -conclaveVersion=1.2.1 +conclaveVersion=1.1 +conclaveRepo=./repo \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 6a3f2f7e6b..b1ebb6d843 100644 --- a/settings.gradle +++ b/settings.gradle @@ -27,7 +27,10 @@ pluginManagement { } plugins { - id 'com.r3.conclave.enclave' version conclaveVersion apply false + println("CONCLAVE VERSION: $conclaveVersion") + // TODO: fix conclaveVersion property + // (none of the conclave properties seem to be sourced from gradle.properties, they appear to be coming from somewhere else) + id 'com.r3.conclave.enclave' version '1.1' apply false } } // The project is named 'corda-project' and not 'corda' because if this is named the same as the