Skip to content

Commit

Permalink
Escape context.pipelineConfig property for tests (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-tchad authored May 10, 2024
1 parent b976bfc commit 51f1207
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 4 additions & 7 deletions SequenceAnalysis/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ dependencies {
if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null && project.hasProperty("teamcity"))
{
project.evaluationDependsOn(BuildUtils.getTestProjectPath(project.gradle))
def configDir = "${ServerDeployExtension.getServerDeployDirectory(project)}/config"
def configDir = new File(ServerDeployExtension.getServerDeployDirectory(project), "config")
def testProject = project.findProject(BuildUtils.getTestProjectPath(project.gradle))
def createPipelineConfigTask = project.tasks.register("createPipelineConfig", Copy) {
Copy task ->
Expand All @@ -197,13 +197,9 @@ if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null &
return newLine

})
task.destinationDir = new File(configDir)
task.destinationDir = configDir

if (BuildUtils.useEmbeddedTomcat(project)) {
task.doFirst {
new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties") << "\n${configDir}"
}

rootProject.allprojects {
task.mustRunAfter tasks.withType(DoThenSetup)
}
Expand All @@ -213,7 +209,8 @@ if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null &
dependsOn(createPipelineConfigTask)
if (BuildUtils.useEmbeddedTomcat(project)) {
it.doFirst {
new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties") << "\ncontext.pipelineConfig=${configDir}"
new File(new File(BuildUtils.getEmbeddedConfigPath(project)), "application.properties")
<< "\ncontext.pipelineConfig=${configDir.getAbsolutePath().replace("\\", "\\\\")}"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ private File setupConfigDir(File outDir) throws IOException

path = path.replaceAll("\\\\", "/");
line = line.replaceAll("@@SEQUENCEANALYSIS_TOOLS@@", path);
_log.info("Writing to pipelineConfig.xml: " + line);
}
else if (line.contains("@@WORK_DIR@@"))
{
line = line.replaceAll("@@WORK_DIR@@", outDir.getPath().replaceAll("\\\\", "/"));
_log.info("Writing to pipelineConfig.xml: " + line);
}

writer.println(line);
Expand Down Expand Up @@ -213,6 +215,8 @@ protected void executeJobRemote(File workDir, @Nullable File jobJson) throws IOE
ProcessBuilder pb = new ProcessBuilder(args);
pb.directory(workDir);

_log.info("Executing job in '" + pb.directory().getAbsolutePath() + "': " + String.join(" ", pb.command()));

Process proc;
try
{
Expand Down

0 comments on commit 51f1207

Please sign in to comment.