Merge branch '1.5.x'

This commit is contained in:
Phillip Webb
2016-10-11 23:42:14 -07:00
25 changed files with 130 additions and 118 deletions

View File

@@ -42,7 +42,6 @@ import org.springframework.boot.configurationsample.lombok.LombokInnerClassPrope
import org.springframework.boot.configurationsample.lombok.LombokSimpleDataProperties;
import org.springframework.boot.configurationsample.lombok.LombokSimpleProperties;
import org.springframework.boot.configurationsample.lombok.SimpleLombokPojo;
import org.springframework.boot.configurationsample.method.DeprecatedClassMethodConfig;
import org.springframework.boot.configurationsample.method.DeprecatedMethodConfig;
import org.springframework.boot.configurationsample.method.EmptyTypeMethodConfig;
import org.springframework.boot.configurationsample.method.InvalidMethodConfig;
@@ -290,8 +289,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
public void deprecatedMethodConfig() throws Exception {
Class<DeprecatedMethodConfig> type = DeprecatedMethodConfig.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata)
.has(Metadata.withGroup("foo").fromSource(type));
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type));
assertThat(metadata).has(Metadata.withProperty("foo.name", String.class)
.fromSource(DeprecatedMethodConfig.Foo.class)
.withDeprecation(null, null));
@@ -301,16 +299,18 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
@SuppressWarnings("deprecation")
public void deprecatedMethodConfigOnClass() throws Exception {
Class<DeprecatedClassMethodConfig> type = DeprecatedClassMethodConfig.class;
Class<?> type = org.springframework.boot.configurationsample.method.DeprecatedClassMethodConfig.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata)
.has(Metadata.withGroup("foo").fromSource(type));
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type));
assertThat(metadata).has(Metadata.withProperty("foo.name", String.class)
.fromSource(DeprecatedClassMethodConfig.Foo.class)
.fromSource(
org.springframework.boot.configurationsample.method.DeprecatedClassMethodConfig.Foo.class)
.withDeprecation(null, null));
assertThat(metadata).has(Metadata.withProperty("foo.flag", Boolean.class)
.fromSource(DeprecatedClassMethodConfig.Foo.class)
.fromSource(
org.springframework.boot.configurationsample.method.DeprecatedClassMethodConfig.Foo.class)
.withDeprecation(null, null));
}

View File

@@ -52,6 +52,7 @@ public class DeprecatedClassMethodConfig {
public void setFlag(boolean flag) {
this.flag = flag;
}
}
}

View File

@@ -51,8 +51,16 @@ public class RunProcess {
private volatile long endTime;
/**
* Creates new {@link RunProcess} instance for the specified command
* and working directory.
* Creates new {@link RunProcess} instance for the specified command.
* @param command the program to execute and it's arguments
*/
public RunProcess(String... command) {
this(null, command);
}
/**
* Creates new {@link RunProcess} instance for the specified working directory and
* command.
* @param workingDirectory the working directory of the child process or {@code null}
* to run in the working directory of the current Java process
* @param command the program to execute and it's arguments
@@ -62,14 +70,6 @@ public class RunProcess {
this.command = command;
}
/**
* Creates new {@link RunProcess} instance for the specified command.
* @param command the program to execute and it's arguments
*/
public RunProcess(String... command) {
this(null, command);
}
public int run(boolean waitForProcess, String... args) throws IOException {
return run(waitForProcess, Arrays.asList(args));
}

View File

@@ -149,8 +149,8 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
/**
* Flag to indicate if the run processes should be forked. {@code fork} is
* automatically enabled if an agent, jvmArguments or working directory are
* specified, or if devtools is present.
* automatically enabled if an agent, jvmArguments or working directory are specified,
* or if devtools is present.
* @since 1.2
*/
@Parameter(property = "fork")
@@ -206,7 +206,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
}
private boolean hasWorkingDirectorySet() {
return (this.workingDirectory != null);
return this.workingDirectory != null;
}
private void findAgent() {

View File

@@ -64,9 +64,11 @@ public class RunMojo extends AbstractRunMojo {
}
@Override
protected void runWithForkedJvm(File workingDirectory, List<String> args) throws MojoExecutionException {
protected void runWithForkedJvm(File workingDirectory, List<String> args)
throws MojoExecutionException {
try {
RunProcess runProcess = new RunProcess(workingDirectory, new JavaExecutable().toString());
RunProcess runProcess = new RunProcess(workingDirectory,
new JavaExecutable().toString());
Runtime.getRuntime()
.addShutdownHook(new Thread(new RunProcessKiller(runProcess)));
int exitCode = runProcess.run(true, args.toArray(new String[args.size()]));