mirror of
https://github.com/corda/corda.git
synced 2025-01-31 16:35:43 +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
|
||||
platformVersion=3
|
||||
guavaVersion=21.0
|
||||
|
@ -118,6 +118,7 @@ open class Baseform : DefaultTask() {
|
||||
"'directory' cannot be used when 'definitionClass' is specified. Use CordformDefinition.nodesDirectory instead."
|
||||
}
|
||||
directory = cd.nodesDirectory
|
||||
deleteRootDir()
|
||||
val cordapps = cd.getMatchingCordapps()
|
||||
cd.nodeConfigurers.forEach {
|
||||
val node = node { }
|
||||
@ -127,21 +128,26 @@ open class Baseform : DefaultTask() {
|
||||
}
|
||||
cd.setup { nodeName -> project.projectDir.toPath().resolve(getNodeByName(nodeName)!!.nodeDir.toPath()) }
|
||||
} else {
|
||||
deleteRootDir()
|
||||
nodes.forEach {
|
||||
it.rootDir(directory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteRootDir() {
|
||||
project.logger.info("Deleting $directory")
|
||||
project.delete(directory)
|
||||
}
|
||||
|
||||
protected fun bootstrapNetwork() {
|
||||
val networkBootstrapperClass = loadNetworkBootstrapperClass()
|
||||
val networkBootstrapper = networkBootstrapperClass.newInstance()
|
||||
val bootstrapMethod = networkBootstrapperClass.getMethod("bootstrap", Path::class.java, List::class.java).apply { isAccessible = true }
|
||||
// Call NetworkBootstrapper.bootstrap
|
||||
val allCordapps = nodes.flatMap { it.additionalCordapps + it.getCordappList() }.distinct().map { it.absolutePath }
|
||||
val rootDir = project.projectDir.toPath().resolve(directory).toAbsolutePath().normalize()
|
||||
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 rootDir = project.projectDir.toPath().resolve(directory).toAbsolutePath().normalize()
|
||||
// Call NetworkBootstrapper.bootstrap
|
||||
bootstrapMethod.invoke(networkBootstrapper, rootDir, allCordapps)
|
||||
} catch (e: InvocationTargetException) {
|
||||
throw e.cause!!
|
||||
|
Loading…
x
Reference in New Issue
Block a user