mirror of
https://github.com/corda/corda.git
synced 2024-12-19 21:17:58 +00:00
CORDA-2902: Remove the CanonicalizerPlugin from buildSrc. (#5070)
This commit is contained in:
parent
cb85dd1e92
commit
531493325c
@ -1,22 +0,0 @@
|
||||
plugins {
|
||||
id 'groovy'
|
||||
id 'java-gradle-plugin'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
canonicalizerPlugin {
|
||||
id = 'net.corda.plugins.canonicalizer'
|
||||
implementationClass = 'CanonicalizerPlugin'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "com.google.guava:guava:$guava_version"
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
import com.google.common.io.ByteStreams
|
||||
import org.gradle.api.*
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipFile
|
||||
import java.util.zip.ZipOutputStream
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.attribute.FileTime
|
||||
import java.nio.file.Paths
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
// Custom Gradle plugin that attempts to make the resulting jar file deterministic.
|
||||
// Ie. same contract definition should result when compiled in same jar file.
|
||||
// This is done by removing date time stamps from the files inside the jar.
|
||||
class CanonicalizerPlugin implements Plugin<Project> {
|
||||
void apply(Project project) {
|
||||
|
||||
project.getTasks().getByName('jar').doLast() {
|
||||
|
||||
def zipPath = (String) project.jar.archivePath
|
||||
def destPath = Files.createTempFile("processzip", null)
|
||||
|
||||
def zeroTime = FileTime.fromMillis(0)
|
||||
|
||||
def input = new ZipFile(zipPath)
|
||||
def entries = input.entries().toList().sort { it.name }
|
||||
|
||||
def output = new ZipOutputStream(new FileOutputStream(destPath.toFile()))
|
||||
output.setMethod(ZipOutputStream.DEFLATED)
|
||||
|
||||
entries.each {
|
||||
def newEntry = new ZipEntry(it.name)
|
||||
|
||||
newEntry.setLastModifiedTime(zeroTime)
|
||||
newEntry.setCreationTime(zeroTime)
|
||||
newEntry.compressedSize = -1
|
||||
newEntry.size = it.size
|
||||
newEntry.crc = it.crc
|
||||
|
||||
output.putNextEntry(newEntry)
|
||||
|
||||
ByteStreams.copy(input.getInputStream(it), output)
|
||||
|
||||
output.closeEntry()
|
||||
}
|
||||
output.close()
|
||||
input.close()
|
||||
|
||||
Files.move(destPath, Paths.get(zipPath), StandardCopyOption.REPLACE_EXISTING)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
rootProject.name = 'buildSrc'
|
||||
include 'canonicalizer'
|
||||
|
||||
apply from: '../buildCacheSettings.gradle'
|
||||
apply from: '../buildCacheSettings.gradle'
|
||||
|
@ -1,7 +1,6 @@
|
||||
// This contains the SwapIdentitiesFlow which can be used for exchanging confidential identities as part of a flow.
|
||||
// TODO: Merge this into core: the original plan was to develop it independently but in practice it's too widely used to break compatibility now, as finance uses it.
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: CanonicalizerPlugin
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'net.corda.plugins.quasar-utils'
|
||||
apply plugin: 'net.corda.plugins.cordapp'
|
||||
@ -27,6 +26,8 @@ dependencies {
|
||||
|
||||
jar {
|
||||
baseName 'corda-confidential-identities'
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
}
|
||||
|
||||
publish {
|
||||
|
@ -2,7 +2,6 @@ apply plugin: 'kotlin'
|
||||
// Java Persistence API support: create no-arg constructor
|
||||
// see: http://stackoverflow.com/questions/32038177/kotlin-with-jpa-default-constructor-hell
|
||||
apply plugin: 'kotlin-jpa'
|
||||
apply plugin: CanonicalizerPlugin
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'net.corda.plugins.quasar-utils'
|
||||
apply plugin: 'net.corda.plugins.cordapp'
|
||||
@ -27,6 +26,8 @@ configurations {
|
||||
|
||||
jar {
|
||||
baseName 'corda-finance-contracts'
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
manifest {
|
||||
attributes('Corda-Revision': 'n/a')
|
||||
attributes('Corda-Vendor': 'Corda Open Source')
|
||||
@ -48,4 +49,4 @@ cordapp {
|
||||
|
||||
publish {
|
||||
name jar.baseName
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ apply plugin: 'kotlin'
|
||||
// Java Persistence API support: create no-arg constructor
|
||||
// see: http://stackoverflow.com/questions/32038177/kotlin-with-jpa-default-constructor-hell
|
||||
apply plugin: 'kotlin-jpa'
|
||||
apply plugin: CanonicalizerPlugin
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'net.corda.plugins.quasar-utils'
|
||||
apply plugin: 'net.corda.plugins.cordapp'
|
||||
@ -65,6 +64,8 @@ artifacts {
|
||||
|
||||
jar {
|
||||
baseName 'corda-finance-workflows'
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
@ -1,5 +1,4 @@
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: CanonicalizerPlugin
|
||||
apply plugin: 'net.corda.plugins.cordapp'
|
||||
|
||||
description 'Isolated CorDapp for testing'
|
||||
@ -8,6 +7,11 @@ dependencies {
|
||||
cordaCompile project(':core')
|
||||
}
|
||||
|
||||
jar {
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
}
|
||||
|
||||
cordapp {
|
||||
targetPlatformVersion corda_platform_version.toInteger()
|
||||
minimumPlatformVersion 1
|
||||
|
Loading…
Reference in New Issue
Block a user