Resources now correctly copied into nodes directory.

This commit is contained in:
Clinton Alexander 2016-10-07 10:41:31 +01:00
parent f56fea551d
commit 2f082d8cbe
5 changed files with 19 additions and 14 deletions

View File

@ -34,9 +34,8 @@ class Cordform extends DefaultTask {
} }
protected void installRunScript() { protected void installRunScript() {
project.delete("${directory}/runnodes")
project.copy { project.copy {
from "buildSrc/templates/runnodes" from Cordformation.getPluginFile(project, "com/r3corda/plugins/runnodes")
filter { String line -> line.replace("JAR_NAME", Node.JAR_NAME) } filter { String line -> line.replace("JAR_NAME", Node.JAR_NAME) }
filter(org.apache.tools.ant.filters.FixCrLfFilter.class, eol: org.apache.tools.ant.filters.FixCrLfFilter.CrLf.newInstance("lf")) filter(org.apache.tools.ant.filters.FixCrLfFilter.class, eol: org.apache.tools.ant.filters.FixCrLfFilter.CrLf.newInstance("lf"))
into "${directory}/" into "${directory}/"

View File

@ -2,9 +2,16 @@ package com.r3corda.plugins
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.resources.TextResource
class Cordformation implements Plugin<Project> { class Cordformation implements Plugin<Project> {
void apply(Project project) { void apply(Project project) {
} }
static def getPluginFile(Project project, String filePathInJar) {
return project.resources.text.fromArchiveEntry(project.buildscript.configurations.classpath.find {
it.name.contains('cordformation')
}, filePathInJar).asFile()
}
} }

View File

@ -116,18 +116,17 @@ class Node {
private void installConfig() { private void installConfig() {
project.copy { project.copy {
from ('./buildSrc/templates/nodetemplate.conf') { from Cordformation.getPluginFile(project, 'com/r3corda/plugins/nodetemplate.conf')
filter { it filter { it
.replaceAll('@@name@@', name) .replaceAll('@@name@@', name)
.replaceAll('@@dirName@@', dirName) .replaceAll('@@dirName@@', dirName)
.replaceAll('@@nearestCity@@', nearestCity) .replaceAll('@@nearestCity@@', nearestCity)
.replaceAll('@@isNotary@@', isNotary.toString()) .replaceAll('@@isNotary@@', isNotary.toString())
.replaceAll('@@isHttps@@', isHttps.toString()) .replaceAll('@@isHttps@@', isHttps.toString())
.replaceAll('@@advertisedServices@@', advertisedServices.join(",")) .replaceAll('@@advertisedServices@@', advertisedServices.join(","))
.replaceAll('@@networkMapAddress@@', networkMapAddress) .replaceAll('@@networkMapAddress@@', networkMapAddress)
.replaceAll('@@artemisPort@@', artemisPort.toString()) .replaceAll('@@artemisPort@@', artemisPort.toString())
.replaceAll('@@webPort@@', webPort.toString()) .replaceAll('@@webPort@@', webPort.toString())
}
} }
into nodeDir into nodeDir
rename 'nodetemplate.conf', 'node.conf' rename 'nodetemplate.conf', 'node.conf'