Browse Source

Merge branch '2.3.x'

Closes gh-22917
pull/22918/head
Andy Wilkinson 6 years ago
parent
commit
fff9193860
  1. 1
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle
  2. 6
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle
  3. 20
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle.kts
  4. 6
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle
  5. 17
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle.kts
  6. 16
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java

1
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle

@ -72,6 +72,7 @@ task dependencyVersions(type: org.springframework.boot.build.constraints.Extract @@ -72,6 +72,7 @@ task dependencyVersions(type: org.springframework.boot.build.constraints.Extract
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
dependsOn dependencyVersions
inputs.dir('src/docs/gradle').withPathSensitivity(PathSensitivity.RELATIVE)
doFirst {
attributes "dependency-management-plugin-version": dependencyVersions.versionConstraints["io.spring.gradle:dependency-management-plugin"]
}

6
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle

@ -15,3 +15,9 @@ bootBuildImage { @@ -15,3 +15,9 @@ bootBuildImage {
]
}
// end::env[]
task bootBuildImageEnvironment {
doFirst {
bootBuildImage.environment.each { name, value -> println "$name=$value" }
}
}

20
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env-proxy.gradle.kts

@ -1,19 +1,21 @@ @@ -1,19 +1,21 @@
import org.springframework.boot.gradle.tasks.bundling.BootJar
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
plugins {
java
id("org.springframework.boot") version "{gradle-project-version}"
}
tasks.getByName<BootJar>("bootJar") {
mainClassName = "com.example.ExampleApplication"
}
// tag::env[]
tasks.getByName<BootBuildImage>("bootBuildImage") {
environment = [
"HTTP_PROXY" : "http://proxy.example.com",
"HTTPS_PROXY" : "https://proxy.example.com"
]
environment = mapOf("HTTP_PROXY" to "http://proxy.example.com",
"HTTPS_PROXY" to "https://proxy.example.com")
}
// end::env[]
tasks.register("bootBuildImageEnvironment") {
doFirst {
for((name, value) in tasks.getByName<BootBuildImage>("bootBuildImage").environment) {
print(name + "=" + value)
}
}
}

6
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle

@ -12,3 +12,9 @@ bootBuildImage { @@ -12,3 +12,9 @@ bootBuildImage {
environment = ["BP_JVM_VERSION" : "13.0.1"]
}
// end::env[]
task bootBuildImageEnvironment {
doFirst {
bootBuildImage.environment.each { name, value -> println "$name=$value" }
}
}

17
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-env.gradle.kts

@ -1,16 +1,21 @@ @@ -1,16 +1,21 @@
import org.springframework.boot.gradle.tasks.bundling.BootJar
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
plugins {
java
id("org.springframework.boot") version "{gradle-project-version}"
}
tasks.getByName<BootJar>("bootJar") {
mainClassName = "com.example.ExampleApplication"
}
// tag::env[]
tasks.getByName<BootBuildImage>("bootBuildImage") {
environment = ["BP_JVM_VERSION" : "13.0.1"]
environment = mapOf("BP_JVM_VERSION" to "13.0.1")
}
// end::env[]
tasks.register("bootBuildImageEnvironment") {
doFirst {
for((name, value) in tasks.getByName<BootBuildImage>("bootBuildImage").environment) {
print(name + "=" + value)
}
}
}

16
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PackagingDocumentationTests.java

@ -28,6 +28,7 @@ import java.util.jar.JarOutputStream; @@ -28,6 +28,7 @@ import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import org.gradle.testkit.runner.BuildResult;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
@ -219,6 +220,21 @@ class PackagingDocumentationTests { @@ -219,6 +220,21 @@ class PackagingDocumentationTests {
}
}
@TestTemplate
void bootBuildImageWithCustomBuildpackJvmVersion() throws IOException {
BuildResult result = this.gradleBuild.script("src/docs/gradle/packaging/boot-build-image-env")
.build("bootBuildImageEnvironment");
assertThat(result.getOutput()).contains("BP_JVM_VERSION=13.0.1");
}
@TestTemplate
void bootBuildImageWithCustomProxySettings() throws IOException {
BuildResult result = this.gradleBuild.script("src/docs/gradle/packaging/boot-build-image-env-proxy")
.build("bootBuildImageEnvironment");
assertThat(result.getOutput()).contains("HTTP_PROXY=http://proxy.example.com")
.contains("HTTPS_PROXY=https://proxy.example.com");
}
protected void jarFile(File file) throws IOException {
try (JarOutputStream jar = new JarOutputStream(new FileOutputStream(file))) {
jar.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF"));

Loading…
Cancel
Save