mirror of
https://gitee.com/dcren/initializr.git
synced 2025-12-20 03:49:58 +08:00
Ensure Gradle tasks are configured lazily
At present, generated Gradle build scripts that use Groovy DSL configure tasks eagerly. This is both suboptimal and actually not aligned with the generated build scripts that use Kotlin DSL, which configures tasks lazily. This commit updates `GroovyDslGradleBuildWriter` to ensure tasks are configured lazily. See gh-1292
This commit is contained in:
committed by
Stephane Nicoll
parent
35e41a8f08
commit
27fc9d4067
@@ -129,7 +129,7 @@ class GradleProjectGenerationConfigurationTests {
|
||||
" testImplementation 'org.springframework.boot:spring-boot-starter-test'",
|
||||
"}",
|
||||
"",
|
||||
"test {",
|
||||
"tasks.named('test') {",
|
||||
" useJUnitPlatform()",
|
||||
"}"); // @formatter:on
|
||||
}
|
||||
@@ -150,7 +150,8 @@ class GradleProjectGenerationConfigurationTests {
|
||||
description.setPlatformVersion(Version.parse("2.2.4.RELEASE"));
|
||||
description.setLanguage(new JavaLanguage());
|
||||
ProjectStructure project = this.projectTester.generate(description);
|
||||
assertThat(project).textFile("build.gradle").lines().containsSequence("test {", " useJUnitPlatform()", "}");
|
||||
assertThat(project).textFile("build.gradle").lines().containsSequence("tasks.named('test') {",
|
||||
" useJUnitPlatform()", "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -25,6 +25,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ dependencyManagement {
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ dependencyManagement {
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ tasks.withType(KotlinCompile) {
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ tasks.withType(KotlinCompile) {
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ tasks.withType(KotlinCompile) {
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user