Merge branch '1.2.x'

This commit is contained in:
Phillip Webb
2015-09-08 14:37:16 -07:00
94 changed files with 446 additions and 203 deletions

View File

@@ -38,7 +38,7 @@ import org.springframework.boot.cli.command.test.TestCommand;
*/
public class DefaultCommandFactory implements CommandFactory {
private static final List<Command> DEFAULT_COMMANDS = Arrays.<Command> asList(
private static final List<Command> DEFAULT_COMMANDS = Arrays.<Command>asList(
new VersionCommand(), new RunCommand(), new TestCommand(), new GrabCommand(),
new JarCommand(), new InstallCommand(), new UninstallCommand(),
new InitCommand());

View File

@@ -18,8 +18,6 @@ package org.springframework.boot.cli.command.grab;
import java.util.List;
import joptsimple.OptionSet;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.OptionParsingCommand;
import org.springframework.boot.cli.command.options.CompilerOptionHandler;
@@ -31,6 +29,8 @@ import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration;
import org.springframework.boot.cli.compiler.RepositoryConfigurationFactory;
import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration;
import joptsimple.OptionSet;
/**
* {@link Command} to grab the dependencies of one or more Groovy scripts
*

View File

@@ -22,9 +22,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.HelpExample;
import org.springframework.boot.cli.command.OptionParsingCommand;
@@ -33,6 +30,9 @@ import org.springframework.boot.cli.command.status.ExitStatus;
import org.springframework.boot.cli.util.Log;
import org.springframework.util.Assert;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
/**
* {@link Command} that initializes a project using Spring initializr.
*

View File

@@ -17,8 +17,6 @@ package org.springframework.boot.cli.command.install;
import java.util.List;
import joptsimple.OptionSet;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.OptionParsingCommand;
import org.springframework.boot.cli.command.options.CompilerOptionHandler;
@@ -26,6 +24,8 @@ import org.springframework.boot.cli.command.status.ExitStatus;
import org.springframework.boot.cli.util.Log;
import org.springframework.util.Assert;
import joptsimple.OptionSet;
/**
* {@link Command} to install additional dependencies into the CLI.
*

View File

@@ -23,8 +23,6 @@ import java.io.IOException;
import java.util.List;
import java.util.Properties;
import joptsimple.OptionSet;
import org.springframework.boot.cli.command.options.CompilerOptionHandler;
import org.springframework.boot.cli.command.options.OptionSetGroovyCompilerConfiguration;
import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration;
@@ -34,6 +32,8 @@ import org.springframework.boot.cli.util.Log;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.SystemPropertyUtils;
import joptsimple.OptionSet;
/**
* Shared logic for the {@link InstallCommand} and {@link UninstallCommand}.
*

View File

@@ -18,15 +18,15 @@ package org.springframework.boot.cli.command.install;
import java.util.List;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.OptionParsingCommand;
import org.springframework.boot.cli.command.options.CompilerOptionHandler;
import org.springframework.boot.cli.command.status.ExitStatus;
import org.springframework.boot.cli.util.Log;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
/**
* {@link Command} to uninstall dependencies from the CLI's lib directory
*

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.command.jar;
import groovy.lang.Grab;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -31,9 +29,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.jar.Manifest;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.codehaus.groovy.ast.ASTNode;
import org.codehaus.groovy.ast.AnnotatedNode;
import org.codehaus.groovy.ast.AnnotationNode;
@@ -65,6 +60,10 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.util.Assert;
import groovy.lang.Grab;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
/**
* {@link Command} to create a self-contained executable jar file from a CLI application
*

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.command.options;
import groovy.lang.Closure;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -31,6 +29,10 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.springframework.boot.cli.command.OptionParsingCommand;
import org.springframework.boot.cli.command.status.ExitStatus;
import groovy.lang.Closure;
import joptsimple.BuiltinHelpFormatter;
import joptsimple.HelpFormatter;
import joptsimple.OptionDescriptor;
@@ -38,9 +40,6 @@ import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpecBuilder;
import org.springframework.boot.cli.command.OptionParsingCommand;
import org.springframework.boot.cli.command.status.ExitStatus;
/**
* Delegate used by {@link OptionParsingCommand} to parse options and run the command.
*

View File

@@ -18,14 +18,14 @@ package org.springframework.boot.cli.command.options;
import java.util.List;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration;
import org.springframework.boot.cli.compiler.GroovyCompilerScope;
import org.springframework.boot.cli.compiler.RepositoryConfigurationFactory;
import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
/**
* Simple adapter class to present an {@link OptionSet} as a
* {@link GroovyCompilerConfiguration}

View File

@@ -20,11 +20,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import joptsimple.OptionSet;
import org.springframework.boot.cli.util.ResourceUtils;
import org.springframework.util.Assert;
import joptsimple.OptionSet;
/**
* Extract source file options (anything following '--' in an {@link OptionSet}).
*

View File

@@ -20,9 +20,6 @@ import java.io.File;
import java.util.List;
import java.util.logging.Level;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.OptionParsingCommand;
import org.springframework.boot.cli.command.options.CompilerOptionHandler;
@@ -33,6 +30,9 @@ import org.springframework.boot.cli.compiler.GroovyCompilerScope;
import org.springframework.boot.cli.compiler.RepositoryConfigurationFactory;
import org.springframework.boot.cli.compiler.grape.RepositoryConfiguration;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import static java.util.Arrays.asList;
/**

View File

@@ -16,11 +16,11 @@
package org.springframework.boot.cli.command.shell;
import jline.Terminal;
import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.AnsiRenderer.Code;
import jline.Terminal;
/**
* Simple utitliy class to build an ANSI string when supported by the {@link Terminal}.
*

View File

@@ -16,11 +16,11 @@
package org.springframework.boot.cli.command.shell;
import jline.console.ConsoleReader;
import org.springframework.boot.cli.command.AbstractCommand;
import org.springframework.boot.cli.command.status.ExitStatus;
import jline.console.ConsoleReader;
/**
* Clear the {@link Shell} screen.
*

View File

@@ -22,6 +22,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.options.OptionHelp;
import org.springframework.boot.cli.util.Log;
import jline.console.ConsoleReader;
import jline.console.completer.AggregateCompleter;
import jline.console.completer.ArgumentCompleter;
@@ -30,10 +34,6 @@ import jline.console.completer.Completer;
import jline.console.completer.FileNameCompleter;
import jline.console.completer.StringsCompleter;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.options.OptionHelp;
import org.springframework.boot.cli.util.Log;
/**
* JLine {@link Completer} for Spring Boot {@link Command}s.
*

View File

@@ -26,9 +26,6 @@ import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
import jline.console.ConsoleReader;
import jline.console.completer.CandidateListCompletionHandler;
import org.fusesource.jansi.AnsiRenderer.Code;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.CommandFactory;
@@ -38,6 +35,9 @@ import org.springframework.boot.cli.command.core.VersionCommand;
import org.springframework.boot.loader.tools.SignalUtils;
import org.springframework.util.StringUtils;
import jline.console.ConsoleReader;
import jline.console.completer.CandidateListCompletionHandler;
/**
* A shell for Spring Boot. Drops the user into an event loop (REPL) where command line
* completion and history are available without relying on OS shell features.

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.command.test;
import joptsimple.OptionSet;
import org.springframework.boot.cli.command.Command;
import org.springframework.boot.cli.command.OptionParsingCommand;
import org.springframework.boot.cli.command.options.CompilerOptionHandler;
@@ -25,6 +23,8 @@ import org.springframework.boot.cli.command.options.OptionSetGroovyCompilerConfi
import org.springframework.boot.cli.command.options.SourceOptions;
import org.springframework.boot.cli.command.status.ExitStatus;
import joptsimple.OptionSet;
/**
* {@link Command} to run a groovy test script or scripts.
*

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.compiler;
import groovy.lang.GroovyClassLoader;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.classgen.GeneratorContext;
import org.codehaus.groovy.control.CompilationFailedException;
@@ -25,6 +23,8 @@ import org.codehaus.groovy.control.CompilePhase;
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.control.customizers.ImportCustomizer;
import groovy.lang.GroovyClassLoader;
/**
* Strategy that can be used to apply some auto-configuration during the
* {@link CompilePhase#CONVERSION} Groovy compile phase.

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.compiler;
import groovy.lang.GroovyClassLoader;
import org.codehaus.groovy.ast.ASTNode;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.ModuleNode;
@@ -26,6 +24,8 @@ import org.codehaus.groovy.transform.ASTTransformation;
import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext;
import org.springframework.core.annotation.Order;
import groovy.lang.GroovyClassLoader;
/**
* {@link ASTTransformation} to apply
* {@link CompilerAutoConfiguration#applyDependencies(DependencyCustomizer) dependency

View File

@@ -16,9 +16,6 @@
package org.springframework.boot.cli.compiler;
import groovy.lang.Grab;
import groovy.lang.GroovyClassLoader;
import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.ast.ModuleNode;
@@ -26,6 +23,9 @@ import org.codehaus.groovy.ast.expr.ConstantExpression;
import org.springframework.boot.cli.compiler.dependencies.ArtifactCoordinatesResolver;
import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext;
import groovy.lang.Grab;
import groovy.lang.GroovyClassLoader;
/**
* Customizer that allows dependencies to be added during compilation. Adding a dependency
* results in a {@link Grab @Grab} annotation being added to the primary {@link ClassNode

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.compiler;
import groovy.lang.GroovyClassLoader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
@@ -40,6 +38,8 @@ import org.springframework.util.Assert;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
import groovy.lang.GroovyClassLoader;
/**
* Extension of the {@link GroovyClassLoader} with support for obtaining '.class' files as
* resources.

View File

@@ -16,10 +16,6 @@
package org.springframework.boot.cli.compiler;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyClassLoader.ClassCollector;
import groovy.lang.GroovyCodeSource;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
@@ -49,6 +45,10 @@ import org.springframework.boot.cli.compiler.grape.GrapeEngineInstaller;
import org.springframework.boot.cli.util.ResourceUtils;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyClassLoader.ClassCollector;
import groovy.lang.GroovyCodeSource;
/**
* Compiler for Groovy sources. Primarily a simple Facade for
* {@link GroovyClassLoader#parseClass(GroovyCodeSource)} with the following additional

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.compiler;
import groovy.lang.Grab;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
@@ -31,6 +29,8 @@ import org.codehaus.groovy.transform.ASTTransformation;
import org.springframework.boot.cli.compiler.grape.DependencyResolutionContext;
import org.springframework.core.annotation.Order;
import groovy.lang.Grab;
/**
* {@link ASTTransformation} to resolve {@link Grab} artifact coordinates.
*

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.compiler.autoconfigure;
import groovy.lang.GroovyClassLoader;
import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
@@ -29,6 +27,8 @@ import org.springframework.boot.cli.compiler.CompilerAutoConfiguration;
import org.springframework.boot.cli.compiler.DependencyCustomizer;
import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration;
import groovy.lang.GroovyClassLoader;
/**
* {@link CompilerAutoConfiguration} for Spring.
*

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.compiler.autoconfigure;
import groovy.lang.GroovyClassLoader;
import org.codehaus.groovy.ast.AnnotationNode;
import org.codehaus.groovy.ast.ClassHelper;
import org.codehaus.groovy.ast.ClassNode;
@@ -31,6 +29,8 @@ import org.springframework.boot.cli.compiler.CompilerAutoConfiguration;
import org.springframework.boot.cli.compiler.DependencyCustomizer;
import org.springframework.boot.cli.compiler.GroovyCompilerConfiguration;
import groovy.lang.GroovyClassLoader;
/**
* {@link CompilerAutoConfiguration} for Spring Test
*

View File

@@ -44,7 +44,7 @@ public final class Dependency {
* @param version the version
*/
public Dependency(String groupId, String artifactId, String version) {
this(groupId, artifactId, version, Collections.<Exclusion> emptyList());
this(groupId, artifactId, version, Collections.<Exclusion>emptyList());
}
/**

View File

@@ -16,9 +16,6 @@
package org.springframework.boot.cli.compiler.grape;
import groovy.grape.GrapeEngine;
import groovy.lang.GroovyClassLoader;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
@@ -43,6 +40,9 @@ import org.eclipse.aether.resolution.DependencyResult;
import org.eclipse.aether.util.artifact.JavaScopes;
import org.eclipse.aether.util.filter.DependencyFilterUtils;
import groovy.grape.GrapeEngine;
import groovy.lang.GroovyClassLoader;
/**
* A {@link GrapeEngine} implementation that uses <a
* href="http://eclipse.org/aether">Aether</a>, the dependency resolution system used by

View File

@@ -16,8 +16,6 @@
package org.springframework.boot.cli.compiler.grape;
import groovy.lang.GroovyClassLoader;
import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
@@ -36,6 +34,8 @@ import org.eclipse.aether.spi.locator.ServiceLocator;
import org.eclipse.aether.transport.file.FileTransporterFactory;
import org.eclipse.aether.transport.http.HttpTransporterFactory;
import groovy.lang.GroovyClassLoader;
/**
* Utility class to create a pre-configured {@link AetherGrapeEngine}.
*

View File

@@ -16,11 +16,11 @@
package org.springframework.boot.cli.compiler.grape;
import java.lang.reflect.Field;
import groovy.grape.Grape;
import groovy.grape.GrapeEngine;
import java.lang.reflect.Field;
/**
* Utility to install a specific {@link Grape} engine with Groovy.
*

View File

@@ -16,11 +16,6 @@
package org.springframework.boot.groovy;
import groovy.lang.Writable;
import groovy.text.GStringTemplateEngine;
import groovy.text.Template;
import groovy.text.TemplateEngine;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
@@ -30,6 +25,11 @@ import java.util.Map;
import org.codehaus.groovy.control.CompilationFailedException;
import groovy.lang.Writable;
import groovy.text.GStringTemplateEngine;
import groovy.text.Template;
import groovy.text.TemplateEngine;
/**
* Helpful utilties for working with Groovy {@link Template}s.
*
@@ -39,7 +39,7 @@ public abstract class GroovyTemplate {
public static String template(String name) throws IOException,
CompilationFailedException, ClassNotFoundException {
return template(name, Collections.<String, Object> emptyMap());
return template(name, Collections.<String, Object>emptyMap());
}
public static String template(String name, Map<String, ?> model) throws IOException,