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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'java-library'
apply plugin: 'idea'
plugins {
id 'net.corda.plugins.publish-utils'
id 'com.jfrog.artifactory'
id 'java-library'
id 'idea'
}
apply from: "${rootProject.projectDir}/deterministic.gradle"
description 'Corda core (deterministic)'
evaluationDependsOn(":core")
@ -39,7 +46,7 @@ dependencies {
deterministicLibraries "net.i2p.crypto:eddsa:$eddsa_version"
}
jar {
tasks.getByName('jar') {
archiveBaseName = 'DOES-NOT-EXIST'
// 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.
@ -49,7 +56,8 @@ jar {
def coreJarTask = tasks.getByPath(':core:jar')
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")
metadataCharset 'UTF-8'
archiveClassifier = 'transient'
@ -70,8 +78,7 @@ task patchCore(type: Zip, dependsOn: coreJarTask) {
includeEmptyDirs = false
}
import proguard.gradle.ProGuardTask
task predeterminise(type: ProGuardTask) {
def predeterminise = tasks.register('predeterminise', ProGuardTask) {
injars patchCore
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>; }'
}
import net.corda.gradle.jarfilter.JarFilterTask
task jarFilter(type: JarFilterTask) {
def jarFilter = tasks.register('jarFilter', JarFilterTask) {
jars predeterminise
annotations {
forDelete = [
@ -158,9 +164,6 @@ task determinise(type: ProGuardTask) {
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) {
outputDir file("$buildDir/libs")
jars determinise
@ -171,7 +174,8 @@ task metafix(type: MetaFixerTask) {
}
// DOCSTART 01
task checkDeterminism(type: ProGuardTask, dependsOn: jdkTask) {
def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask) {
dependsOn jdkTask
injars metafix
libraryjars deterministic_rt_jar

View File

@ -1,25 +1,29 @@
apply plugin: 'kotlin'
plugins {
id 'org.jetbrains.kotlin.jvm'
}
dependencies {
testCompile project(path: ':core-deterministic', configuration: 'deterministicArtifacts')
testCompile project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts')
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'deterministicArtifacts')
testCompile project(path: ':core-deterministic:testing:data', configuration: 'testData')
testCompile(project(':finance:contracts')) {
testImplementation project(path: ':core-deterministic', configuration: 'deterministicArtifacts')
testImplementation project(path: ':serialization-deterministic', configuration: 'deterministicArtifacts')
testImplementation project(path: ':core-deterministic:testing:verifier', configuration: 'deterministicArtifacts')
testImplementation project(path: ':core-deterministic:testing:data', configuration: 'testData')
testImplementation(project(':finance:contracts')) {
transitive = false
}
testCompile(project(':finance:workflows')) {
testImplementation(project(':finance:workflows')) {
transitive = false
}
testImplementation "org.slf4j:slf4j-api:$slf4j_version"
testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "org.assertj:assertj-core:$assertj_version"
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "org.assertj:assertj-core:$assertj_version"
testImplementation "junit:junit:$junit_version"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junit_vintage_version}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"
}
// 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 {
testData
}
dependencies {
testCompile project(':core')
testCompile project(':finance:workflows')
testCompile project(':node-driver')
testCompile project(path: ':core-deterministic:testing:verifier', configuration: 'runtimeArtifacts')
testImplementation project(':core')
testImplementation project(':finance:workflows')
testImplementation project(':node-driver')
testImplementation project(path: ':core-deterministic:testing:verifier', configuration: 'runtimeArtifacts')
testCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile "org.jetbrains.kotlin:kotlin-reflect"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testImplementation "org.jetbrains.kotlin:kotlin-reflect"
testImplementation "junit:junit:$junit_version"
@ -19,7 +21,9 @@ dependencies {
testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"
}
jar.enabled = false
tasks.getByName('jar') {
enabled = false
}
test {
ext {

View File

@ -1,8 +1,10 @@
apply plugin: 'java-library'
apply from: '../../../deterministic.gradle'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'idea'
plugins {
id 'java-library'
id 'net.corda.plugins.publish-utils'
id 'com.jfrog.artifactory'
id 'idea'
}
apply from: "${rootProject.projectDir}/deterministic.gradle"
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
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'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'java-library'
apply plugin: 'idea'
description 'Corda serialization (deterministic)'
evaluationDependsOn(":serialization")
@ -37,7 +42,7 @@ dependencies {
implementation "com.google.guava:guava:$guava_version"
}
jar {
tasks.getByName('jar') {
archiveBaseName = 'DOES-NOT-EXIST'
// 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.
@ -47,7 +52,8 @@ jar {
def serializationJarTask = tasks.getByPath(':serialization:jar')
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")
metadataCharset 'UTF-8'
archiveClassifier = 'transient'
@ -69,8 +75,8 @@ task patchSerialization(type: Zip, dependsOn: serializationJarTask) {
includeEmptyDirs = false
}
import proguard.gradle.ProGuardTask
task predeterminise(type: ProGuardTask, dependsOn: project(':core-deterministic').assemble) {
def predeterminise = tasks.register('predeterminise', ProGuardTask) {
dependsOn project(':core-deterministic').assemble
injars patchSerialization
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>; }'
}
import net.corda.gradle.jarfilter.JarFilterTask
task jarFilter(type: JarFilterTask) {
def jarFilter = tasks.register('jarFilter', JarFilterTask) {
jars predeterminise
annotations {
forDelete = [
@ -148,7 +153,6 @@ task determinise(type: ProGuardTask) {
keepclassmembers 'class net.corda.serialization.** { public synthetic <methods>; }'
}
import net.corda.gradle.jarfilter.MetaFixerTask
task metafix(type: MetaFixerTask) {
outputDir file("$buildDir/libs")
jars determinise
@ -158,7 +162,8 @@ task metafix(type: MetaFixerTask) {
preserveTimestamps = false
}
task checkDeterminism(type: ProGuardTask, dependsOn: jdkTask) {
def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask) {
dependsOn jdkTask
injars metafix
libraryjars deterministic_rt_jar

View File

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