Merge pull request #14997 from rjernst/extra_config_input

Allow extra config for integ test to be anything project.file() accepts
This commit is contained in:
Ryan Ernst 2015-11-25 09:00:53 -08:00
commit 316a01ddd3
1 changed files with 12 additions and 9 deletions

View File

@ -184,17 +184,20 @@ class ClusterFormationTasks {
Copy copyConfig = project.tasks.create(name: name, type: Copy, dependsOn: setup) Copy copyConfig = project.tasks.create(name: name, type: Copy, dependsOn: setup)
copyConfig.into(new File(node.homeDir, 'config')) // copy must always have a general dest dir, even though we don't use it copyConfig.into(new File(node.homeDir, 'config')) // copy must always have a general dest dir, even though we don't use it
for (Map.Entry<String,Object> extraConfigFile : node.config.extraConfigFiles.entrySet()) { for (Map.Entry<String,Object> extraConfigFile : node.config.extraConfigFiles.entrySet()) {
File srcConfigFile = project.file(extraConfigFile.getValue()) Closure delayedSrc = {
if (srcConfigFile.isDirectory()) { File srcConfigFile = project.file(extraConfigFile.getValue())
throw new GradleException("Source for extraConfigFile must be a file: ${srcConfigFile}") if (srcConfigFile.isDirectory()) {
} throw new GradleException("Source for extraConfigFile must be a file: ${srcConfigFile}")
if (srcConfigFile.exists() == false) { }
throw new GradleException("Source file for extraConfigFile does not exist: ${srcConfigFile}") if (srcConfigFile.exists() == false) {
throw new GradleException("Source file for extraConfigFile does not exist: ${srcConfigFile}")
}
return srcConfigFile
} }
File destConfigFile = new File(node.homeDir, 'config/' + extraConfigFile.getKey()) File destConfigFile = new File(node.homeDir, 'config/' + extraConfigFile.getKey())
copyConfig.from(srcConfigFile) copyConfig.from(delayedSrc)
.into(destConfigFile.canonicalFile.parentFile) .into(destConfigFile.canonicalFile.parentFile)
.rename { destConfigFile.name } .rename { destConfigFile.name }
} }
return copyConfig return copyConfig
} }