#26 - Upgraded to Spring 4.3 and Spring Shell 1.2 RC1.

Removed @Autowired from constructors. Tweaked class setup with Lombok in a variety of places (using @FieldDefaults, @NonNull etc.).
This commit is contained in:
Oliver Gierke
2016-06-18 14:25:07 +02:00
parent 10e2e52bf0
commit 7cbb6606d3
17 changed files with 44 additions and 57 deletions

View File

@@ -15,6 +15,7 @@
<java.version>1.8</java.version>
<jar.mainclass>org.springframework.data.release.Application</jar.mainclass>
<spring-plugin.version>1.3.0.BUILD-SNAPSHOT</spring-plugin.version>
<spring.version>4.3.0.RELEASE</spring.version>
</properties>
<dependencies>
@@ -52,7 +53,7 @@
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell</artifactId>
<version>1.2.0.M1</version>
<version>1.2.0.RC1</version>
</dependency>
<dependency>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,12 +15,9 @@
*/
package org.springframework.data.release.announcement;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.CliComponent;
import org.springframework.data.release.TimedCommand;
import org.springframework.data.release.model.TrainIteration;
@@ -33,11 +30,10 @@ import org.springframework.shell.core.annotation.CliOption;
* @author Oliver Gierke
*/
@CliComponent
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
class AnnouncementCommands extends TimedCommand {
@NonNull AnnouncementOperations operations;
private final @NonNull AnnouncementOperations operations;
@CliCommand("announcement")
public void announce(@CliOption(key = "", mandatory = true) TrainIteration iteration) throws Exception {

View File

@@ -22,7 +22,7 @@ import lombok.experimental.FieldDefaults;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.CliComponent;
import org.springframework.data.release.TimedCommand;
import org.springframework.data.release.io.Workspace;
import org.springframework.data.release.utils.Logger;
@@ -31,8 +31,9 @@ import org.springframework.shell.core.annotation.CliCommand;
/**
* @author Oliver Gierke
*/
@CliComponent
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
class BuildCommands extends TimedCommand {
@NonNull BuildOperations build;

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.release.build;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.nio.file.Path;
@@ -22,7 +23,6 @@ import java.util.List;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.deployment.DeploymentInformation;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.Phase;
@@ -37,11 +37,11 @@ import org.springframework.util.Assert;
* @author Oliver Gierke
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
public class BuildOperations {
private final PluginRegistry<BuildSystem, Project> buildSystems;
private final MavenProperties properties;
private final @NonNull PluginRegistry<BuildSystem, Project> buildSystems;
private final @NonNull MavenProperties properties;
/**
* Updates all inter-project dependencies based on the given {@link TrainIteration} and release {@link Phase}.

View File

@@ -17,14 +17,15 @@ package org.springframework.data.release.build;
import static org.springframework.data.release.model.Projects.*;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.data.release.deployment.DefaultDeploymentInformation;
import org.springframework.data.release.deployment.DeploymentInformation;
@@ -49,16 +50,17 @@ import org.xmlbeam.io.XBFileIO;
*/
@Component
@Order(100)
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
class MavenBuildSystem implements BuildSystem {
private static final String POM_XML = "pom.xml";
static String POM_XML = "pom.xml";
private final Workspace workspace;
private final ProjectionFactory projectionFactory;
private final Logger logger;
private final MavenRuntime mvn;
private final DeploymentProperties properties;
Workspace workspace;
ProjectionFactory projectionFactory;
Logger logger;
MavenRuntime mvn;
DeploymentProperties properties;
/*
* (non-Javadoc)

View File

@@ -24,7 +24,6 @@ import lombok.experimental.FieldDefaults;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.CliComponent;
import org.springframework.data.release.TimedCommand;
import org.springframework.data.release.build.BuildOperations;
@@ -48,7 +47,7 @@ import org.springframework.util.Assert;
* @author Oliver Gierke
*/
@CliComponent
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
class ReleaseCommands extends TimedCommand {
@@ -61,7 +60,7 @@ class ReleaseCommands extends TimedCommand {
public String predictTrainAndIteration() throws Exception {
return git.getTags(COMMONS).getLatest().toArtifactVersion().//
map(this::getTrainNameForCommonsVersion).//
map(ReleaseCommands::getTrainNameForCommonsVersion).//
orElse(null);
}
@@ -164,7 +163,7 @@ class ReleaseCommands extends TimedCommand {
build.distributeResources(iteration);
}
String getTrainNameForCommonsVersion(ArtifactVersion version) {
private static String getTrainNameForCommonsVersion(ArtifactVersion version) {
return ReleaseTrains.TRAINS.stream().//
filter(train -> version.toString().startsWith(train.getModule(COMMONS).getVersion().toString())).//

View File

@@ -18,7 +18,6 @@ package org.springframework.data.release.deployment;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.CliComponent;
import org.springframework.data.release.TimedCommand;
import org.springframework.shell.core.annotation.CliCommand;
@@ -29,7 +28,7 @@ import org.springframework.shell.core.annotation.CliCommand;
* @author Oliver Gierke
*/
@CliComponent
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
class ArtifactoryCommands extends TimedCommand {
private final @NonNull DeploymentOperations deployment;

View File

@@ -17,7 +17,6 @@ package org.springframework.data.release.deployment;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
@@ -27,7 +26,7 @@ import org.springframework.util.Assert;
* @author Oliver Gierke
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
public class DeploymentOperations {
private final ArtifactoryClient client;

View File

@@ -15,14 +15,12 @@
*/
package org.springframework.data.release.git;
import lombok.EqualsAndHashCode;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import lombok.EqualsAndHashCode;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.util.Assert;
/**

View File

@@ -15,17 +15,14 @@
*/
package org.springframework.data.release.git;
import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.CliComponent;
import org.springframework.data.release.TimedCommand;
import org.springframework.data.release.issues.Ticket;
@@ -43,11 +40,10 @@ import org.springframework.util.StringUtils;
* @author Oliver Gierke
*/
@CliComponent
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
@RequiredArgsConstructor
class GitCommands extends TimedCommand {
@NonNull GitOperations git;
private final @NonNull GitOperations git;
@CliCommand("git co train")
public void checkout(@CliOption(key = "", mandatory = true) Train train) throws Exception {

View File

@@ -41,7 +41,6 @@ import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.TagOpt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.io.Workspace;
import org.springframework.data.release.issues.IssueTracker;
import org.springframework.data.release.issues.Ticket;
@@ -62,7 +61,7 @@ import org.springframework.util.Assert;
* @author Oliver Gierke
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
public class GitOperations {

View File

@@ -17,11 +17,13 @@ package org.springframework.data.release.io;
import static org.springframework.data.release.utils.StreamUtils.*;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -34,7 +36,6 @@ import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.data.release.model.Project;
@@ -47,13 +48,13 @@ import org.springframework.util.Assert;
* @author Oliver Gierke
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
public class Workspace {
private static final Charset UTF_8 = Charset.forName("UTF-8");
private static final Charset UTF_8 = StandardCharsets.UTF_8;
private final IoProperties ioProperties;
private final ResourcePatternResolver resolver;
private final @NonNull IoProperties ioProperties;
private final @NonNull ResourcePatternResolver resolver;
/**
* Returns the current working directory.

View File

@@ -22,7 +22,6 @@ import lombok.experimental.FieldDefaults;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.TimedCommand;
import org.springframework.data.release.utils.Logger;
import org.springframework.shell.core.annotation.CliCommand;
@@ -30,8 +29,8 @@ import org.springframework.shell.core.annotation.CliCommand;
/**
* @author Oliver Gierke
*/
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
class WorkspaceCommands extends TimedCommand {
@NonNull Workspace workspace;

View File

@@ -25,7 +25,6 @@ import lombok.experimental.FieldDefaults;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.CliComponent;
import org.springframework.data.release.TimedCommand;
import org.springframework.data.release.model.ModuleIteration;
@@ -42,8 +41,8 @@ import org.springframework.util.StringUtils;
* @author Mark Paluch
*/
@CliComponent
@RequiredArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
class IssueTrackerCommands extends TimedCommand {
@NonNull PluginRegistry<IssueTracker, Project> tracker;

View File

@@ -22,7 +22,6 @@ import lombok.RequiredArgsConstructor;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.data.release.git.GitProperties;
import org.springframework.data.release.utils.HttpBasicCredentials;
@@ -35,7 +34,7 @@ import org.springframework.util.Assert;
@Data
@Component
@ConfigurationProperties(prefix = "github")
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
public class GitHubProperties {
private final @Getter(AccessLevel.NONE) GitProperties gitProperties;

View File

@@ -21,7 +21,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.git.GitOperations;
import org.springframework.data.release.io.Workspace;
import org.springframework.data.release.issues.Changelog;
@@ -40,7 +39,7 @@ import org.springframework.util.Assert;
* @author Oliver Gierke
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
@RequiredArgsConstructor
public class ReleaseOperations {
private static final Set<String> CHANGELOG_LOCATIONS;

View File

@@ -20,8 +20,8 @@ import lombok.Value;
@Value
public class SimpleIterationVersion implements IterationVersion {
private final Version version;
private final Iteration iteration;
Version version;
Iteration iteration;
/*
* (non-Javadoc)