This repository has been archived by the owner on Apr 6, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[JENKINS-4912] Created new action base class for maven aggregation.
- Loading branch information
Showing
4 changed files
with
83 additions
and
81 deletions.
There are no files selected for viewing
38 changes: 0 additions & 38 deletions
38
src/main/java/hudson/plugins/checkstyle/CheckStyleMavenResult.java
This file was deleted.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
src/main/java/hudson/plugins/checkstyle/CheckStyleMavenResultAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package hudson.plugins.checkstyle; | ||
|
||
import hudson.maven.MavenAggregatedReport; | ||
import hudson.maven.MavenBuild; | ||
import hudson.maven.MavenModule; | ||
import hudson.maven.MavenModuleSet; | ||
import hudson.maven.MavenModuleSetBuild; | ||
import hudson.model.Action; | ||
import hudson.plugins.analysis.core.HealthDescriptor; | ||
import hudson.plugins.analysis.core.MavenResultAction; | ||
import hudson.plugins.analysis.core.ParserResult; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* A {@link CheckStyleResultAction} for native Maven jobs. This action | ||
* additionally provides result aggregation for sub-modules and for the main | ||
* project. | ||
* | ||
* @author Ulli Hafner | ||
*/ | ||
public class CheckStyleMavenResultAction extends MavenResultAction<CheckStyleResult> { | ||
/** | ||
* Creates a new instance of {@link CheckStyleMavenResultAction}. This instance | ||
* will have no result set in the beginning. The result will be set | ||
* successively after each of the modules are build. | ||
* | ||
* @param owner | ||
* the associated build of this action | ||
* @param healthDescriptor | ||
* health descriptor to use | ||
* @param defaultEncoding | ||
* the default encoding to be used when reading and parsing files | ||
*/ | ||
public CheckStyleMavenResultAction(final MavenModuleSetBuild owner, final HealthDescriptor healthDescriptor, | ||
final String defaultEncoding) { | ||
super(new CheckStyleResultAction(owner, healthDescriptor), defaultEncoding); | ||
} | ||
|
||
/** | ||
* Creates a new instance of {@link CheckStyleMavenResultAction}. | ||
* | ||
* @param owner | ||
* the associated build of this action | ||
* @param healthDescriptor | ||
* health descriptor to use | ||
* @param defaultEncoding | ||
* the default encoding to be used when reading and parsing files | ||
* @param result | ||
* the result in this build | ||
*/ | ||
public CheckStyleMavenResultAction(final MavenBuild owner, final HealthDescriptor healthDescriptor, | ||
final String defaultEncoding, final CheckStyleResult result) { | ||
super(new CheckStyleResultAction(owner, healthDescriptor, result), defaultEncoding); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
public MavenAggregatedReport createAggregatedAction(final MavenModuleSetBuild build, final Map<MavenModule, List<MavenBuild>> moduleBuilds) { | ||
return new CheckStyleMavenResultAction(build, getHealthDescriptor(), getDisplayName()); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
public Action getProjectAction(final MavenModuleSet moduleSet) { | ||
return new CheckStyleProjectAction(moduleSet); | ||
} | ||
|
||
@Override | ||
public Class<? extends MavenResultAction<CheckStyleResult>> getIndividualActionType() { | ||
return CheckStyleMavenResultAction.class; | ||
} | ||
|
||
@Override | ||
protected CheckStyleResult createResult(final CheckStyleResult existingResult, final ParserResult aggregatedAnnotations) { | ||
return new CheckStyleResult(getOwner(), existingResult.getDefaultEncoding(), aggregatedAnnotations); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters