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 b4bf044 commit e9fbcb2fc9769f9cde9f073be92c39525b64e635
Showing 9 changed files with 249 additions and 320 deletions.
@@ -280,7 +280,7 @@ protected BuildHistory createBuildHistory() {
return new NullBuildHistory();
}
else {
return new BuildHistory(lastFinishedBuild, resultActionType);
return new BuildHistory(lastFinishedBuild, resultActionType, false);
}
}

@@ -22,7 +22,13 @@ public abstract class AnnotationsAggregator extends MatrixAggregator {
private final ParserResult totals = new ParserResult();
private final HealthDescriptor healthDescriptor;
private final String defaultEncoding;

/**
* Determines whether only stable builds should be used as reference builds
* or not.
*
* @since 1.48
*/
private final boolean useStableBuildAsReference;
/**
* Creates a new instance of {@link AnnotationsAggregator}.
*
@@ -36,13 +42,17 @@ public abstract class AnnotationsAggregator extends MatrixAggregator {
* 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 AnnotationsAggregator(final MatrixBuild build, final Launcher launcher, final BuildListener listener,
final HealthDescriptor healthDescriptor, final String defaultEncoding) {
final HealthDescriptor healthDescriptor, final String defaultEncoding, final boolean useStableBuildAsReference) {
super(build, launcher, listener);

this.healthDescriptor = healthDescriptor;
this.defaultEncoding = defaultEncoding;
this.useStableBuildAsReference = useStableBuildAsReference;
}

@Override
@@ -75,6 +85,16 @@ protected boolean hasResult(final MatrixRun run) {
return false;
}

/**
* Determines whether only stable builds should be used as reference builds
* or not.
*
* @return <code>true</code> if only stable builds should be used
*/
public boolean useOnlyStableBuildsAsReference() {
return useStableBuildAsReference;
}

/**
* Returns the annotations of the specified run.
*
@@ -99,5 +119,26 @@ protected boolean hasResult(final MatrixRun run) {
*/
@SuppressWarnings("hiding")
protected abstract Action createAction(HealthDescriptor healthDescriptor, String defaultEncoding, ParserResult aggregatedResult);

/**
* Creates a new instance of {@link AnnotationsAggregator}.
*
* @param build
* the matrix build
* @param launcher
* the launcher
* @param listener
* the build listener
* @param healthDescriptor
* health descriptor
* @param defaultEncoding
* the default encoding to be used when reading and parsing files
* @deprecated use {@link #AnnotationsAggregator(MatrixBuild, Launcher, BuildListener, HealthDescriptor, String, boolean)}
*/
@Deprecated
public AnnotationsAggregator(final MatrixBuild build, final Launcher launcher, final BuildListener listener,
final HealthDescriptor healthDescriptor, final String defaultEncoding) {
this(build, launcher, listener, healthDescriptor, defaultEncoding, false);
}
}

@@ -26,7 +26,7 @@ public class BuildHistory {
private final AbstractBuild<?, ?> baseline;
/** Type of the action that contains the build results. */
private final Class<? extends ResultAction<? extends BuildResult>> type;
/** Determines whether only stable builds should be used as reference builds or not */
/** Determines whether only stable builds should be used as reference builds or not. */
private final boolean useStableBuildAsReference;

/**
@@ -49,16 +49,13 @@ public BuildHistory(final AbstractBuild<?, ?> baseline, final Class<? extends Re
}

/**
* Creates a new instance of {@link BuildHistory}.
* Determines whether only stable builds should be used as reference builds
* or not.
*
* @param baseline
* the build to start the history from
* @param type
* type of the action that contains the build results
* @return <code>true</code> if only stable builds should be used
*/
@Deprecated
public BuildHistory(final AbstractBuild<?, ?> baseline, final Class<? extends ResultAction<? extends BuildResult>> type) {
this(baseline, type, false);
public boolean useOnlyStableBuildsAsReference() {
return useStableBuildAsReference;
}

/**
@@ -285,5 +282,19 @@ public Collection<FileAnnotation> getFixedWarnings(final Set<FileAnnotation> ann
public AbstractHealthDescriptor getHealthDescriptor() {
return getBaseline().getHealthDescriptor();
}

/**
* Creates a new instance of {@link BuildHistory}.
*
* @param baseline
* the build to start the history from
* @param type
* type of the action that contains the build results
* @deprecated use {@link #BuildHistory(AbstractBuild, Class, boolean)}
*/
@Deprecated
public BuildHistory(final AbstractBuild<?, ?> baseline, final Class<? extends ResultAction<? extends BuildResult>> type) {
this(baseline, type, false);
}
}

@@ -223,7 +223,17 @@ protected BuildResult(final AbstractBuild<?, ?> build, final BuildHistory histor
* @return the history
*/
protected BuildHistory createHistory(final AbstractBuild<?, ?> build) {
return new BuildHistory(build, getResultActionType());
return new BuildHistory(build, getResultActionType(), false);
}

/**
* Determines whether only stable builds should be used as reference builds
* or not.
*
* @return <code>true</code> if only stable builds should be used
*/
public boolean useOnlyStableBuildsAsReference() {
return history.useOnlyStableBuildsAsReference();
}

/**

0 comments on commit e9fbcb2

Please sign in to comment.