2022-10-13 00:04:51 +02:00
|
|
|
|
import static org.gradle.api.JavaVersion.VERSION_11
|
|
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
|
id 'org.jetbrains.kotlin.jvm'
|
|
|
|
|
|
|
|
|
|
// Include the cordapp-cpb plugin. This automatically includes the cordapp-cpk plugin as well.
|
|
|
|
|
// These extend existing build environment so that CPB and CPK files can be built.
|
|
|
|
|
// This includes a CorDapp DSL that allows the developer to supply metadata for the CorDapp
|
|
|
|
|
// required by Corda.
|
|
|
|
|
id 'net.corda.plugins.cordapp-cpb2'
|
|
|
|
|
id 'net.corda.cordapp.cordapp-configuration'
|
|
|
|
|
|
|
|
|
|
id 'org.jetbrains.kotlin.plugin.jpa'
|
|
|
|
|
|
|
|
|
|
id 'java'
|
|
|
|
|
id 'maven-publish'
|
|
|
|
|
|
|
|
|
|
id 'csde'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group 'com.r3.hellocorda'
|
|
|
|
|
version '1.0-SNAPSHOT'
|
|
|
|
|
|
|
|
|
|
def javaVersion = VERSION_11
|
|
|
|
|
|
|
|
|
|
// The CordApp section.
|
|
|
|
|
// This is part of the DSL provided by the corda plugins to define metadata for our CorDapp.
|
|
|
|
|
// Each component of the CorDapp would get its own CorDapp section in the build.gradle file for the component’s
|
|
|
|
|
// subproject.
|
|
|
|
|
// This is required by the corda plugins to build the CorDapp.
|
|
|
|
|
cordapp {
|
|
|
|
|
// "targetPlatformVersion" and "minimumPlatformVersion" are intended to specify the preferred
|
|
|
|
|
// and earliest versions of the Corda platform that the CorDapp will run on respectively.
|
|
|
|
|
// Enforced versioning has not implemented yet so we need to pass in a dummy value for now.
|
|
|
|
|
// The platform version will correspond to and be roughly equivalent to the Corda API version.
|
|
|
|
|
targetPlatformVersion platformVersion.toInteger()
|
|
|
|
|
minimumPlatformVersion platformVersion.toInteger()
|
|
|
|
|
|
|
|
|
|
// The cordapp section contains either a workflow or contract subsection depending on the type of component.
|
|
|
|
|
// Declares the type and metadata of the CPK (this CPB has one CPK).
|
|
|
|
|
workflow {
|
|
|
|
|
name "ModuleNameHere"
|
|
|
|
|
versionId 1
|
|
|
|
|
vendor "VendorNameHere"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-13 18:50:50 +02:00
|
|
|
|
// Declare the set of Kotlin compiler options we need to build a CorDapp.
|
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
|
|
|
|
|
|
// -parameters - Needed for reflection and serialization to work correctly.
|
|
|
|
|
options.compilerArgs += [
|
|
|
|
|
"-parameters"
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-13 00:04:51 +02:00
|
|
|
|
repositories {
|
|
|
|
|
// All dependencies are held in Maven Central
|
|
|
|
|
mavenCentral()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Declare dependencies for the modules we will use.
|
|
|
|
|
// A cordaProvided declaration is required for anything that we use that the Corda API provides.
|
|
|
|
|
// This is required to allow us to build CorDapp modules as OSGi bundles that CPI and CPB files are built on.
|
|
|
|
|
dependencies {
|
|
|
|
|
// Declare a "platform" so that we use the correct set of dependency versions for the version of the
|
|
|
|
|
// Corda API specified.
|
|
|
|
|
cordaProvided platform("net.corda:corda-api:$cordaApiVersion")
|
|
|
|
|
|
|
|
|
|
// If using transistive dependencies this will provide most of Corda-API:
|
|
|
|
|
// cordaProvided 'net.corda:corda-application'
|
|
|
|
|
|
|
|
|
|
// Alternatively we can explicitly specify all our Corda-API dependencies:
|
|
|
|
|
cordaProvided 'net.corda:corda-base'
|
|
|
|
|
cordaProvided 'net.corda:corda-application'
|
|
|
|
|
cordaProvided 'net.corda:corda-crypto'
|
|
|
|
|
cordaProvided 'net.corda:corda-membership'
|
|
|
|
|
// cordaProvided 'net.corda:corda-persistence'
|
|
|
|
|
cordaProvided 'net.corda:corda-serialization'
|
|
|
|
|
|
|
|
|
|
// Not yet fully implemented:
|
|
|
|
|
// cordaProvided 'net.corda:corda-ledger'
|
|
|
|
|
|
|
|
|
|
// The CorDapp uses the slf4j logging framework. Corda-API provides this so we need a 'cordaProvided' declaration.
|
|
|
|
|
cordaProvided 'org.slf4j:slf4j-api'
|
|
|
|
|
|
|
|
|
|
// Dependencies Required By Test Tooling
|
|
|
|
|
testImplementation "net.corda:corda-simulator-api:$combinedWorkerVersion"
|
|
|
|
|
testRuntimeOnly "net.corda:corda-simulator-runtime:$combinedWorkerVersion"
|
|
|
|
|
|
|
|
|
|
// 3rd party libraries
|
|
|
|
|
// Required
|
|
|
|
|
testImplementation "org.slf4j:slf4j-simple:2.0.0"
|
|
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
|
|
|
|
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
|
|
|
|
|
|
|
|
|
// Optional but used by exmaple tests.
|
|
|
|
|
testImplementation "org.mockito:mockito-core:$mockitoVersion"
|
|
|
|
|
testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test {
|
|
|
|
|
useJUnitPlatform()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
|
publications {
|
|
|
|
|
maven(MavenPublication) {
|
2022-10-13 18:50:50 +02:00
|
|
|
|
artifactId "corda-CSDE-java-sample"
|
2022-10-13 00:04:51 +02:00
|
|
|
|
groupId project.group
|
|
|
|
|
artifact jar
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|