Skip to content

Commit

Permalink
allow to specify absolute paths for reports. to support msbuild runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Costa authored and Jorge Costa committed Nov 21, 2015
1 parent f585388 commit 82097da
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,27 @@ public static List<File> getReports(Settings conf,
List<File> reports = new ArrayList<File>();
if (reportPath != null && !reportPath.isEmpty()) {
reportPath = FilenameUtils.normalize(reportPath);

File singleFile = new File(reportPath);
if (singleFile.exists()) {
reports.add(singleFile);
} else {
CxxUtils.LOG.debug("Using pattern '{}' to find reports", reportPath);

String baseDirPath = baseDirPath1;

if (singleFile.isAbsolute()) {
String baseNormalize = FilenameUtils.normalize(baseDirPath);
CxxUtils.LOG.debug("Search string transformed from '{}'", reportPath);
reportPath = reportPath.replace(baseNormalize, "").substring(1);
CxxUtils.LOG.debug("To '{}' to find reports, using base Path '{}'", reportPath, baseNormalize);
}

DirectoryScanner scanner = new DirectoryScanner();
String[] includes = new String[1];
includes[0] = reportPath;
scanner.setIncludes(includes);
String baseDirPath = baseDirPath1;
scanner.setBasedir(new File(baseDirPath));
scanner.setIncludes(includes);

String[] relPaths = new String[0];
try {
scanner.scan();
Expand All @@ -185,8 +194,9 @@ public static List<File> getReports(Settings conf,
CxxUtils.LOG.error("Invalid report baseDir '{}'", baseDirPath);
}
}

for (String relPath : relPaths) {
CxxUtils.LOG.debug("Process report '{}'", relPath);
String path = CxxUtils.normalizePath(new File(baseDirPath, relPath).getAbsolutePath());
try {
File reportFile = new File(path);
Expand Down

0 comments on commit 82097da

Please sign in to comment.