public static File getReportsDirectory(Settings settings, Project project) { File dir = getReportsDirectoryFromProperty(settings, project); if (dir == null) { dir = getReportsDirectoryFromPluginConfiguration(project); } if (dir == null) { dir = getReportsDirectoryFromDefaultConfiguration(project); } return dir; }
@Override public void analyse(Project project, SensorContext context) { File dir = SurefireUtils.getReportsDirectory(settings, fs, pathResolver); collect(context, dir); }
public static File getReportsDirectory(Settings settings, FileSystem fs, PathResolver pathResolver) { File dir = getReportsDirectoryFromProperty(settings, fs, pathResolver); if (dir == null) { dir = new File(fs.baseDir(), "target/surefire-reports"); } return dir; }
/** * Find the directories containing the surefire reports. * @param settings Analysis settings. * @param fs FileSystem containing indexed files. * @param pathResolver Path solver. * @return The directories containing the surefire reports or default one (target/surefire-reports) if not found (not configured or not found). */ public static List<File> getReportsDirectories(Configuration settings, FileSystem fs, PathResolver pathResolver) { File dir = getReportsDirectoryFromDeprecatedProperty(settings, fs, pathResolver); List<File> dirs = getReportsDirectoriesFromProperty(settings, fs, pathResolver); if (dirs != null) { if (dir != null) { // both properties are set, deprecated property ignored LOGGER.debug("Property '{}' is deprecated and will be ignored, as property '{}' is also set.", SUREFIRE_REPORTS_PATH_PROPERTY, SUREFIRE_REPORT_PATHS_PROPERTY); } return dirs; } if (dir != null) { LOGGER.info("Property '{}' is deprecated. Use property '{}' instead.", SUREFIRE_REPORTS_PATH_PROPERTY, SUREFIRE_REPORT_PATHS_PROPERTY); return Collections.singletonList(dir); } // both properties are not set return Collections.singletonList(new File(fs.baseDir(), "target/surefire-reports")); }
@CheckForNull private static List<File> getReportsDirectoriesFromProperty(Configuration settings, FileSystem fs, PathResolver pathResolver) { if(settings.hasKey(SUREFIRE_REPORT_PATHS_PROPERTY)) { return Arrays.stream(settings.getStringArray(SUREFIRE_REPORT_PATHS_PROPERTY)) .map(String::trim) .map(path -> getFileFromPath(fs, pathResolver, path)) .filter(Objects::nonNull) .collect(Collectors.toList()); } return null; }
@Override public void execute(SensorContext context) { List<File> dirs = SurefireUtils.getReportsDirectories(settings, fs, pathResolver); collect(context, dirs); }
@Override public void analyse(Project project, SensorContext context) { File dir = SurefireUtils.getReportsDirectory(settings, project); collect(project, context, dir); }
/** * Find the directories containing the surefire reports. * @param settings Analysis settings. * @param fs FileSystem containing indexed files. * @param pathResolver Path solver. * @return The directories containing the surefire reports or default one (target/surefire-reports) if not found (not configured or not found). */ public static List<File> getReportsDirectories(Configuration settings, FileSystem fs, PathResolver pathResolver) { File dir = getReportsDirectoryFromDeprecatedProperty(settings, fs, pathResolver); List<File> dirs = getReportsDirectoriesFromProperty(settings, fs, pathResolver); if (dirs != null) { if (dir != null) { // both properties are set, deprecated property ignored LOGGER.debug("Property '{}' is deprecated and will be ignored, as property '{}' is also set.", SUREFIRE_REPORTS_PATH_PROPERTY, SUREFIRE_REPORT_PATHS_PROPERTY); } return dirs; } if (dir != null) { LOGGER.info("Property '{}' is deprecated. Use property '{}' instead.", SUREFIRE_REPORTS_PATH_PROPERTY, SUREFIRE_REPORT_PATHS_PROPERTY); return Collections.singletonList(dir); } // both properties are not set return Collections.singletonList(new File(fs.baseDir(), "target/surefire-reports")); }
@CheckForNull private static List<File> getReportsDirectoriesFromProperty(Configuration settings, FileSystem fs, PathResolver pathResolver) { if(settings.hasKey(SUREFIRE_REPORT_PATHS_PROPERTY)) { return Arrays.stream(settings.getStringArray(SUREFIRE_REPORT_PATHS_PROPERTY)) .map(String::trim) .map(path -> getFileFromPath(fs, pathResolver, path)) .filter(Objects::nonNull) .collect(Collectors.toList()); } return null; }
@Override public void execute(SensorContext context) { List<File> dirs = SurefireUtils.getReportsDirectories(settings, fs, pathResolver); collect(context, dirs); }
public static File getReportsDirectory(Project project) { File dir = getReportsDirectoryFromProperty(project); if (dir == null) { dir = getReportsDirectoryFromPluginConfiguration(project); } if (dir == null) { dir = getReportsDirectoryFromDefaultConfiguration(project); } return dir; }
public void analyse(Project project, SensorContext context) { File dir = SurefireUtils.getReportsDirectory(project); collect(project, context, dir); }
@CheckForNull private static File getReportsDirectoryFromDeprecatedProperty(Configuration settings, FileSystem fs, PathResolver pathResolver) { if(settings.hasKey(SUREFIRE_REPORTS_PATH_PROPERTY)) { String path = settings.get(SUREFIRE_REPORTS_PATH_PROPERTY).orElse(null); if (path != null) { return getFileFromPath(fs, pathResolver, path); } } return null; }
@CheckForNull private static File getReportsDirectoryFromDeprecatedProperty(Configuration settings, FileSystem fs, PathResolver pathResolver) { if(settings.hasKey(SUREFIRE_REPORTS_PATH_PROPERTY)) { String path = settings.get(SUREFIRE_REPORTS_PATH_PROPERTY).orElse(null); if (path != null) { return getFileFromPath(fs, pathResolver, path); } } return null; }