mirror of
https://github.com/corda/corda.git
synced 2024-12-19 21:17:58 +00:00
CORDA-3644: Add Corda-Testing tag to test artifacts' MANIFEST.MF. (#6032)
This commit is contained in:
parent
60a74c0399
commit
e5a8888232
@ -29,7 +29,13 @@ dependencies {
|
||||
jar {
|
||||
baseName 'corda-mock'
|
||||
manifest {
|
||||
attributes 'Automatic-Module-Name': 'net.corda.client.mock'
|
||||
attributes(
|
||||
'Automatic-Module-Name': 'net.corda.client.mock',
|
||||
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
'Corda-Testing': true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,11 @@ dependencies {
|
||||
compile project(":core")
|
||||
}
|
||||
|
||||
jar{
|
||||
jar {
|
||||
baseName "testing-dbfailure-contracts"
|
||||
manifest {
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
attributes('Corda-Testing': true)
|
||||
}
|
||||
}
|
@ -7,6 +7,11 @@ dependencies {
|
||||
compile project(":testing:cordapps:dbfailure:dbfcontracts")
|
||||
}
|
||||
|
||||
jar{
|
||||
jar {
|
||||
baseName "testing-dbfailure-workflows"
|
||||
manifest {
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
attributes('Corda-Testing': true)
|
||||
}
|
||||
}
|
@ -66,6 +66,11 @@ task integrationTest(type: Test) {
|
||||
|
||||
jar {
|
||||
baseName 'corda-node-driver'
|
||||
manifest {
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
attributes('Corda-Testing': true)
|
||||
}
|
||||
}
|
||||
|
||||
publish {
|
||||
|
@ -1,3 +1,4 @@
|
||||
@file:Suppress("TooManyFunctions")
|
||||
package net.corda.testing.node.internal
|
||||
|
||||
import co.paralleluniverse.fibers.instrument.JavaAgent
|
||||
@ -112,6 +113,7 @@ import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeoutException
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.jar.JarInputStream
|
||||
import java.util.jar.Manifest
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.collections.HashSet
|
||||
@ -806,6 +808,8 @@ class DriverDSLImpl(
|
||||
Permissions.invokeRpc(CordaRPCOps::killFlow)
|
||||
)
|
||||
|
||||
private const val CORDA_TESTING_ATTRIBUTE = "Corda-Testing"
|
||||
|
||||
private val CORDAPP_MANIFEST_ATTRIBUTES: List<String> = unmodifiableList(listOf(
|
||||
CORDAPP_CONTRACT_NAME,
|
||||
CORDAPP_CONTRACT_LICENCE,
|
||||
@ -952,7 +956,7 @@ class DriverDSLImpl(
|
||||
val cpPathEntry = Paths.get(cpEntry)
|
||||
cpPathEntry.isRegularFile()
|
||||
&& !isTestArtifact(cpPathEntry.fileName.toString())
|
||||
&& !cpPathEntry.isCorDapp
|
||||
&& !cpPathEntry.isExcludedJar
|
||||
}
|
||||
|
||||
return ProcessUtilities.startJavaProcess(
|
||||
@ -980,12 +984,21 @@ class DriverDSLImpl(
|
||||
|| name.startsWith("mockito")
|
||||
}
|
||||
|
||||
// Identify Corda's own testing framework by attribute in MANIFEST.MF.
|
||||
private fun isTestArtifact(manifest: Manifest): Boolean {
|
||||
return manifest[CORDA_TESTING_ATTRIBUTE] != null
|
||||
}
|
||||
|
||||
// Identify CorDapp JARs by their attributes in MANIFEST.MF.
|
||||
private val Path.isCorDapp: Boolean get() {
|
||||
private fun isCordapp(manifest: Manifest): Boolean {
|
||||
return CORDAPP_MANIFEST_ATTRIBUTES.any { manifest[it] != null }
|
||||
|| (manifest[TARGET_PLATFORM_VERSION] != null && manifest[MIN_PLATFORM_VERSION] != null)
|
||||
}
|
||||
|
||||
private val Path.isExcludedJar: Boolean get() {
|
||||
return JarInputStream(Files.newInputStream(this).buffered()).use { jar ->
|
||||
val manifest = jar.manifest ?: return false
|
||||
CORDAPP_MANIFEST_ATTRIBUTES.any { manifest[it] != null }
|
||||
|| (manifest[TARGET_PLATFORM_VERSION] != null && manifest[MIN_PLATFORM_VERSION] != null)
|
||||
isCordapp(manifest) || isTestArtifact(manifest)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,3 +7,11 @@ dependencies {
|
||||
compile project(':test-common')
|
||||
compile project(':client:rpc')
|
||||
}
|
||||
|
||||
tasks.named('jar', Jar) {
|
||||
manifest {
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
attributes('Corda-Testing': true)
|
||||
}
|
||||
}
|
@ -14,10 +14,12 @@ dependencies {
|
||||
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junit_vintage_version}"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junit_jupiter_version}"
|
||||
testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"
|
||||
|
||||
}
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
languageVersion = "1.2"
|
||||
|
||||
tasks.named('jar', Jar) {
|
||||
manifest {
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
attributes('Corda-Testing': true)
|
||||
}
|
||||
}
|
@ -25,6 +25,11 @@ dependencies {
|
||||
|
||||
jar {
|
||||
baseName 'corda-test-common'
|
||||
manifest {
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
attributes('Corda-Testing': true)
|
||||
}
|
||||
}
|
||||
|
||||
publish {
|
||||
|
@ -16,6 +16,11 @@ dependencies {
|
||||
|
||||
jar {
|
||||
baseName 'corda-test-db'
|
||||
manifest {
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
attributes('Corda-Testing': true)
|
||||
}
|
||||
}
|
||||
|
||||
publish {
|
||||
|
@ -36,6 +36,11 @@ dependencies {
|
||||
|
||||
jar {
|
||||
baseName 'corda-test-utils'
|
||||
manifest {
|
||||
// This JAR is part of Corda's testing framework.
|
||||
// Driver will not include it as part of an out-of-process node.
|
||||
attributes('Corda-Testing': true)
|
||||
}
|
||||
}
|
||||
|
||||
publish {
|
||||
|
Loading…
Reference in New Issue
Block a user