mirror of
https://github.com/corda/corda.git
synced 2025-01-30 08:04:16 +00:00
Remove some unused classes from the DJVM. (#4809)
Simplify DJVM Gradle files.
This commit is contained in:
parent
254d1b1631
commit
46909feef9
@ -19,7 +19,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
testCompile.extendsFrom shadow
|
testImplementation.extendsFrom shadow
|
||||||
jdkRt.resolutionStrategy {
|
jdkRt.resolutionStrategy {
|
||||||
// Always check the repository for a newer SNAPSHOT.
|
// Always check the repository for a newer SNAPSHOT.
|
||||||
cacheChangingModulesFor 0, 'seconds'
|
cacheChangingModulesFor 0, 'seconds'
|
||||||
@ -32,16 +32,16 @@ dependencies {
|
|||||||
shadow "org.slf4j:slf4j-api:$slf4j_version"
|
shadow "org.slf4j:slf4j-api:$slf4j_version"
|
||||||
|
|
||||||
// ASM: byte code manipulation library
|
// ASM: byte code manipulation library
|
||||||
compile "org.ow2.asm:asm:$asm_version"
|
implementation "org.ow2.asm:asm:$asm_version"
|
||||||
compile "org.ow2.asm:asm-commons:$asm_version"
|
implementation "org.ow2.asm:asm-commons:$asm_version"
|
||||||
|
|
||||||
// ClassGraph: classpath scanning
|
// ClassGraph: classpath scanning
|
||||||
shadow "io.github.classgraph:classgraph:$class_graph_version"
|
shadow "io.github.classgraph:classgraph:$class_graph_version"
|
||||||
|
|
||||||
// Test utilities
|
// Test utilities
|
||||||
testCompile "junit:junit:$junit_version"
|
testImplementation "junit:junit:$junit_version"
|
||||||
testCompile "org.assertj:assertj-core:$assertj_version"
|
testImplementation "org.assertj:assertj-core:$assertj_version"
|
||||||
testCompile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
|
testImplementation "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
|
||||||
jdkRt "net.corda:deterministic-rt:latest.integration"
|
jdkRt "net.corda:deterministic-rt:latest.integration"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,27 +2,14 @@ plugins {
|
|||||||
id 'com.github.johnrengelman.shadow'
|
id 'com.github.johnrengelman.shadow'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url "$artifactory_contextUrl/corda-dev"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
deterministicRt
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||||
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||||
compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
|
implementation "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
|
||||||
compile "com.jcabi:jcabi-manifests:$jcabi_manifests_version"
|
implementation "com.jcabi:jcabi-manifests:$jcabi_manifests_version"
|
||||||
|
|
||||||
compile "info.picocli:picocli:$picocli_version"
|
implementation "info.picocli:picocli:$picocli_version"
|
||||||
compile project(path: ":djvm", configuration: "shadow")
|
implementation project(path: ':djvm', configuration: 'shadow')
|
||||||
|
|
||||||
// Deterministic runtime - used in whitelist generation
|
|
||||||
deterministicRt project(path: ':jdk8u-deterministic', configuration: 'jdk')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar.enabled = false
|
jar.enabled = false
|
||||||
@ -39,10 +26,3 @@ shadowJar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assemble.dependsOn shadowJar
|
assemble.dependsOn shadowJar
|
||||||
|
|
||||||
task generateWhitelist(type: JavaExec, dependsOn: shadowJar) {
|
|
||||||
// This is an example of how a whitelist can be generated from a JAR. In most applications though, it is recommended
|
|
||||||
// that the minimal set whitelist is used.
|
|
||||||
main = '-jar'
|
|
||||||
args = [shadowJar.outputs.files.singleFile, 'whitelist', 'generate', '-o', "$buildDir/jdk8-deterministic.dat.gz", configurations.deterministicRt.files[0] ]
|
|
||||||
}
|
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package net.corda.djvm.analysis
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trie data structure to make prefix matching more efficient.
|
|
||||||
*/
|
|
||||||
class PrefixTree {
|
|
||||||
|
|
||||||
private class Node(val children: MutableMap<Char, Node> = mutableMapOf())
|
|
||||||
|
|
||||||
private val root = Node()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new prefix to the set.
|
|
||||||
*/
|
|
||||||
fun add(prefix: String) {
|
|
||||||
var node = root
|
|
||||||
for (char in prefix) {
|
|
||||||
val nextNode = node.children.computeIfAbsent(char) { Node() }
|
|
||||||
node = nextNode
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if any of the registered prefixes matches the provided string.
|
|
||||||
*/
|
|
||||||
fun contains(string: String): Boolean {
|
|
||||||
var node = root
|
|
||||||
for (char in string) {
|
|
||||||
val nextNode = node.children[char] ?: return false
|
|
||||||
if (nextNode.children.isEmpty()) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
node = nextNode
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -38,12 +38,7 @@ class IsolatedTask(
|
|||||||
exception = (ex as? LinkageError)?.cause ?: ex
|
exception = (ex as? LinkageError)?.cause ?: ex
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
costs = CostSummary(
|
costs = CostSummary(runtimeCosts)
|
||||||
runtimeCosts.allocationCost.value,
|
|
||||||
runtimeCosts.invocationCost.value,
|
|
||||||
runtimeCosts.jumpCost.value,
|
|
||||||
runtimeCosts.throwCost.value
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
logger.trace("Exiting isolated runtime environment...")
|
logger.trace("Exiting isolated runtime environment...")
|
||||||
completionLatch.countDown()
|
completionLatch.countDown()
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
package net.corda.djvm.validation
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Representation of the reason for why a reference has been marked as invalid.
|
|
||||||
*
|
|
||||||
* @property code The code used to label the error.
|
|
||||||
* @property classes A set of invalid class references, where applicable.
|
|
||||||
*/
|
|
||||||
data class Reason(
|
|
||||||
val code: Code,
|
|
||||||
val classes: List<String> = emptyList()
|
|
||||||
) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The derived description of the error.
|
|
||||||
*/
|
|
||||||
val description = classes.joinToString(", ").let {
|
|
||||||
when {
|
|
||||||
classes.size == 1 -> "${code.singularDescription}; $it"
|
|
||||||
classes.size > 1 -> "${code.pluralDescription}; $it"
|
|
||||||
else -> code.singularDescription
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Error codes used to label invalid references.
|
|
||||||
*
|
|
||||||
* @property singularDescription The description to use when [classes] is empty or has one element.
|
|
||||||
* @property pluralDescription The description to use when [classes] has more than one element.
|
|
||||||
*/
|
|
||||||
@Suppress("KDocMissingDocumentation")
|
|
||||||
enum class Code(
|
|
||||||
val singularDescription: String,
|
|
||||||
val pluralDescription: String = singularDescription
|
|
||||||
) {
|
|
||||||
INVALID_CLASS(
|
|
||||||
singularDescription = "entity signature contains an invalid reference",
|
|
||||||
pluralDescription = "entity signature contains invalid references"
|
|
||||||
),
|
|
||||||
NOT_WHITELISTED("entity is not whitelisted"),
|
|
||||||
ANNOTATED("entity is annotated with @NonDeterministic"),
|
|
||||||
NON_EXISTENT_CLASS("class does not exist"),
|
|
||||||
NON_EXISTENT_MEMBER("member does not exist")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user