mirror of
https://github.com/corda/corda.git
synced 2025-03-04 05:02:38 +00:00
CORDA-1389 - Delete the root nodes directory before initialising the nodes. (#3044)
This is to enable multiple calls to deployNodes without doing a gradle clean.
This commit is contained in:
parent
9063e24c69
commit
5d4956079a
@ -1,4 +1,4 @@
|
|||||||
gradlePluginsVersion=3.1.0
|
gradlePluginsVersion=3.2.0
|
||||||
kotlinVersion=1.1.60
|
kotlinVersion=1.1.60
|
||||||
platformVersion=3
|
platformVersion=3
|
||||||
guavaVersion=21.0
|
guavaVersion=21.0
|
||||||
|
@ -118,6 +118,7 @@ open class Baseform : DefaultTask() {
|
|||||||
"'directory' cannot be used when 'definitionClass' is specified. Use CordformDefinition.nodesDirectory instead."
|
"'directory' cannot be used when 'definitionClass' is specified. Use CordformDefinition.nodesDirectory instead."
|
||||||
}
|
}
|
||||||
directory = cd.nodesDirectory
|
directory = cd.nodesDirectory
|
||||||
|
deleteRootDir()
|
||||||
val cordapps = cd.getMatchingCordapps()
|
val cordapps = cd.getMatchingCordapps()
|
||||||
cd.nodeConfigurers.forEach {
|
cd.nodeConfigurers.forEach {
|
||||||
val node = node { }
|
val node = node { }
|
||||||
@ -127,21 +128,26 @@ open class Baseform : DefaultTask() {
|
|||||||
}
|
}
|
||||||
cd.setup { nodeName -> project.projectDir.toPath().resolve(getNodeByName(nodeName)!!.nodeDir.toPath()) }
|
cd.setup { nodeName -> project.projectDir.toPath().resolve(getNodeByName(nodeName)!!.nodeDir.toPath()) }
|
||||||
} else {
|
} else {
|
||||||
|
deleteRootDir()
|
||||||
nodes.forEach {
|
nodes.forEach {
|
||||||
it.rootDir(directory)
|
it.rootDir(directory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun deleteRootDir() {
|
||||||
|
project.logger.info("Deleting $directory")
|
||||||
|
project.delete(directory)
|
||||||
|
}
|
||||||
|
|
||||||
protected fun bootstrapNetwork() {
|
protected fun bootstrapNetwork() {
|
||||||
val networkBootstrapperClass = loadNetworkBootstrapperClass()
|
val networkBootstrapperClass = loadNetworkBootstrapperClass()
|
||||||
val networkBootstrapper = networkBootstrapperClass.newInstance()
|
val networkBootstrapper = networkBootstrapperClass.newInstance()
|
||||||
val bootstrapMethod = networkBootstrapperClass.getMethod("bootstrap", Path::class.java, List::class.java).apply { isAccessible = true }
|
val bootstrapMethod = networkBootstrapperClass.getMethod("bootstrap", Path::class.java, List::class.java).apply { isAccessible = true }
|
||||||
// Call NetworkBootstrapper.bootstrap
|
|
||||||
try {
|
|
||||||
// Create a list of all cordapps used in this network and pass it to the bootstrapper.
|
|
||||||
val allCordapps = nodes.flatMap { it.additionalCordapps + it.getCordappList() }.distinct().map { it.absolutePath }
|
val allCordapps = nodes.flatMap { it.additionalCordapps + it.getCordappList() }.distinct().map { it.absolutePath }
|
||||||
val rootDir = project.projectDir.toPath().resolve(directory).toAbsolutePath().normalize()
|
val rootDir = project.projectDir.toPath().resolve(directory).toAbsolutePath().normalize()
|
||||||
|
try {
|
||||||
|
// Call NetworkBootstrapper.bootstrap
|
||||||
bootstrapMethod.invoke(networkBootstrapper, rootDir, allCordapps)
|
bootstrapMethod.invoke(networkBootstrapper, rootDir, allCordapps)
|
||||||
} catch (e: InvocationTargetException) {
|
} catch (e: InvocationTargetException) {
|
||||||
throw e.cause!!
|
throw e.cause!!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user