Skip to content

Commit c514495

Browse files
jnizetwilkinsona
authored andcommitted
Refactor Gradle plugin tests to use runner's plugin classpath
Previously, each test build script used a property to configure its classpath. This commit simplifies the tests by setting the classpath once on the GradleRunner, thereby removing the need for it to be set in each test script. It also allows, and, in fact, requires, the use of the plugins block to apply the Boot plugin under test. Unfortunately, this doesn't work for the tests for the reaction to the Kotlin plugin. See the comments in the GradleBuild class and in each KotlingPluginActionIntegrationTests build script. See gh-14680
1 parent 7e3bee3 commit c514495

File tree

81 files changed

+281
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+281
-545
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/getting-started/typical-plugins.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
1+
plugins {
2+
id 'org.springframework.boot' version '{version}'
53
}
64

75
// tag::apply[]

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/integrating-with-actuator/build-info-additional.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '{version}'
54
}
65

7-
apply plugin: 'org.springframework.boot'
8-
apply plugin: 'java'
9-
106
// tag::additional[]
117
springBoot {
128
buildInfo {

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/integrating-with-actuator/build-info-basic.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '{version}'
54
}
65

7-
apply plugin: 'org.springframework.boot'
8-
apply plugin: 'java'
9-
106
// tag::build-info[]
117
springBoot {
128
buildInfo()

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/integrating-with-actuator/build-info-custom-values.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '{version}'
54
}
65

7-
apply plugin: 'org.springframework.boot'
8-
apply plugin: 'java'
9-
106
// tag::custom-values[]
117
springBoot {
128
buildInfo {

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/managing-dependencies/configure-bom.gradle

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
5-
}
6-
71
plugins {
82
id 'java'
3+
id 'org.springframework.boot' version '{version}'
94
}
105

116
apply plugin: 'io.spring.dependency-management'

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/managing-dependencies/custom-version.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
1+
plugins {
2+
id 'org.springframework.boot' version '{version}'
53
}
64

7-
apply plugin: 'org.springframework.boot'
85
apply plugin: 'io.spring.dependency-management'
96

107
dependencyManagement {

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/managing-dependencies/dependencies.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
5-
}
6-
71
plugins {
82
id 'java'
3+
id 'org.springframework.boot' version '{version}'
94
}
105

11-
apply plugin: 'org.springframework.boot'
126
apply plugin: 'io.spring.dependency-management'
137

148
// tag::dependencies[]
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
1+
plugins {
2+
id 'java'
3+
id 'application'
4+
id 'org.springframework.boot' version '{version}'
55
}
66

7-
apply plugin: 'org.springframework.boot'
8-
apply plugin: 'java'
9-
apply plugin: 'application'
10-
117
// tag::main-class[]
128
mainClassName = 'com.example.ExampleApplication'
139
// end::main-class[]

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-jar-and-jar.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '{version}'
54
}
65

7-
apply plugin: 'org.springframework.boot'
8-
apply plugin: 'java'
9-
106
// tag::enable-jar[]
117
jar {
128
enabled = true

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-jar-custom-launch-script.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
buildscript {
2-
dependencies {
3-
classpath files(pluginClasspath.split(','))
4-
}
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot' version '{version}'
54
}
65

7-
apply plugin: 'org.springframework.boot'
8-
apply plugin: 'java'
9-
106
bootJar {
117
mainClassName 'com.example.ExampleApplication'
128
}

0 commit comments

Comments
 (0)