Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[FIXED JENKINS-14024] Added option to allow disabling of time expensive
Browse files Browse the repository at this point in the history
operation that resolves relative paths by scanning the whole workspace.
  • Loading branch information
uhafner committed Jun 15, 2012
1 parent fd4ba2b commit 1e11938
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-core</artifactId>
<version>1.42</version>
<version>1.43-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
Expand Down
19 changes: 15 additions & 4 deletions src/main/java/hudson/plugins/warnings/WarningsPublisher.java
Expand Up @@ -113,6 +113,10 @@ public class WarningsPublisher extends HealthAwarePublisher {
* Ant file-set pattern of files to include in report
* @param excludePattern
* Ant file-set pattern of files to exclude from report
* @param canResolveRelativePaths
* determines whether relative paths in warnings should be
* resolved using a time expensive operation that scans the whole
* workspace for matching files.
*/
// CHECKSTYLE:OFF
@SuppressWarnings("PMD.ExcessiveParameterList")
Expand All @@ -124,14 +128,14 @@ public WarningsPublisher(final String healthy, final String unHealthy, final Str
final String failedTotalAll, final String failedTotalHigh, final String failedTotalNormal, final String failedTotalLow,
final String failedNewAll, final String failedNewHigh, final String failedNewNormal, final String failedNewLow,
final boolean canRunOnFailed, final boolean shouldDetectModules, final boolean canComputeNew,
final String includePattern, final String excludePattern,
final String includePattern, final String excludePattern, final boolean canResolveRelativePaths,
final List<ParserConfiguration> parserConfigurations, final List<ConsoleParser> consoleParsers) {
super(healthy, unHealthy, thresholdLimit, defaultEncoding, useDeltaValues,
unstableTotalAll, unstableTotalHigh, unstableTotalNormal, unstableTotalLow,
unstableNewAll, unstableNewHigh, unstableNewNormal, unstableNewLow,
failedTotalAll, failedTotalHigh, failedTotalNormal, failedTotalLow,
failedNewAll, failedNewHigh, failedNewNormal, failedNewLow,
canRunOnFailed, shouldDetectModules, canComputeNew, PLUGIN_NAME);
canRunOnFailed, shouldDetectModules, canComputeNew, canResolveRelativePaths, PLUGIN_NAME);
this.includePattern = StringUtils.stripToNull(includePattern);
this.excludePattern = StringUtils.stripToNull(excludePattern);
if (consoleParsers != null) {
Expand Down Expand Up @@ -290,7 +294,14 @@ private List<ParserResult> parseConsoleLog(final AbstractBuild<?, ?> build,
if (!build.getWorkspace().isRemote()) {
guessModuleNames(build, warnings);
}
ParserResult project = new ParserResult(build.getWorkspace());
ParserResult project;
if (canResolveRelativePaths()) {
project = new ParserResult(build.getWorkspace());
}
else {
project = new ParserResult();
}
project = new ParserResult(build.getWorkspace());
project.addAnnotations(warnings);
results.add(annotate(build, project, parserName));
}
Expand All @@ -316,7 +327,7 @@ private List<ParserResult> parseFiles(final AbstractBuild<?, ?> build, final Plu

FilesParser parser = new FilesParser(PLUGIN_NAME, filePattern,
new FileWarningsParser(ParserRegistry.getParsers(parserName), getDefaultEncoding(), getIncludePattern(), getExcludePattern()),
shouldDetectModules(), isMavenBuild(build));
shouldDetectModules(), isMavenBuild(build), canResolveRelativePaths());
ParserResult project = build.getWorkspace().act(parser);
logger.logLines(project.getLogMessages());

Expand Down
Expand Up @@ -26,6 +26,9 @@
<f:entry title="${%Detect modules}" description="${%description.detectModules}">
<f:checkbox name="shouldDetectModules" checked="${instance.shouldDetectModules}"/>
</f:entry>
<f:entry title="${%Resolve relative paths}" description="${%description.resolveRelativePaths}">
<f:checkbox name="canResolveRelativePaths" checked="${instance.canResolveRelativePaths}"/>
</f:entry>

<u:health id="warnings"/>
<u:thresholds id="warnings"/>
Expand Down
Expand Up @@ -17,4 +17,6 @@ description.excludePattern=Comma separated list of \
description.detectModules=Determines if Ant or Maven modules should be detected for all files that contain \
warnings. Activating this option may increase your build time since the detector scans the whole \
workspace for ''build.xml'' or ''pom.xml'' files in order to assign the correct module names.
description.resolveRelativePaths=Determines if relative paths in warnings should be resolved using a time expensive operation \
that scans the whole workspace for matching files. Deactivate this option if you encounter performance problems.
configure=You can define the default values for the trend graph in a separate view.
Expand Up @@ -22,3 +22,6 @@ description.detectModules=Bestimmt ob Dateien, die Warnungen enthalten, nach Pro
Da dazu der gesamte Arbeitsbereich nach ''build.xml'' oder ''pom.xml'' Dateien durchsucht wird, kann je \
nach Größe des Arbeitsbereichs die Dauer eines Builds erheblich erhöht werden.
Detect\ modules=Projekte automatisch erkennen
Resolve\ relative\ paths=Relative Pfade auflösen
description.resolveRelativePaths=Falls aktiviert, werden relative Pfade für betroffene Dateien durch absolute Pfade ersetzt. \
Diese Operation benötigt viel Zeit in großen Arbeitsbereichen und sollte daher bei Performanceproblemen deaktiviert werden.

1 comment on commit 1e11938

@buildhive
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jenkins » warnings-plugin #43 FAILURE
Looks like this commit caused a build failure
(what's this?)

Please sign in to comment.