Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[JENKINS-15037] Added flag to consider stable reference builds only.
  • Loading branch information
uhafner committed Sep 24, 2012
1 parent 14eef1b commit 3839a1d61430a3d0d878d54d75b7e40e15d3de02
Showing 7 changed files with 22 additions and 44 deletions.
@@ -15,7 +15,6 @@
*
* @author Ulli Hafner
*/

public class CheckStyleAnnotationsAggregator extends AnnotationsAggregator {
/**
* Creates a new instance of {@link CheckStyleAnnotationsAggregator}.
@@ -30,15 +29,20 @@ public class CheckStyleAnnotationsAggregator 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 CheckStyleAnnotationsAggregator(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 CheckStyleResultAction(build, healthDescriptor, new CheckStyleResult(build, defaultEncoding, aggregatedResult));
return new CheckStyleResultAction(build, healthDescriptor,
new CheckStyleResult(build, defaultEncoding, aggregatedResult, useOnlyStableBuildsAsReference()));
}

@Override
@@ -29,7 +29,7 @@ public class CheckStyleMavenResult extends CheckStyleResult {
@SuppressWarnings("deprecation")
public CheckStyleMavenResult(final AbstractBuild<?, ?> build, final String defaultEncoding,
final ParserResult result) {
super(build, defaultEncoding, result, MavenCheckStyleResultAction.class);
super(build, defaultEncoding, result, false, MavenCheckStyleResultAction.class);
}

/** {@inheritDoc} */
@@ -73,7 +73,8 @@ public Class<? extends MavenResultAction<CheckStyleResult>> getIndividualActionT

@Override
protected CheckStyleResult createResult(@CheckForNull final CheckStyleResult existingResult, final CheckStyleResult additionalResult) {
return new CheckStyleReporterResult(getOwner(), additionalResult.getDefaultEncoding(), aggregate(existingResult, additionalResult));
return new CheckStyleReporterResult(getOwner(), additionalResult.getDefaultEncoding(),
aggregate(existingResult, additionalResult), existingResult.useOnlyStableBuildsAsReference());
}
}

@@ -157,6 +157,6 @@ public CheckStyleDescriptor getDescriptor() {
/** {@inheritDoc} */
public MatrixAggregator createAggregator(final MatrixBuild build, final Launcher launcher,
final BuildListener listener) {
return new CheckStyleAnnotationsAggregator(build, launcher, listener, this, getDefaultEncoding());
return new CheckStyleAnnotationsAggregator(build, launcher, listener, this, getDefaultEncoding(), useOnlyStableBuildsAsReference());
}
}
@@ -122,7 +122,7 @@ public ParserResult perform(final MavenBuildProxy build, final MavenProject pom,

@Override
protected CheckStyleResult createResult(final MavenBuild build, final ParserResult project) {
return new CheckStyleReporterResult(build, getDefaultEncoding(), project);
return new CheckStyleReporterResult(build, getDefaultEncoding(), project, getUseStableBuildAsReference());
}

@Override
@@ -22,9 +22,13 @@ public class CheckStyleReporterResult extends CheckStyleResult {
* 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 CheckStyleReporterResult(final AbstractBuild<?, ?> build, final String defaultEncoding, final ParserResult result) {
super(build, defaultEncoding, result, CheckStyleMavenResultAction.class);
public CheckStyleReporterResult(final AbstractBuild<?, ?> build, final String defaultEncoding, final ParserResult result,
final boolean useStableBuildAsReference) {
super(build, defaultEncoding, result, useStableBuildAsReference, CheckStyleMavenResultAction.class);
}

@Override
@@ -45,22 +45,9 @@ public CheckStyleResult(final AbstractBuild<?, ?> build, final String defaultEnc
* the default encoding to be used when reading and parsing files
* @param result
* the parsed result with all annotations
*/
@Deprecated
public CheckStyleResult(final AbstractBuild<?, ?> build, final String defaultEncoding, final ParserResult result) {
this(build, defaultEncoding, result, false, CheckStyleResultAction.class);
}

/**
* Creates a new instance of {@link CheckStyleResult}.
*
* @param build
* the current build as owner of this action
* @param defaultEncoding
* the default encoding to be used when reading and parsing files
* @param result
* the parsed result with all annotations
* @param useStableBuildAsReference FIXME
* @param useStableBuildAsReference
* determines whether only stable builds should be used as
* reference builds or not
* @param actionType
* the type of the result action
*/
@@ -69,24 +56,6 @@ protected CheckStyleResult(final AbstractBuild<?, ?> build, final String default
this(build, new BuildHistory(build, actionType, useStableBuildAsReference), result, defaultEncoding, true);
}

/**
* Creates a new instance of {@link CheckStyleResult}.
*
* @param build
* the current build as owner of this action
* @param defaultEncoding
* the default encoding to be used when reading and parsing files
* @param result
* the parsed result with all annotations
* @param actionType
* the type of the result action
*/
@Deprecated
protected CheckStyleResult(final AbstractBuild<?, ?> build, final String defaultEncoding, final ParserResult result,
final Class<? extends ResultAction<CheckStyleResult>> actionType) {
this(build, new BuildHistory(build, actionType, false), result, defaultEncoding, true);
}

CheckStyleResult(final AbstractBuild<?, ?> build, final BuildHistory history,
final ParserResult result, final String defaultEncoding, final boolean canSerialize) {
super(build, history, result, defaultEncoding);

0 comments on commit 3839a1d

Please sign in to comment.