mirror of
https://github.com/corda/corda.git
synced 2025-01-19 03:06:36 +00:00
CORDA-728 fixed the issue with node runner on mac. Also did a tiny bit of readability refactoring.
CORDA-728 clinton's requested changes to move all property getters onto one line CORDA-728 fixed the issue with node runner on mac. Also did a tiny bit of readability refactoring. CORDA-728 clinton's requested changes to move all property getters onto one line CORDA-728 Tiny bit of readability refactoring, change of flow control around error occuring on TC, renaming of log file to work with Rick's TC change. CORDA-728 clinton's requested changes to move all property getters onto one line CORDA-728 clinton's requested changes to move all property getters onto one line CORDA-728 Fixing some simple compilation errors. CORDA-728 deparallelizing in attempt to fix capsule error
This commit is contained in:
parent
04d8260e0f
commit
59fe7a196b
@ -148,26 +148,22 @@ open class Cordform : DefaultTask() {
|
|||||||
installNodeInfos()
|
installNodeInfos()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun generateNodeInfos() {
|
private fun generateNodeInfos() {
|
||||||
project.logger.info("Generating node infos")
|
project.logger.info("Generating node infos")
|
||||||
val generateTimeoutSeconds = 60L
|
val generateTimeoutSeconds = 60L
|
||||||
val processes = nodes.map { node ->
|
val processes = nodes.map { node ->
|
||||||
project.logger.info("Generating node info for ${fullNodePath(node)}")
|
project.logger.info("Generating node info for ${fullNodePath(node)}")
|
||||||
val logDir = File(fullNodePath(node).toFile(), "logs")
|
val logDir = File(fullNodePath(node).toFile(), "logs")
|
||||||
logDir.mkdirs() // Directory may not exist at this point
|
logDir.mkdirs()
|
||||||
Pair(node, ProcessBuilder("java", "-jar", Node.nodeJarName, "--just-generate-node-info")
|
Pair(node, buildNodeProcess(node, logDir))
|
||||||
.directory(fullNodePath(node).toFile())
|
|
||||||
.redirectErrorStream(true)
|
|
||||||
// InheritIO causes hangs on windows due the gradle buffer also not being flushed.
|
|
||||||
// Must redirect to output or logger (node log is still written, this is just startup banner)
|
|
||||||
.redirectOutput(File(logDir, "generate-info-log.txt"))
|
|
||||||
.start())
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
processes.parallelStream().forEach { (node, process) ->
|
processes.forEach { (node, process) ->
|
||||||
if (!process.waitFor(generateTimeoutSeconds, TimeUnit.SECONDS)) {
|
if (!process.waitFor(generateTimeoutSeconds, TimeUnit.SECONDS)) {
|
||||||
throw GradleException("Node took longer $generateTimeoutSeconds seconds than too to generate node info - see node log at ${fullNodePath(node)}/logs")
|
throw GradleException("Node took longer $generateTimeoutSeconds seconds than too to generate node info - see node log at ${fullNodePath(node)}/logs")
|
||||||
} else if (process.exitValue() != 0) {
|
}
|
||||||
|
if (process.exitValue() != 0) {
|
||||||
throw GradleException("Node exited with ${process.exitValue()} when generating node infos - see node log at ${fullNodePath(node)}/logs")
|
throw GradleException("Node exited with ${process.exitValue()} when generating node infos - see node log at ${fullNodePath(node)}/logs")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,6 +175,16 @@ open class Cordform : DefaultTask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun buildNodeProcess(node: Node, logDir: File): Process {
|
||||||
|
return ProcessBuilder("java", "-jar", Node.nodeJarName, "--just-generate-node-info")
|
||||||
|
.directory(fullNodePath(node).toFile())
|
||||||
|
.redirectErrorStream(true)
|
||||||
|
// InheritIO causes hangs on windows due the gradle buffer also not being flushed.
|
||||||
|
// Must redirect to output or logger (node log is still written, this is just startup banner)
|
||||||
|
.redirectOutput(File(logDir, "generate-info.log"))
|
||||||
|
.start()
|
||||||
|
}
|
||||||
|
|
||||||
private fun installNodeInfos() {
|
private fun installNodeInfos() {
|
||||||
project.logger.info("Installing node infos")
|
project.logger.info("Installing node infos")
|
||||||
for (source in nodes) {
|
for (source in nodes) {
|
||||||
|
@ -18,10 +18,12 @@ class Cordformation : Plugin<Project> {
|
|||||||
* @return A file handle to the file in the JAR.
|
* @return A file handle to the file in the JAR.
|
||||||
*/
|
*/
|
||||||
fun getPluginFile(project: Project, filePathInJar: String): File {
|
fun getPluginFile(project: Project, filePathInJar: String): File {
|
||||||
val archive: File? = project.rootProject.buildscript.configurations.single { it.name == "classpath" }.find {
|
val archive: File? = project.rootProject.buildscript.configurations
|
||||||
it.name.contains("cordformation")
|
.single { it.name == "classpath" }
|
||||||
}
|
.find { it.name.contains("cordformation") }
|
||||||
return project.rootProject.resources.text.fromArchiveEntry(archive, filePathInJar).asFile()
|
return project.rootProject.resources.text
|
||||||
|
.fromArchiveEntry(archive, filePathInJar)
|
||||||
|
.asFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
val executableFileMode = "0755".toInt(8)
|
val executableFileMode = "0755".toInt(8)
|
||||||
|
@ -128,7 +128,7 @@ class Node(private val project: Project) : CordformNode() {
|
|||||||
// Can't parse as an X500 name, use the full string
|
// Can't parse as an X500 name, use the full string
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
nodeDir = File(rootDir.toFile(), dirName.replace("\\s", ""))
|
nodeDir = File(rootDir.toFile(), dirName)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun configureProperties() {
|
private fun configureProperties() {
|
||||||
@ -201,7 +201,12 @@ class Node(private val project: Project) : CordformNode() {
|
|||||||
* Installs the configuration file to this node's directory and detokenises it.
|
* Installs the configuration file to this node's directory and detokenises it.
|
||||||
*/
|
*/
|
||||||
private fun installConfig() {
|
private fun installConfig() {
|
||||||
val options = ConfigRenderOptions.defaults().setOriginComments(false).setComments(false).setFormatted(false).setJson(false)
|
val options = ConfigRenderOptions
|
||||||
|
.defaults()
|
||||||
|
.setOriginComments(false)
|
||||||
|
.setComments(false)
|
||||||
|
.setFormatted(false)
|
||||||
|
.setJson(false)
|
||||||
val configFileText = config.root().render(options).split("\n").toList()
|
val configFileText = config.root().render(options).split("\n").toList()
|
||||||
|
|
||||||
// Need to write a temporary file first to use the project.copy, which resolves directories correctly.
|
// Need to write a temporary file first to use the project.copy, which resolves directories correctly.
|
||||||
|
@ -104,7 +104,7 @@ private class TerminalWindowJavaCommand(jarName: String, dir: File, debugPort: I
|
|||||||
delay 0.5
|
delay 0.5
|
||||||
tell app "System Events" to tell process "Terminal" to keystroke "t" using command down
|
tell app "System Events" to tell process "Terminal" to keystroke "t" using command down
|
||||||
delay 0.5
|
delay 0.5
|
||||||
do script "bash -c 'cd $dir; ${command.joinToString(" ")} && exit'" in selected tab of the front window
|
do script "bash -c 'cd \"$dir\" ; \"${command.joinToString("""\" \"""")}\" && exit'" in selected tab of the front window
|
||||||
end tell""")
|
end tell""")
|
||||||
}
|
}
|
||||||
OS.WINDOWS -> {
|
OS.WINDOWS -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user