2024-01-02 17:02:20 +00:00
|
|
|
apply plugin: 'org.jetbrains.kotlin.jvm'
|
2018-07-17 11:31:44 +00:00
|
|
|
apply plugin: 'net.corda.plugins.cordapp'
|
|
|
|
|
|
|
|
def javaHome = System.getProperty('java.home')
|
|
|
|
def shrinkJar = file("$buildDir/libs/${project.name}-${project.version}-tiny.jar")
|
|
|
|
|
2024-01-02 17:02:20 +00:00
|
|
|
|
|
|
|
import net.corda.plugins.SignJar
|
|
|
|
import proguard.gradle.ProGuardTask
|
|
|
|
|
2020-01-14 15:18:51 +00:00
|
|
|
import java.security.MessageDigest
|
2024-01-02 17:02:20 +00:00
|
|
|
import java.security.NoSuchAlgorithmException
|
2020-01-14 15:18:51 +00:00
|
|
|
|
|
|
|
static String sha256(File jarFile) throws FileNotFoundException, NoSuchAlgorithmException {
|
|
|
|
InputStream input = new FileInputStream(jarFile)
|
|
|
|
try {
|
|
|
|
MessageDigest digest = MessageDigest.getInstance("SHA-256")
|
|
|
|
byte[] buffer = new byte[8192]
|
|
|
|
int bytesRead
|
|
|
|
while ((bytesRead = input.read(buffer)) != -1) {
|
|
|
|
digest.update(buffer, 0, bytesRead)
|
|
|
|
}
|
|
|
|
return digest.digest().encodeHex().toString()
|
|
|
|
} finally {
|
|
|
|
input.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-17 11:31:44 +00:00
|
|
|
cordapp {
|
2018-12-14 09:39:23 +00:00
|
|
|
targetPlatformVersion = corda_platform_version.toInteger()
|
|
|
|
minimumPlatformVersion 1
|
2018-10-15 20:11:52 +00:00
|
|
|
signing {
|
2018-12-10 13:57:56 +00:00
|
|
|
// Cordapp is signed after the "shrink" task.
|
2018-10-15 20:11:52 +00:00
|
|
|
enabled false
|
2018-07-17 11:31:44 +00:00
|
|
|
}
|
2018-11-27 11:41:05 +00:00
|
|
|
sealing {
|
|
|
|
// Cannot seal JAR because other module also defines classes in the package net.corda.vega.analytics
|
|
|
|
enabled false
|
|
|
|
}
|
2018-12-14 09:39:23 +00:00
|
|
|
contract {
|
|
|
|
name "net/corda/vega/contracts"
|
|
|
|
versionId 1
|
|
|
|
vendor "R3"
|
|
|
|
licence "Open Source (Apache 2)"
|
|
|
|
}
|
2018-05-08 15:19:35 +00:00
|
|
|
}
|
|
|
|
|
2018-07-17 11:31:44 +00:00
|
|
|
configurations {
|
|
|
|
shrinkArtifacts
|
|
|
|
}
|
2018-05-08 15:19:35 +00:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
// The SIMM demo CorDapp depends upon Cash CorDapp features
|
2018-12-19 18:02:51 +00:00
|
|
|
cordapp project(':finance:contracts')
|
2018-05-08 15:19:35 +00:00
|
|
|
|
|
|
|
// Corda integration dependencies
|
Upgrade to gradle 7.6, kotlin 1.8 and jdk 17
Major changes due to JDK 17:
1. JDK17 JCE Provider now has built-in support for eddsas, corda uses
the bouncycastle (i2p) implementation. This PR removes the conflicting
algorithms from the built-in JCE provider.
2. JavaScript scripting has been removed from the JDK, the corda log4j config was using
scripting to conditionally output additional diagnostic info if the MDC
was populated. This PR has removed the scripting.
3. The artifactory plug-ins used are now deprecated, this PR has removed them
and uses the same code as Corda 5 for publishing to artifactory.
4. Javadoc generation has been modified to use the latest dokka plug-ins.
5. Gradle 7.6 has implemented an incredibly annoying change where transitive
dependencies are not put on the compile classpath, so that they have to be
explicitly added as dependencies to projects.
6. Mockito has been updated, which sadly meant that quite a few source files
have to changes to use the new (org.mockito.kotlin) package name. This makes
this PR appear much larger than it is.
7. A number of tests have been marked as ignored to get a green, broadly they fall
into 3 classes.
The first is related to crypto keypair tests, it appears some logic
in the JDK prefers to use the SunJCE implementation and we prefer to use
bouncycastle. I believe this issue can be fixed with better test setup.
The second group is related to our use of a method called "uncheckedCast(..)",
the purpose of this method was to get rid of the annoying unchecked cast compiler
warning that would otherwise exist. It looks like the Kotlin 1.9 compiler type
inference differs and at runtime sometimes the type it infers is "Void" which causes
an exception at runtime. The simplest solution is to use an explicit cast instead of
unchecked cast, Corda 5 have removed unchecked cast from their codebase.
The third class are a number of ActiveMQ tests which appear to have a memory leak somewhere.
2023-03-08 12:19:05 +00:00
|
|
|
cordaProvided project(':core')
|
2018-05-08 15:19:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Cordapp dependencies
|
|
|
|
// Specify your cordapp's dependencies below, including dependent cordapps
|
Upgrade to gradle 7.6, kotlin 1.8 and jdk 17
Major changes due to JDK 17:
1. JDK17 JCE Provider now has built-in support for eddsas, corda uses
the bouncycastle (i2p) implementation. This PR removes the conflicting
algorithms from the built-in JCE provider.
2. JavaScript scripting has been removed from the JDK, the corda log4j config was using
scripting to conditionally output additional diagnostic info if the MDC
was populated. This PR has removed the scripting.
3. The artifactory plug-ins used are now deprecated, this PR has removed them
and uses the same code as Corda 5 for publishing to artifactory.
4. Javadoc generation has been modified to use the latest dokka plug-ins.
5. Gradle 7.6 has implemented an incredibly annoying change where transitive
dependencies are not put on the compile classpath, so that they have to be
explicitly added as dependencies to projects.
6. Mockito has been updated, which sadly meant that quite a few source files
have to changes to use the new (org.mockito.kotlin) package name. This makes
this PR appear much larger than it is.
7. A number of tests have been marked as ignored to get a green, broadly they fall
into 3 classes.
The first is related to crypto keypair tests, it appears some logic
in the JDK prefers to use the SunJCE implementation and we prefer to use
bouncycastle. I believe this issue can be fixed with better test setup.
The second group is related to our use of a method called "uncheckedCast(..)",
the purpose of this method was to get rid of the annoying unchecked cast compiler
warning that would otherwise exist. It looks like the Kotlin 1.9 compiler type
inference differs and at runtime sometimes the type it infers is "Void" which causes
an exception at runtime. The simplest solution is to use an explicit cast instead of
unchecked cast, Corda 5 have removed unchecked cast from their codebase.
The third class are a number of ActiveMQ tests which appear to have a memory leak somewhere.
2023-03-08 12:19:05 +00:00
|
|
|
implementation "com.opengamma.strata:strata-product:$strata_version"
|
|
|
|
implementation "com.opengamma.strata:strata-market:$strata_version"
|
2018-07-17 11:31:44 +00:00
|
|
|
}
|
|
|
|
|
Upgrade to gradle 7.6, kotlin 1.8 and jdk 17
Major changes due to JDK 17:
1. JDK17 JCE Provider now has built-in support for eddsas, corda uses
the bouncycastle (i2p) implementation. This PR removes the conflicting
algorithms from the built-in JCE provider.
2. JavaScript scripting has been removed from the JDK, the corda log4j config was using
scripting to conditionally output additional diagnostic info if the MDC
was populated. This PR has removed the scripting.
3. The artifactory plug-ins used are now deprecated, this PR has removed them
and uses the same code as Corda 5 for publishing to artifactory.
4. Javadoc generation has been modified to use the latest dokka plug-ins.
5. Gradle 7.6 has implemented an incredibly annoying change where transitive
dependencies are not put on the compile classpath, so that they have to be
explicitly added as dependencies to projects.
6. Mockito has been updated, which sadly meant that quite a few source files
have to changes to use the new (org.mockito.kotlin) package name. This makes
this PR appear much larger than it is.
7. A number of tests have been marked as ignored to get a green, broadly they fall
into 3 classes.
The first is related to crypto keypair tests, it appears some logic
in the JDK prefers to use the SunJCE implementation and we prefer to use
bouncycastle. I believe this issue can be fixed with better test setup.
The second group is related to our use of a method called "uncheckedCast(..)",
the purpose of this method was to get rid of the annoying unchecked cast compiler
warning that would otherwise exist. It looks like the Kotlin 1.9 compiler type
inference differs and at runtime sometimes the type it infers is "Void" which causes
an exception at runtime. The simplest solution is to use an explicit cast instead of
unchecked cast, Corda 5 have removed unchecked cast from their codebase.
The third class are a number of ActiveMQ tests which appear to have a memory leak somewhere.
2023-03-08 12:19:05 +00:00
|
|
|
configurations.cordapp.canBeResolved = true
|
2024-01-02 17:02:20 +00:00
|
|
|
tasks.register('generateDependencies') {
|
2020-01-14 15:18:51 +00:00
|
|
|
dependsOn project(':finance:contracts').tasks.jar
|
2024-01-02 17:02:20 +00:00
|
|
|
def cordappDependencies = file("${sourceSets.main.output.resourcesDir}/META-INF/Cordapp-Dependencies")
|
2020-02-13 13:01:21 +00:00
|
|
|
inputs.files(configurations.cordapp)
|
2020-01-14 15:18:51 +00:00
|
|
|
outputs.files(cordappDependencies)
|
|
|
|
doLast {
|
2020-02-13 13:01:21 +00:00
|
|
|
cordappDependencies.newWriter().withWriter { writer ->
|
|
|
|
configurations.cordapp.forEach { cordapp ->
|
|
|
|
writer << sha256(cordapp) << System.lineSeparator()
|
|
|
|
}
|
2020-01-14 15:18:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
processResources.finalizedBy generateDependencies
|
2024-04-23 10:51:08 +00:00
|
|
|
jar.dependsOn generateDependencies
|
2020-01-14 15:18:51 +00:00
|
|
|
|
2018-07-17 11:31:44 +00:00
|
|
|
jar {
|
2024-04-18 08:40:42 +00:00
|
|
|
// Test CorDapp filters out *-tests.jar. We only want the shrinked jar not this one.
|
|
|
|
archiveClassifier = 'tests'
|
2018-07-17 11:31:44 +00:00
|
|
|
}
|
2018-05-08 15:19:35 +00:00
|
|
|
|
2024-01-02 17:02:20 +00:00
|
|
|
tasks.register('shrink', ProGuardTask) {
|
2018-07-17 11:31:44 +00:00
|
|
|
injars jar
|
|
|
|
outjars shrinkJar
|
|
|
|
|
Upgrade to gradle 7.6, kotlin 1.8 and jdk 17
Major changes due to JDK 17:
1. JDK17 JCE Provider now has built-in support for eddsas, corda uses
the bouncycastle (i2p) implementation. This PR removes the conflicting
algorithms from the built-in JCE provider.
2. JavaScript scripting has been removed from the JDK, the corda log4j config was using
scripting to conditionally output additional diagnostic info if the MDC
was populated. This PR has removed the scripting.
3. The artifactory plug-ins used are now deprecated, this PR has removed them
and uses the same code as Corda 5 for publishing to artifactory.
4. Javadoc generation has been modified to use the latest dokka plug-ins.
5. Gradle 7.6 has implemented an incredibly annoying change where transitive
dependencies are not put on the compile classpath, so that they have to be
explicitly added as dependencies to projects.
6. Mockito has been updated, which sadly meant that quite a few source files
have to changes to use the new (org.mockito.kotlin) package name. This makes
this PR appear much larger than it is.
7. A number of tests have been marked as ignored to get a green, broadly they fall
into 3 classes.
The first is related to crypto keypair tests, it appears some logic
in the JDK prefers to use the SunJCE implementation and we prefer to use
bouncycastle. I believe this issue can be fixed with better test setup.
The second group is related to our use of a method called "uncheckedCast(..)",
the purpose of this method was to get rid of the annoying unchecked cast compiler
warning that would otherwise exist. It looks like the Kotlin 1.9 compiler type
inference differs and at runtime sometimes the type it infers is "Void" which causes
an exception at runtime. The simplest solution is to use an explicit cast instead of
unchecked cast, Corda 5 have removed unchecked cast from their codebase.
The third class are a number of ActiveMQ tests which appear to have a memory leak somewhere.
2023-03-08 12:19:05 +00:00
|
|
|
libraryjars "$javaHome/jmods"
|
2019-03-11 16:48:35 +00:00
|
|
|
configurations.runtimeClasspath.forEach {
|
2018-07-17 11:31:44 +00:00
|
|
|
libraryjars it.path, filter: '!META-INF/versions/**'
|
|
|
|
}
|
|
|
|
|
|
|
|
dontwarn 'afu.org.checkerframework.**'
|
|
|
|
dontwarn 'co.paralleluniverse.**'
|
|
|
|
dontwarn 'org.checkerframework.**'
|
|
|
|
dontwarn 'org.joda.**'
|
|
|
|
dontnote
|
|
|
|
|
|
|
|
// We need to preserve our CorDapp's own directory structure so that Corda
|
|
|
|
// can find the contract classes.
|
|
|
|
keepdirectories 'net/corda/**'
|
|
|
|
keepattributes '*'
|
|
|
|
dontobfuscate
|
|
|
|
dontoptimize
|
|
|
|
verbose
|
|
|
|
|
|
|
|
// These are our CorDapp classes, so don't change these.
|
2024-01-02 17:02:20 +00:00
|
|
|
keep 'class net.corda.vega.** { *; }', includedescriptorclasses: true
|
2018-07-17 11:31:44 +00:00
|
|
|
|
|
|
|
// Until CorDapps are isolated from each other, we need to ensure that the
|
|
|
|
// versions of the classes that this CorDapp needs are still usable by other
|
|
|
|
// CorDapps. Unfortunately, this means that we cannot shrink them as much as
|
|
|
|
// we'd like to.
|
2024-01-02 17:02:20 +00:00
|
|
|
keepclassmembers 'class com.opengamma.strata.** { *; }', includedescriptorclasses: true
|
|
|
|
keepclassmembers 'class com.google.** { *; }', includedescriptorclasses: true
|
|
|
|
keepclassmembers 'class org.joda.** { *; }', includedescriptorclasses: true
|
2018-07-17 11:31:44 +00:00
|
|
|
}
|
2018-12-10 13:57:56 +00:00
|
|
|
|
2024-01-02 17:02:20 +00:00
|
|
|
tasks.register('sign', SignJar) {
|
2018-12-10 13:57:56 +00:00
|
|
|
inputJars shrink
|
|
|
|
}
|
|
|
|
|
2019-05-20 15:16:49 +00:00
|
|
|
jar.finalizedBy shrink
|
2018-12-10 13:57:56 +00:00
|
|
|
shrink.finalizedBy sign
|
2018-07-17 11:31:44 +00:00
|
|
|
|
|
|
|
artifacts {
|
2023-12-19 11:14:35 +00:00
|
|
|
shrinkArtifacts shrinkJar
|
2018-07-17 11:31:44 +00:00
|
|
|
}
|