Skip to content

Instantly share code, notes, and snippets.

@cwebber314
Last active December 24, 2015 07:59
Show Gist options
  • Save cwebber314/6767491 to your computer and use it in GitHub Desktop.
Save cwebber314/6767491 to your computer and use it in GitHub Desktop.
/ -------------------------------------------------
// Setup run folders
// -------------------------------------------------
def getRunFoldersFromRootDir(): List[String] = {
val rootDir = new File(getSingleInput(Option("Path to the run folder root dir")))
require(rootDir.isDirectory(), rootDir + " was not a directory.")
rootDir.listFiles().toList.map(f => f.getAbsolutePath())
}
val runFolderList = project.getInputs().getRunfolder()
val runFolderPathList = getRunFoldersFromRootDir()
runFolderList.addAll(runFolderPathList.map(path => {
def lookForReport(p: String): String = {
val dir = new File(p)
require(dir.isDirectory(), dir + " was not a directory.")
// CW: If "report.xml" can not be found, then throw an exception.
val reportFile: File = dir.listFiles().find(report => report.getName() == "report.xml").getOrElse(throw new Error("Could not find report.xml in " + dir.getPath()))
reportFile.getAbsolutePath()
}
val runFolder = new Runfolder
runFolder.setReport(lookForReport(path))
runFolder
}))
@cwebber314
Copy link
Author

If "report.xml" can not be found, then the script throws an exception. report.xml should exist before this script is run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment