Format source code

This commit is contained in:
Phillip Webb 2014-07-02 15:16:35 -07:00
parent fa88c481a5
commit 8054426803
11 changed files with 38 additions and 27 deletions

View File

@ -30,7 +30,8 @@ import org.springframework.context.annotation.ImportResource;
public class SampleParentContextApplication {
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(Parent.class).child(SampleParentContextApplication.class).run(args);
new SpringApplicationBuilder(Parent.class).child(
SampleParentContextApplication.class).run(args);
}
@EnableAutoConfiguration

View File

@ -33,6 +33,7 @@ import org.springframework.util.StreamUtils;
import sample.parent.SampleParentContextApplication;
import sample.parent.producer.ProducerApplication;
import static org.junit.Assert.assertTrue;
/**

View File

@ -31,8 +31,8 @@ import org.springframework.boot.dependency.tools.ManagedDependencies;
import org.springframework.boot.dependency.tools.PropertiesFileDependencies;
/**
* Utility to provide access to {@link ManagedDependencies} with support for version
* file overrides.
* Utility to provide access to {@link ManagedDependencies} with support for version file
* overrides.
*
* @author Phillip Webb
*/

View File

@ -123,7 +123,8 @@ class ProjectLibraries implements Libraries {
LibraryCallback callback) throws IOException {
if (artifacts != null) {
for (ResolvedArtifact artifact : artifacts) {
callback.library(new Library(artifact.getFile(), scope, isUnpackRequired(artifact)));
callback.library(new Library(artifact.getFile(), scope,
isUnpackRequired(artifact)));
}
}
}

View File

@ -55,8 +55,9 @@ public class RepackagePluginFeatures implements PluginFeatures {
+ "archives so that they can be executed from the command "
+ "line using 'java -jar'");
task.setGroup(BasePlugin.BUILD_GROUP);
task.dependsOn(project.getConfigurations().getByName(
Dependency.ARCHIVES_CONFIGURATION).getAllArtifacts().getBuildDependencies());
task.dependsOn(project.getConfigurations()
.getByName(Dependency.ARCHIVES_CONFIGURATION).getAllArtifacts()
.getBuildDependencies());
registerOutput(project, task);
ensureTaskRunsOnAssembly(project, task);
}
@ -68,7 +69,7 @@ public class RepackagePluginFeatures implements PluginFeatures {
project.getTasks().withType(Jar.class,
new RegisterInputsOutputsAction(task));
Object withJar = task.getWithJarTask();
if (withJar!=null) {
if (withJar != null) {
task.dependsOn(withJar);
}
}
@ -83,8 +84,8 @@ public class RepackagePluginFeatures implements PluginFeatures {
* Register BootRepackage so that we can use task {@code foo(type: BootRepackage)}.
*/
private void registerRepackageTaskProperty(Project project) {
project.getExtensions().getExtraProperties().set("BootRepackage",
RepackageTask.class);
project.getExtensions().getExtraProperties()
.set("BootRepackage", RepackageTask.class);
}
/**
@ -135,6 +136,7 @@ public class RepackagePluginFeatures implements PluginFeatures {
private void addLibraryDependencies(final RepackageTask task) {
try {
task.getLibraries().doWithLibraries(new LibraryCallback() {
@Override
public void library(Library library) throws IOException {
task.getInputs().file(library.getFile());
}

View File

@ -97,7 +97,8 @@ public class RepackageTask extends DefaultTask {
}
if (this.customConfiguration != null) {
libraries.setCustomConfigurationName(this.customConfiguration);
} else if (extension.getCustomConfiguration() != null) {
}
else if (extension.getCustomConfiguration() != null) {
libraries.setCustomConfigurationName(extension.getCustomConfiguration());
}
return libraries;
@ -180,11 +181,13 @@ public class RepackageTask extends DefaultTask {
String mainClass = (String) getProject().property("mainClassName");
if (RepackageTask.this.mainClass != null) {
mainClass = RepackageTask.this.mainClass;
} else if (this.extension.getMainClass() != null) {
}
else if (this.extension.getMainClass() != null) {
mainClass = this.extension.getMainClass();
} else if (getProject().getTasks().getByName("run").hasProperty("main")) {
mainClass = (String) getProject().getTasks().getByName("run").property(
"main");
}
else if (getProject().getTasks().getByName("run").hasProperty("main")) {
mainClass = (String) getProject().getTasks().getByName("run")
.property("main");
}
getLogger().info("Setting mainClass: " + mainClass);
repackager.setMainClass(mainClass);
@ -205,7 +208,8 @@ public class RepackageTask extends DefaultTask {
long startTime = System.currentTimeMillis();
try {
return super.findMainMethod(source);
} finally {
}
finally {
long duration = System.currentTimeMillis() - startTime;
if (duration > FIND_WARNING_TIMEOUT) {
getLogger().warn(

View File

@ -38,8 +38,8 @@ public class BootRunTask extends JavaExec {
@Override
public void exec() {
SourceSet mainSourceSet = SourceSets.findMainSourceSet(getProject());
final File outputDir = (mainSourceSet == null ? null
: mainSourceSet.getOutput().getResourcesDir());
final File outputDir = (mainSourceSet == null ? null : mainSourceSet.getOutput()
.getResourcesDir());
final Set<File> resources = new LinkedHashSet<File>();
if (mainSourceSet != null) {
resources.addAll(mainSourceSet.getResources().getSrcDirs());

View File

@ -1,4 +1,3 @@
package org.springframework.boot.gradle.run;
import java.io.IOException;
@ -41,8 +40,8 @@ public class FindMainClassTask extends DefaultTask {
mainClass = bootExtension.getMainClass();
}
ApplicationPluginConvention application = (ApplicationPluginConvention) project.getConvention().getPlugins().get(
"application");
ApplicationPluginConvention application = (ApplicationPluginConvention) project
.getConvention().getPlugins().get("application");
// Try the Application extension setting
if (mainClass == null && application.getMainClassName() != null) {
mainClass = application.getMainClassName();
@ -61,9 +60,11 @@ public class FindMainClassTask extends DefaultTask {
"Looking for main in: "
+ mainSourceSet.getOutput().getClassesDir());
try {
mainClass = MainClassFinder.findSingleMainClass(mainSourceSet.getOutput().getClassesDir());
mainClass = MainClassFinder.findSingleMainClass(mainSourceSet
.getOutput().getClassesDir());
project.getLogger().info("Computed main class: " + mainClass);
} catch (IOException ex) {
}
catch (IOException ex) {
throw new IllegalStateException("Cannot find main class", ex);
}
}

View File

@ -48,7 +48,7 @@ public class RunPluginFeatures implements PluginFeatures {
project.getTasks().all(new Action<Task>() {
@Override
public void execute(Task task) {
if(task instanceof JavaExec || task instanceof CreateStartScripts) {
if (task instanceof JavaExec || task instanceof CreateStartScripts) {
task.dependsOn(FIND_MAIN_CLASS_TASK_NAME);
}
}

View File

@ -42,7 +42,7 @@ class SourceSets {
private static Iterable<SourceSet> getJavaSourceSets(Project project) {
JavaPluginConvention plugin = project.getConvention().getPlugin(
JavaPluginConvention.class);
if(plugin == null) {
if (plugin == null) {
return Collections.emptyList();
}
return plugin.getSourceSets();

View File

@ -53,8 +53,8 @@ public abstract class YamlProcessor {
/**
* A map of document matchers allowing callers to selectively use only some of the
* documents in a YAML resource. In YAML documents are separated by
* <code>---<code> lines, and each document is converted to properties before the match is made. E.g.
* documents in a YAML resource. In YAML documents are separated by <code>---</code>
* lines, and each document is converted to properties before the match is made. E.g.
*
* <pre class="code">
* environment: dev
@ -66,7 +66,8 @@ public abstract class YamlProcessor {
* name: My Cool App
* </pre>
*
* when mapped with <code>documentMatchers = YamlProcessor.mapMatcher({"environment": "prod"})</code>
* when mapped with
* <code>documentMatchers = YamlProcessor.mapMatcher({"environment": "prod"})</code>
* would end up as
*
* <pre class="code">