From 7839d78338b4175af677ca81809258479a1e10ba Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Wed, 4 Jul 2018 09:15:54 +0100 Subject: [PATCH] CORDA-1704: Suppress ProGuard's "note" output (#3499) * Reduce ProGuard output for kotlin-metadata artifact. * Configure ProGuard not to display "notes" about potential configuration issues. Keep notes for the "checkDeterminism" steps, though. * Also resolve some of the issues that we would now be ignoring. --- buildSrc/jarfilter/kotlin-metadata/build.gradle | 4 ++-- core-deterministic/build.gradle | 3 ++- .../src/main/kotlin/net/corda/core/flows/StateMachineRunId.kt | 2 +- .../main/kotlin/net/corda/core/internal/FlowStateMachine.kt | 2 ++ serialization-deterministic/build.gradle | 3 ++- .../main/kotlin/net/corda/serialization/internal/OrdinalIO.kt | 1 + .../net/corda/serialization/internal/amqp/CustomSerializer.kt | 2 ++ .../net/corda/serialization/internal/amqp/TransformTypes.kt | 1 + .../net/corda/serialization/internal/amqp/TransformsSchema.kt | 1 + 9 files changed, 14 insertions(+), 5 deletions(-) diff --git a/buildSrc/jarfilter/kotlin-metadata/build.gradle b/buildSrc/jarfilter/kotlin-metadata/build.gradle index b509187551..561cea19a1 100644 --- a/buildSrc/jarfilter/kotlin-metadata/build.gradle +++ b/buildSrc/jarfilter/kotlin-metadata/build.gradle @@ -39,7 +39,6 @@ task metadata(type: ProGuardTask) { keepattributes '*' dontoptimize - printseeds verbose dontwarn 'com.sun.jna.**' @@ -47,6 +46,7 @@ task metadata(type: ProGuardTask) { dontwarn 'org.jetbrains.kotlin.com.intellij.**' dontwarn 'org.jetbrains.kotlin.com.google.j2objc.annotations.**' dontwarn 'org.jetbrains.kotlin.com.google.errorprone.annotations.**' + dontnote keep 'class org.jetbrains.kotlin.load.java.JvmAnnotationNames { *; }' keep 'class org.jetbrains.kotlin.metadata.** { *; }', includedescriptorclasses: true @@ -68,6 +68,7 @@ task validate(type: ProGuardTask) { verbose dontwarn 'org.jetbrains.kotlin.com.google.errorprone.annotations.**' + dontnote keep 'class *' } @@ -77,5 +78,4 @@ artifacts { } defaultTasks "metadata" -assemble.dependsOn metadata metadata.finalizedBy validate diff --git a/core-deterministic/build.gradle b/core-deterministic/build.gradle index 80a0232dbf..5768501551 100644 --- a/core-deterministic/build.gradle +++ b/core-deterministic/build.gradle @@ -78,6 +78,7 @@ task predeterminise(type: ProGuardTask) { dontpreverify dontobfuscate dontoptimize + dontnote printseeds verbose @@ -121,6 +122,7 @@ task determinise(type: ProGuardTask) { keepattributes '*' keepdirectories dontobfuscate + dontnote printseeds verbose @@ -166,7 +168,6 @@ task checkDeterminism(type: ProGuardTask, dependsOn: jdkTask) { defaultTasks "determinise" determinise.finalizedBy metafix metafix.finalizedBy checkDeterminism -assemble.dependsOn checkDeterminism def deterministicJar = metafix.outputs.files.singleFile artifacts { diff --git a/core/src/main/kotlin/net/corda/core/flows/StateMachineRunId.kt b/core/src/main/kotlin/net/corda/core/flows/StateMachineRunId.kt index 98956e1c24..47de376947 100644 --- a/core/src/main/kotlin/net/corda/core/flows/StateMachineRunId.kt +++ b/core/src/main/kotlin/net/corda/core/flows/StateMachineRunId.kt @@ -8,10 +8,10 @@ import java.util.* * A unique identifier for a single state machine run, valid across node restarts. Note that a single run always * has at least one flow, but that flow may also invoke sub-flows: they all share the same run id. */ +@DeleteForDJVM @CordaSerializable data class StateMachineRunId(val uuid: UUID) { companion object { - @DeleteForDJVM fun createRandom(): StateMachineRunId = StateMachineRunId(UUID.randomUUID()) } diff --git a/core/src/main/kotlin/net/corda/core/internal/FlowStateMachine.kt b/core/src/main/kotlin/net/corda/core/internal/FlowStateMachine.kt index 1cdf50f088..d055f3ec12 100644 --- a/core/src/main/kotlin/net/corda/core/internal/FlowStateMachine.kt +++ b/core/src/main/kotlin/net/corda/core/internal/FlowStateMachine.kt @@ -1,6 +1,7 @@ package net.corda.core.internal import co.paralleluniverse.fibers.Suspendable +import net.corda.core.DeleteForDJVM import net.corda.core.DoNotImplement import net.corda.core.concurrent.CordaFuture import net.corda.core.context.InvocationContext @@ -10,6 +11,7 @@ import net.corda.core.node.ServiceHub import org.slf4j.Logger /** This is an internal interface that is implemented by code in the node module. You should look at [FlowLogic]. */ +@DeleteForDJVM @DoNotImplement interface FlowStateMachine { @Suspendable diff --git a/serialization-deterministic/build.gradle b/serialization-deterministic/build.gradle index 54530bad3e..9a30fc5862 100644 --- a/serialization-deterministic/build.gradle +++ b/serialization-deterministic/build.gradle @@ -74,6 +74,7 @@ task predeterminise(type: ProGuardTask, dependsOn: project(':core-deterministic' dontpreverify dontobfuscate dontoptimize + dontnote printseeds verbose @@ -114,6 +115,7 @@ task determinise(type: ProGuardTask) { keepattributes '*' keepdirectories dontobfuscate + dontnote printseeds verbose @@ -152,7 +154,6 @@ task checkDeterminism(type: ProGuardTask, dependsOn: jdkTask) { defaultTasks "determinise" determinise.finalizedBy metafix metafix.finalizedBy checkDeterminism -assemble.dependsOn checkDeterminism def deterministicJar = metafix.outputs.files.singleFile artifacts { diff --git a/serialization/src/main/kotlin/net/corda/serialization/internal/OrdinalIO.kt b/serialization/src/main/kotlin/net/corda/serialization/internal/OrdinalIO.kt index cc8082bb5b..23e1e3b159 100644 --- a/serialization/src/main/kotlin/net/corda/serialization/internal/OrdinalIO.kt +++ b/serialization/src/main/kotlin/net/corda/serialization/internal/OrdinalIO.kt @@ -8,6 +8,7 @@ import java.nio.ByteBuffer @KeepForDJVM class OrdinalBits(private val ordinal: Int) { + @KeepForDJVM interface OrdinalWriter { val bits: OrdinalBits @JvmDefault val encodedSize get() = 1 diff --git a/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/CustomSerializer.kt b/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/CustomSerializer.kt index f920b6e792..f99a842758 100644 --- a/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/CustomSerializer.kt +++ b/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/CustomSerializer.kt @@ -1,5 +1,6 @@ package net.corda.serialization.internal.amqp +import net.corda.core.KeepForDJVM import net.corda.core.internal.uncheckedCast import net.corda.core.serialization.SerializationContext import net.corda.serialization.internal.amqp.SerializerFactory.Companion.nameForType @@ -58,6 +59,7 @@ abstract class CustomSerializer : AMQPSerializer, SerializerFor { * subclass in the schema, so that we can distinguish between subclasses. */ // TODO: should this be a custom serializer at all, or should it just be a plain AMQPSerializer? + @KeepForDJVM class SubClass(private val clazz: Class<*>, private val superClassSerializer: CustomSerializer) : CustomSerializer() { // TODO: should this be empty or contain the schema of the super? override val schemaForDocumentation = Schema(emptyList()) diff --git a/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/TransformTypes.kt b/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/TransformTypes.kt index 3356ab2e47..74c2582ee3 100644 --- a/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/TransformTypes.kt +++ b/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/TransformTypes.kt @@ -70,6 +70,7 @@ enum class TransformTypes(val build: (Annotation) -> Transform) : DescribedType * @param constants The list of enum constants on the type the transforms are being applied to */ override fun validate(list: List, constants: Map) { + @KeepForDJVM data class Node(val transform: RenameSchemaTransform, var next: Node?, var prev: Node?, var visitedBy: Node? = null) { fun visit(visitedBy: Node) { this.visitedBy = visitedBy diff --git a/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/TransformsSchema.kt b/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/TransformsSchema.kt index 0d63078cd4..d2eda87085 100644 --- a/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/TransformsSchema.kt +++ b/serialization/src/main/kotlin/net/corda/serialization/internal/amqp/TransformsSchema.kt @@ -154,6 +154,7 @@ class EnumDefaultSchemaTransform(val old: String, val new: String) : Transform() * @property from the name of the property or constant prior to being changed, i.e. what it was * @property to the new name of the property or constant after the change has been made, i.e. what it is now */ +@KeepForDJVM class RenameSchemaTransform(val from: String, val to: String) : Transform() { companion object : DescribedTypeConstructor { /**