#124 - Polishing.

Use ProjectAware where possible.
This commit is contained in:
Mark Paluch
2019-08-02 15:00:14 +02:00
parent 0f4e91c8bf
commit 69c7909fc9
4 changed files with 15 additions and 9 deletions

View File

@@ -20,6 +20,7 @@ import org.springframework.data.release.model.Module;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.Phase;
import org.springframework.data.release.model.Project;
import org.springframework.data.release.model.ProjectAware;
import org.springframework.plugin.core.Plugin;
/**
@@ -36,7 +37,7 @@ interface BuildSystem extends Plugin<Project> {
* @param iteration must not be {@literal null}.
* @param updateInformation must not be {@literal null}.
*/
ModuleIteration updateProjectDescriptors(ModuleIteration iteration, UpdateInformation updateInformation);
<M extends ProjectAware> M updateProjectDescriptors(M iteration, UpdateInformation updateInformation);
/**
* Prepares the project descriptor of the {@link ModuleIteration} for the given release {@link Phase}.
@@ -61,9 +62,9 @@ interface BuildSystem extends Plugin<Project> {
* @param module must not be {@literal null}.
* @return
*/
Module triggerDistributionBuild(Module module);
<M extends ProjectAware> M triggerDistributionBuild(M module);
ModuleIteration triggerBuild(ModuleIteration module);
<M extends ProjectAware> M triggerBuild(M module);
/**
* Triggers the pre-release checks for the given {@link ModuleIteration}.
@@ -71,5 +72,5 @@ interface BuildSystem extends Plugin<Project> {
* @param module must not be {@literal null}.
* @return
*/
ModuleIteration triggerPreReleaseCheck(ModuleIteration module);
<M extends ProjectAware> M triggerPreReleaseCheck(M module);
}

View File

@@ -37,10 +37,10 @@ import org.springframework.data.release.deployment.DeploymentProperties;
import org.springframework.data.release.deployment.DeploymentProperties.Gpg;
import org.springframework.data.release.io.Workspace;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.Module;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.Phase;
import org.springframework.data.release.model.Project;
import org.springframework.data.release.model.ProjectAware;
import org.springframework.data.release.model.TrainIteration;
import org.springframework.data.release.utils.Logger;
import org.springframework.stereotype.Component;
@@ -72,7 +72,7 @@ class MavenBuildSystem implements BuildSystem {
* @see org.springframework.data.release.build.BuildSystem#updateProjectDescriptors(org.springframework.data.release.model.ModuleIteration, org.springframework.data.release.model.TrainIteration, org.springframework.data.release.model.Phase)
*/
@Override
public ModuleIteration updateProjectDescriptors(ModuleIteration module, UpdateInformation information) {
public <M extends ProjectAware> M updateProjectDescriptors(M module, UpdateInformation information) {
PomUpdater updater = new PomUpdater(logger, information, module.getProject());
@@ -99,7 +99,7 @@ class MavenBuildSystem implements BuildSystem {
* @see org.springframework.data.release.build.BuildSystem#triggerDistributionBuild(org.springframework.data.release.model.Module)
*/
@Override
public Module triggerDistributionBuild(Module module) {
public <M extends ProjectAware> M triggerDistributionBuild(M module) {
Project project = module.getProject();
@@ -252,7 +252,7 @@ class MavenBuildSystem implements BuildSystem {
* @see org.springframework.data.release.build.BuildSystem#triggerBuild(org.springframework.data.release.model.ModuleIteration)
*/
@Override
public ModuleIteration triggerBuild(ModuleIteration module) {
public <M extends ProjectAware> M triggerBuild(M module) {
CommandLine arguments = CommandLine.of(Goal.CLEAN, Goal.INSTALL)//
.conditionalAnd(SKIP_TESTS, () -> module.getProject().skipTests());
@@ -266,7 +266,7 @@ class MavenBuildSystem implements BuildSystem {
* (non-Javadoc)
* @see org.springframework.data.release.build.BuildSystem#triggerPreReleaseCheck(org.springframework.data.release.model.ModuleIteration)
*/
public ModuleIteration triggerPreReleaseCheck(ModuleIteration module) {
public <M extends ProjectAware> M triggerPreReleaseCheck(M module) {
mvn.execute(module.getProject(), CommandLine.of(Goal.CLEAN, Goal.VALIDATE, profile("pre-release")));

View File

@@ -16,6 +16,8 @@
package org.springframework.data.release.model;
/**
* An object that is aware of a {@link Project}. Typically implemented by {@link Module} or {@link ModuleIteration}.
*
* @author Mark Paluch
*/
public interface ProjectAware {

View File

@@ -16,7 +16,10 @@
package org.springframework.data.release.model;
/**
* An object that is aware of a {@link Version}. Typically implemented by {@link Module} or {@link ModuleIteration}.
*
* @author Oliver Gierke
* @author Mark Paluch
*/
public interface VersionAware {