NOTICK: Avoid configuring more tasks in the deterministic modules. (#6452)

This commit is contained in:
Chris Rankin 2020-07-13 10:33:23 +01:00 committed by GitHub
parent db13e3beb9
commit e684cfd1e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 28 deletions

View File

@ -54,8 +54,8 @@ tasks.named('jar', Jar) {
enabled = false enabled = false
} }
def coreJarTask = tasks.getByPath(':core:jar') def coreJarTask = project(':core').tasks.named('jar', Jar)
def originalJar = coreJarTask.outputs.files.singleFile def originalJar = coreJarTask.map { it.outputs.files.singleFile }
def patchCore = tasks.register('patchCore', Zip) { def patchCore = tasks.register('patchCore', Zip) {
dependsOn coreJarTask dependsOn coreJarTask
@ -132,7 +132,7 @@ def jarFilter = tasks.register('jarFilter', JarFilterTask) {
} }
} }
task determinise(type: ProGuardTask) { def determinise = tasks.register('determinise', ProGuardTask) {
injars jarFilter injars jarFilter
outjars file("$buildDir/proguard/$jarBaseName-${project.version}.jar") outjars file("$buildDir/proguard/$jarBaseName-${project.version}.jar")
@ -166,17 +166,20 @@ task determinise(type: ProGuardTask) {
keepclassmembers 'class net.corda.core.** { public synthetic <methods>; }' keepclassmembers 'class net.corda.core.** { public synthetic <methods>; }'
} }
task metafix(type: MetaFixerTask) { def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask)
def metafix = tasks.register('metafix', MetaFixerTask) {
outputDir file("$buildDir/libs") outputDir file("$buildDir/libs")
jars determinise jars determinise
suffix "" suffix ""
// Strip timestamps from the JAR to make it reproducible. // Strip timestamps from the JAR to make it reproducible.
preserveTimestamps = false preserveTimestamps = false
finalizedBy checkDeterminism
} }
// DOCSTART 01 // DOCSTART 01
def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask) { checkDeterminism.configure {
dependsOn jdkTask dependsOn jdkTask
injars metafix injars metafix
@ -197,14 +200,17 @@ def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask) {
// DOCEND 01 // DOCEND 01
defaultTasks "determinise" defaultTasks "determinise"
determinise.finalizedBy metafix determinise.configure {
metafix.finalizedBy checkDeterminism finalizedBy metafix
assemble.dependsOn checkDeterminism }
tasks.named('assemble') {
dependsOn checkDeterminism
}
def deterministicJar = metafix.outputs.files.singleFile def deterministicJar = metafix.map { it.outputs.files.singleFile }
artifacts { artifacts {
deterministicArtifacts file: deterministicJar, name: jarBaseName, type: 'jar', extension: 'jar', builtBy: metafix deterministicArtifacts deterministicJar
publish file: deterministicJar, name: jarBaseName, type: 'jar', extension: 'jar', builtBy: metafix publish deterministicJar
} }
tasks.named('sourceJar', Jar) { tasks.named('sourceJar', Jar) {

View File

@ -11,7 +11,7 @@ evaluationDependsOn(':jdk8u-deterministic')
def jdk8uDeterministic = project(':jdk8u-deterministic') def jdk8uDeterministic = project(':jdk8u-deterministic')
ext { ext {
jdkTask = jdk8uDeterministic.assemble jdkTask = jdk8uDeterministic.tasks.named('assemble')
deterministic_jdk_home = jdk8uDeterministic.jdk_home deterministic_jdk_home = jdk8uDeterministic.jdk_home
deterministic_rt_jar = jdk8uDeterministic.rt_jar deterministic_rt_jar = jdk8uDeterministic.rt_jar
} }

View File

@ -37,7 +37,9 @@ def copyJdk = tasks.register('copyJdk', Copy) {
} }
} }
assemble.dependsOn copyJdk tasks.named('assemble') {
dependsOn copyJdk
}
tasks.named('jar', Jar) { tasks.named('jar', Jar) {
enabled = false enabled = false
} }

View File

@ -39,9 +39,9 @@ capsule {
def nodeProject = project(':node') def nodeProject = project(':node')
task buildCordaJAR(type: FatCapsule, dependsOn: [ task buildCordaJAR(type: FatCapsule, dependsOn: [
nodeProject.tasks.jar, nodeProject.tasks.named('jar'),
project(':core-deterministic').tasks.assemble, project(':core-deterministic').tasks.named('assemble'),
project(':serialization-deterministic').tasks.assemble project(':serialization-deterministic').tasks.named('assemble')
]) { ]) {
applicationClass 'net.corda.node.Corda' applicationClass 'net.corda.node.Corda'
archiveBaseName = 'corda' archiveBaseName = 'corda'

View File

@ -50,8 +50,8 @@ tasks.named('jar', Jar) {
enabled = false enabled = false
} }
def serializationJarTask = tasks.getByPath(':serialization:jar') def serializationJarTask = project(':serialization').tasks.named('jar', Jar)
def originalJar = serializationJarTask.outputs.files.singleFile def originalJar = serializationJarTask.map { it.outputs.files.singleFile }
def patchSerialization = tasks.register('patchSerialization', Zip) { def patchSerialization = tasks.register('patchSerialization', Zip) {
dependsOn serializationJarTask dependsOn serializationJarTask
@ -77,7 +77,7 @@ def patchSerialization = tasks.register('patchSerialization', Zip) {
} }
def predeterminise = tasks.register('predeterminise', ProGuardTask) { def predeterminise = tasks.register('predeterminise', ProGuardTask) {
dependsOn project(':core-deterministic').assemble dependsOn project(':core-deterministic').tasks.named('assemble')
injars patchSerialization injars patchSerialization
outjars file("$buildDir/proguard/pre-deterministic-${project.version}.jar") outjars file("$buildDir/proguard/pre-deterministic-${project.version}.jar")
@ -125,7 +125,7 @@ def jarFilter = tasks.register('jarFilter', JarFilterTask) {
} }
} }
task determinise(type: ProGuardTask) { def determinise = tasks.register('determinise', ProGuardTask) {
injars jarFilter injars jarFilter
outjars file("$buildDir/proguard/$jarBaseName-${project.version}.jar") outjars file("$buildDir/proguard/$jarBaseName-${project.version}.jar")
@ -154,16 +154,19 @@ task determinise(type: ProGuardTask) {
keepclassmembers 'class net.corda.serialization.** { public synthetic <methods>; }' keepclassmembers 'class net.corda.serialization.** { public synthetic <methods>; }'
} }
task metafix(type: MetaFixerTask) { def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask)
def metafix = tasks.register('metafix', MetaFixerTask) {
outputDir file("$buildDir/libs") outputDir file("$buildDir/libs")
jars determinise jars determinise
suffix "" suffix ""
// Strip timestamps from the JAR to make it reproducible. // Strip timestamps from the JAR to make it reproducible.
preserveTimestamps = false preserveTimestamps = false
finalizedBy checkDeterminism
} }
def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask) { checkDeterminism.configure {
dependsOn jdkTask dependsOn jdkTask
injars metafix injars metafix
@ -183,14 +186,17 @@ def checkDeterminism = tasks.register('checkDeterminism', ProGuardTask) {
} }
defaultTasks "determinise" defaultTasks "determinise"
determinise.finalizedBy metafix determinise.configure {
metafix.finalizedBy checkDeterminism finalizedBy metafix
assemble.dependsOn checkDeterminism }
tasks.named('assemble') {
dependsOn checkDeterminism
}
def deterministicJar = metafix.outputs.files.singleFile def deterministicJar = metafix.map { it.outputs.files.singleFile }
artifacts { artifacts {
deterministicArtifacts file: deterministicJar, name: jarBaseName, type: 'jar', extension: 'jar', builtBy: metafix deterministicArtifacts deterministicJar
publish file: deterministicJar, name: jarBaseName, type: 'jar', extension: 'jar', builtBy: metafix publish deterministicJar
} }
tasks.named('sourceJar', Jar) { tasks.named('sourceJar', Jar) {