Last active
December 24, 2015 07:59
-
-
Save cwebber314/6767491 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ ------------------------------------------------- | |
// 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 | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If "report.xml" can not be found, then the script throws an exception. report.xml should exist before this script is run.