NOTICK: Update Gradle scripts for deterministic modules. (#5978)

This commit is contained in:
Chris Rankin
2020-02-18 09:12:19 +00:00
committed by GitHub
parent cd39456dab
commit 20d1037610
6 changed files with 77 additions and 54 deletions

View File

@ -1,10 +1,17 @@
description 'Corda core (deterministic)' import net.corda.gradle.jarfilter.JarFilterTask
import net.corda.gradle.jarfilter.MetaFixerTask
import proguard.gradle.ProGuardTask
import static org.gradle.api.JavaVersion.VERSION_1_8
apply from: '../deterministic.gradle' plugins {
apply plugin: 'com.jfrog.artifactory' id 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.publish-utils' id 'com.jfrog.artifactory'
apply plugin: 'java-library' id 'java-library'
apply plugin: 'idea' id 'idea'
}
apply from: "${rootProject.projectDir}/deterministic.gradle"
description 'Corda core (deterministic)'
evaluationDependsOn(":core") evaluationDependsOn(":core")
@ -39,7 +46,7 @@ dependencies {
deterministicLibraries "net.i2p.crypto:eddsa:$eddsa_version" deterministicLibraries "net.i2p.crypto:eddsa:$eddsa_version"
} }
jar { tasks.getByName('jar') {
archiveBaseName = 'DOES-NOT-EXIST' archiveBaseName = 'DOES-NOT-EXIST'
// Don't build a jar here because it would be the wrong one. // Don't build a jar here because it would be the wrong one.
// The jar we really want will be built by the metafix task. // The jar we really want will be built by the metafix task.
@ -49,7 +56,8 @@ jar {
def coreJarTask = tasks.getByPath(':core:jar') def coreJarTask = tasks.getByPath(':core:jar')
def originalJar = coreJarTask.outputs.files.singleFile def originalJar = coreJarTask.outputs.files.singleFile
task patchCore(type: Zip, dependsOn: coreJarTask) { def patchCore = tasks.register('patchCore', Zip) {
dependsOn coreJarTask
destinationDirectory = file("$buildDir/source-libs") destinationDirectory = file("$buildDir/source-libs")
metadataCharset 'UTF-8' metadataCharset 'UTF-8'
archiveClassifier = 'transient' archiveClassifier = 'transient'
@ -70,8 +78,7 @@ task patchCore(type: Zip, dependsOn: coreJarTask) {
includeEmptyDirs = false includeEmptyDirs = false
} }
import proguard.gradle.ProGuardTask def predeterminise = tasks.register('predeterminise', ProGuardTask) {
task predeterminise(type: ProGuardTask) {
injars patchCore injars patchCore
outjars file("$buildDir/proguard/pre-deterministic-${project.version}.jar") outjars file("$buildDir/proguard/pre-deterministic-${project.version}.jar")
@ -104,8 +111,7 @@ task predeterminise(type: ProGuardTask) {
keepclassmembers 'class net.corda.core.** { public synthetic <methods>; }' keepclassmembers 'class net.corda.core.** { public synthetic <methods>; }'
} }
import net.corda.gradle.jarfilter.JarFilterTask def jarFilter = tasks.register('jarFilter', JarFilterTask) {
task jarFilter(type: JarFilterTask) {
jars predeterminise jars predeterminise
annotations { annotations {
forDelete = [ forDelete = [
@ -158,9 +164,6 @@ task determinise(type: ProGuardTask) {
keepclassmembers 'class net.corda.core.** { public synthetic <methods>; }' keepclassmembers 'class net.corda.core.** { public synthetic <methods>; }'
} }
import net.corda.gradle.jarfilter.MetaFixerTask
import static org.gradle.api.JavaVersion.VERSION_1_8
task metafix(type: MetaFixerTask) { task metafix(type: MetaFixerTask) {
outputDir file("$buildDir/libs") outputDir file("$buildDir/libs")
jars determinise jars determinise
@ -171,7 +174,8 @@ task metafix(type: MetaFixerTask) {
} }
// DOCSTART 01 // DOCSTART 01
task checkDeterminism(type: ProGuardTask, dependsOn: jdkTask) { def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask) {
dependsOn jdkTask
injars metafix injars metafix
libraryjars deterministic_rt_jar libraryjars deterministic_rt_jar

View File

@ -1,25 +1,29 @@
apply plugin: 'kotlin' plugins {
id 'org.jetbrains.kotlin.jvm'
}
dependencies { dependencies {
testCompile project(path: ':core-deterministic', configuration: 'deterministicArtifacts') testImplementation project(path: ':core-deterministic', configuration: 'deterministicArtifacts')
testCompile project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts') testImplementation project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts')
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'deterministicArtifacts') testImplementation project(path: ':core-deterministic:testing:verifier', configuration: 'deterministicArtifacts')
testCompile project(path: ':core-deterministic:testing:data', configuration: 'testData') testImplementation project(path: ':core-deterministic:testing:data', configuration: 'testData')
testCompile(project(':finance:contracts')) { testImplementation(project(':finance:contracts')) {
transitive = false transitive = false
} }
testCompile(project(':finance:workflows')) { testImplementation(project(':finance:workflows')) {
transitive = false transitive = false
} }
testImplementation "org.slf4j:slf4j-api:$slf4j_version" testImplementation "org.slf4j:slf4j-api:$slf4j_version"
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "org.assertj:assertj-core:$assertj_version" testImplementation "org.assertj:assertj-core:$assertj_version"
testImplementation "junit:junit:$junit_version" testImplementation "junit:junit:$junit_version"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junit_vintage_version}" testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junit_vintage_version}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}" testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"
} }
// This module has no artifact and only contains tests. // This module has no artifact and only contains tests.
jar.enabled = false tasks.getByName('jar') {
enabled = false
}

View File

@ -1,17 +1,19 @@
apply plugin: 'kotlin' plugins {
id 'org.jetbrains.kotlin.jvm'
}
configurations { configurations {
testData testData
} }
dependencies { dependencies {
testCompile project(':core') testImplementation project(':core')
testCompile project(':finance:workflows') testImplementation project(':finance:workflows')
testCompile project(':node-driver') testImplementation project(':node-driver')
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'runtimeArtifacts') testImplementation project(path: ':core-deterministic:testing:verifier', configuration: 'runtimeArtifacts')
testCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8" testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile "org.jetbrains.kotlin:kotlin-reflect" testImplementation "org.jetbrains.kotlin:kotlin-reflect"
testImplementation "junit:junit:$junit_version" testImplementation "junit:junit:$junit_version"
@ -19,7 +21,9 @@ dependencies {
testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}" testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"
} }
jar.enabled = false tasks.getByName('jar') {
enabled = false
}
test { test {
ext { ext {

View File

@ -1,8 +1,10 @@
apply plugin: 'java-library' plugins {
apply from: '../../../deterministic.gradle' id 'java-library'
apply plugin: 'net.corda.plugins.publish-utils' id 'net.corda.plugins.publish-utils'
apply plugin: 'com.jfrog.artifactory' id 'com.jfrog.artifactory'
apply plugin: 'idea' id 'idea'
}
apply from: "${rootProject.projectDir}/deterministic.gradle"
description 'Test utilities for deterministic contract verification' description 'Test utilities for deterministic contract verification'

View File

@ -1,12 +1,17 @@
import net.corda.gradle.jarfilter.JarFilterTask
import net.corda.gradle.jarfilter.MetaFixerTask
import proguard.gradle.ProGuardTask
import static org.gradle.api.JavaVersion.VERSION_1_8 import static org.gradle.api.JavaVersion.VERSION_1_8
description 'Corda serialization (deterministic)' plugins {
id 'net.corda.plugins.publish-utils'
id 'com.jfrog.artifactory'
id 'java-library'
id 'idea'
}
apply from: "${rootProject.projectDir}/deterministic.gradle"
apply from: '../deterministic.gradle' description 'Corda serialization (deterministic)'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'java-library'
apply plugin: 'idea'
evaluationDependsOn(":serialization") evaluationDependsOn(":serialization")
@ -37,7 +42,7 @@ dependencies {
implementation "com.google.guava:guava:$guava_version" implementation "com.google.guava:guava:$guava_version"
} }
jar { tasks.getByName('jar') {
archiveBaseName = 'DOES-NOT-EXIST' archiveBaseName = 'DOES-NOT-EXIST'
// Don't build a jar here because it would be the wrong one. // Don't build a jar here because it would be the wrong one.
// The jar we really want will be built by the metafix task. // The jar we really want will be built by the metafix task.
@ -47,7 +52,8 @@ jar {
def serializationJarTask = tasks.getByPath(':serialization:jar') def serializationJarTask = tasks.getByPath(':serialization:jar')
def originalJar = serializationJarTask.outputs.files.singleFile def originalJar = serializationJarTask.outputs.files.singleFile
task patchSerialization(type: Zip, dependsOn: serializationJarTask) { def patchSerialization = tasks.register('patchSerialization', Zip) {
dependsOn serializationJarTask
destinationDirectory = file("$buildDir/source-libs") destinationDirectory = file("$buildDir/source-libs")
metadataCharset 'UTF-8' metadataCharset 'UTF-8'
archiveClassifier = 'transient' archiveClassifier = 'transient'
@ -69,8 +75,8 @@ task patchSerialization(type: Zip, dependsOn: serializationJarTask) {
includeEmptyDirs = false includeEmptyDirs = false
} }
import proguard.gradle.ProGuardTask def predeterminise = tasks.register('predeterminise', ProGuardTask) {
task predeterminise(type: ProGuardTask, dependsOn: project(':core-deterministic').assemble) { dependsOn project(':core-deterministic').assemble
injars patchSerialization injars patchSerialization
outjars file("$buildDir/proguard/pre-deterministic-${project.version}.jar") outjars file("$buildDir/proguard/pre-deterministic-${project.version}.jar")
@ -100,8 +106,7 @@ task predeterminise(type: ProGuardTask, dependsOn: project(':core-deterministic'
keepclassmembers 'class net.corda.serialization.** { public synthetic <methods>; }' keepclassmembers 'class net.corda.serialization.** { public synthetic <methods>; }'
} }
import net.corda.gradle.jarfilter.JarFilterTask def jarFilter = tasks.register('jarFilter', JarFilterTask) {
task jarFilter(type: JarFilterTask) {
jars predeterminise jars predeterminise
annotations { annotations {
forDelete = [ forDelete = [
@ -148,7 +153,6 @@ task determinise(type: ProGuardTask) {
keepclassmembers 'class net.corda.serialization.** { public synthetic <methods>; }' keepclassmembers 'class net.corda.serialization.** { public synthetic <methods>; }'
} }
import net.corda.gradle.jarfilter.MetaFixerTask
task metafix(type: MetaFixerTask) { task metafix(type: MetaFixerTask) {
outputDir file("$buildDir/libs") outputDir file("$buildDir/libs")
jars determinise jars determinise
@ -158,7 +162,8 @@ task metafix(type: MetaFixerTask) {
preserveTimestamps = false preserveTimestamps = false
} }
task checkDeterminism(type: ProGuardTask, dependsOn: jdkTask) { def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask) {
dependsOn jdkTask
injars metafix injars metafix
libraryjars deterministic_rt_jar libraryjars deterministic_rt_jar

View File

@ -5,7 +5,7 @@ plugins {
id 'java-library' id 'java-library'
id 'idea' id 'idea'
} }
apply from: '../../deterministic.gradle' apply from: "${rootProject.projectDir}/deterministic.gradle"
description 'Deserializers for the DJVM' description 'Deserializers for the DJVM'
@ -31,5 +31,9 @@ idea {
module { module {
downloadJavadoc = true downloadJavadoc = true
downloadSources = true downloadSources = true
if (project.hasProperty("deterministic_idea_sdk")) {
jdkName project.property("deterministic_idea_sdk") as String
}
} }
} }