Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[JENKINS-15037]: Upgrade to new API in order to compute warnings only
for stable builds (if option is checked).
  • Loading branch information
uhafner committed Sep 28, 2012
1 parent 7bcc96f commit 019fe5126b9ee42fff7ffeae9d322eec2582e17e
Showing 5 changed files with 27 additions and 29 deletions.
@@ -29,16 +29,20 @@ public class AnalysisAnnotationsAggregator extends AnnotationsAggregator {
* health descriptor
* @param defaultEncoding
* the default encoding to be used when reading and parsing files
* @param useStableBuildAsReference
* determines whether only stable builds should be used as
* reference builds or not
*/
public AnalysisAnnotationsAggregator(final MatrixBuild build, final Launcher launcher,
final BuildListener listener, final HealthDescriptor healthDescriptor, final String defaultEncoding) {
super(build, launcher, listener, healthDescriptor, defaultEncoding);
final BuildListener listener, final HealthDescriptor healthDescriptor, final String defaultEncoding,
final boolean useStableBuildAsReference) {
super(build, launcher, listener, healthDescriptor, defaultEncoding, useStableBuildAsReference);
}

@Override
protected Action createAction(final HealthDescriptor healthDescriptor, final String defaultEncoding, final ParserResult aggregatedResult) {
return new AnalysisResultAction(build, healthDescriptor,
new AnalysisResult(build, defaultEncoding, aggregatedResult));
new AnalysisResult(build, defaultEncoding, aggregatedResult, useOnlyStableBuildsAsReference()));
}

@Override
@@ -112,6 +112,8 @@ public class AnalysisPublisher extends HealthAwarePublisher {
* determines whether to collect compiler warnings
* @param canRunOnFailed
* determines whether the plug-in can run for failed builds, too
* @param useStableBuildAsReference
* determines whether only stable builds should be used as reference builds or not
* @param canComputeNew
* determines whether new warnings should be computed (with
* respect to baseline)
@@ -128,13 +130,13 @@ public AnalysisPublisher(final String healthy, final String unHealthy, final Str
final boolean isCheckStyleActivated, final boolean isDryActivated,
final boolean isFindBugsActivated, final boolean isPmdActivated,
final boolean isOpenTasksActivated, final boolean isWarningsActivated,
final boolean canRunOnFailed, final boolean canComputeNew) {
final boolean canRunOnFailed, final boolean useStableBuildAsReference, final boolean canComputeNew) {
super(healthy, unHealthy, thresholdLimit, defaultEncoding, useDeltaValues,
unstableTotalAll, unstableTotalHigh, unstableTotalNormal, unstableTotalLow,
unstableNewAll, unstableNewHigh, unstableNewNormal, unstableNewLow,
failedTotalAll, failedTotalHigh, failedTotalNormal, failedTotalLow,
failedNewAll, failedNewHigh, failedNewNormal, failedNewLow,
canRunOnFailed, false, canComputeNew, "ANALYSIS-COLLECTOR");
canRunOnFailed, useStableBuildAsReference, false, canComputeNew, false, "ANALYSIS-COLLECTOR");
isDryDeactivated = !isDryActivated;
isFindBugsDeactivated = !isFindBugsActivated;
isPmdDeactivated = !isPmdActivated;
@@ -253,7 +255,7 @@ public BuildResult perform(final AbstractBuild<?, ?> build, final PluginLogger l
}
}

AnalysisResult result = new AnalysisResult(build, getDefaultEncoding(), overallResult);
AnalysisResult result = new AnalysisResult(build, getDefaultEncoding(), overallResult, useOnlyStableBuildsAsReference());
build.getActions().add(new AnalysisResultAction(build, this, result));

return result;
@@ -267,6 +269,6 @@ public AnalysisDescriptor getDescriptor() {
/** {@inheritDoc} */
public MatrixAggregator createAggregator(final MatrixBuild build, final Launcher launcher,
final BuildListener listener) {
return new AnalysisAnnotationsAggregator(build, launcher, listener, this, getDefaultEncoding());
return new AnalysisAnnotationsAggregator(build, launcher, listener, this, getDefaultEncoding(), useOnlyStableBuildsAsReference());
}
}
@@ -36,9 +36,13 @@ public class AnalysisResult extends BuildResult {
* the default encoding to be used when reading and parsing files
* @param result
* the parsed result with all annotations
* @param useStableBuildAsReference
* determines whether only stable builds should be used as
* reference builds or not
*/
public AnalysisResult(final AbstractBuild<?, ?> build, final String defaultEncoding, final ParserResult result) {
this(build, new BuildHistory(build, AnalysisResultAction.class), result, defaultEncoding, true);
public AnalysisResult(final AbstractBuild<?, ?> build, final String defaultEncoding, final ParserResult result,
final boolean useStableBuildAsReference) {
this(build, new BuildHistory(build, AnalysisResultAction.class, useStableBuildAsReference), result, defaultEncoding, true);
}

AnalysisResult(final AbstractBuild<?, ?> build, final BuildHistory history,
@@ -1,9 +1,9 @@
package hudson.plugins.analysis.collector;

import hudson.model.AbstractBuild;
import hudson.plugins.analysis.core.AbstractResultAction;
import hudson.plugins.analysis.core.HealthDescriptor;
import hudson.plugins.analysis.core.PluginDescriptor;
import hudson.plugins.analysis.core.AbstractResultAction;

/**
* Controls the live cycle of the analysis results. This action persists the
@@ -31,18 +31,6 @@ public AnalysisResultAction(final AbstractBuild<?, ?> owner, final HealthDescrip
super(owner, new AnalysisHealthDescriptor(healthDescriptor), result);
}

/**
* Creates a new instance of {@link AbstractResultAction}.
*
* @param owner
* the associated build of this action
* @param healthDescriptor
* health descriptor to use
*/
public AnalysisResultAction(final AbstractBuild<?, ?> owner, final HealthDescriptor healthDescriptor) {
super(owner, new AnalysisHealthDescriptor(healthDescriptor));
}

/** {@inheritDoc} */
public String getDisplayName() {
return Messages.Analysis_ProjectAction_Name();
@@ -1,12 +1,12 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:u="/util" xmlns:g="/graph">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:u="/util" xmlns:g="/graph">
<g:tools instance="${instance}" descriptor="${descriptor}" />
<f:advanced>
<u:failed/>
<u:health id="analysis"/>
<u:thresholds id="analysis"/>
<u:defaultEncoding id="analysis"/>
<u:trend id="analysis"/>
<u:failed />
<u:health id="analysis" />
<u:thresholds id="analysis" />
<u:defaultEncoding id="analysis" />
<u:trend id="analysis" />
</f:advanced>
</j:jelly>

1 comment on commit 019fe51

@buildhive
Copy link

@buildhive buildhive commented on 019fe51 Sep 28, 2012

Choose a reason for hiding this comment

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

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

Please sign in to comment.