Commit b146e76b authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '1.1.x'

parents 9c339740 06ffd9dd
...@@ -30,6 +30,16 @@ import org.springframework.util.FileSystemUtils; ...@@ -30,6 +30,16 @@ import org.springframework.util.FileSystemUtils;
*/ */
public class ProjectCreator { public class ProjectCreator {
private String gradleVersion;
public ProjectCreator() {
this("1.12");
}
public ProjectCreator(String gradleVersion) {
this.gradleVersion = gradleVersion;
}
public ProjectConnection createProject(String name) throws IOException { public ProjectConnection createProject(String name) throws IOException {
File projectDirectory = new File("target/" + name); File projectDirectory = new File("target/" + name);
projectDirectory.mkdirs(); projectDirectory.mkdirs();
...@@ -46,7 +56,7 @@ public class ProjectCreator { ...@@ -46,7 +56,7 @@ public class ProjectCreator {
} }
GradleConnector gradleConnector = GradleConnector.newConnector(); GradleConnector gradleConnector = GradleConnector.newConnector();
gradleConnector.useGradleVersion("1.12"); gradleConnector.useGradleVersion(this.gradleVersion);
((DefaultGradleConnector) gradleConnector).embedded(true); ((DefaultGradleConnector) gradleConnector).embedded(true);
return gradleConnector.forProjectDirectory(projectDirectory).connect(); return gradleConnector.forProjectDirectory(projectDirectory).connect();
......
...@@ -60,6 +60,21 @@ public class SpringLoadedTests { ...@@ -60,6 +60,21 @@ public class SpringLoadedTests {
"-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar", output); "-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar", output);
} }
@Test
public void springLoadedCanBeUsedWithGradle16() throws IOException {
ProjectConnection project = new ProjectCreator("1.6")
.createProject("spring-loaded-old-gradle");
project.newBuild()
.forTasks("bootRun")
.withArguments("-PbootVersion=" + BOOT_VERSION,
"-PspringLoadedVersion=" + SPRING_LOADED_VERSION, "--stacktrace")
.run();
List<String> output = getOutput();
assertOutputMatches(
"-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar", output);
}
private List<String> getOutput() throws IOException { private List<String> getOutput() throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(new File( BufferedReader reader = new BufferedReader(new FileReader(new File(
"target/spring-loaded-jvm-args/build/output.txt"))); "target/spring-loaded-jvm-args/build/output.txt")));
......
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}")
classpath("org.springframework:springloaded:${project.springLoadedVersion}")
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile("org.springframework.boot:spring-boot-starter")
}
jar {
baseName = 'spring-loaded-old-gradle'
}
\ No newline at end of file
package test;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.lang.management.ManagementFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.Assert;
public class Application {
public static void main(String[] args) throws Exception {
PrintWriter writer = new PrintWriter(new FileWriter(new File("build/output.txt")));
for (String argument: ManagementFactory.getRuntimeMXBean().getInputArguments()) {
writer.println(argument);
}
writer.close();
}
}
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.springframework.boot.gradle.run; package org.springframework.boot.gradle.run;
import java.util.Collections;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import org.gradle.api.Action; import org.gradle.api.Action;
...@@ -74,9 +75,14 @@ public class RunPluginFeatures implements PluginFeatures { ...@@ -74,9 +75,14 @@ public class RunPluginFeatures implements PluginFeatures {
run.getConventionMapping().map("jvmArgs", new Callable<Object>() { run.getConventionMapping().map("jvmArgs", new Callable<Object>() {
@Override @Override
public Object call() throws Exception { public Object call() throws Exception {
return project.property("applicationDefaultJvmArgs"); if (project.hasProperty("applicationDefaultJvmArgs")) {
return project.property("applicationDefaultJvmArgs");
}
else {
return Collections.emptyList();
}
} }
}); });
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment