Polish Gradle tasks for AOT processing

Closes gh-32946
This commit is contained in:
Andy Wilkinson
2022-11-01 16:17:21 +00:00
parent bd75965ff8
commit 519250cacf
8 changed files with 108 additions and 70 deletions

View File

@@ -95,12 +95,6 @@ class SpringBootAotPluginIntegrationTests {
assertThat(output).contains("org.jboss.logging" + File.separatorChar + "jboss-logging");
}
@TestTemplate
void processAotIsSkippedWhenProjectHasNoMainSource() {
assertThat(this.gradleBuild.build("processAot").task(":processAot").getOutcome())
.isEqualTo(TaskOutcome.NO_SOURCE);
}
@TestTemplate
void processAotRunsWhenProjectHasMainSource() throws IOException {
writeMainClass("org.springframework.boot", "SpringApplicationAotProcessor");

View File

@@ -4,12 +4,28 @@ plugins {
id 'java'
}
repositories {
mavenCentral()
maven { url 'file:repository' }
}
configurations.all {
resolutionStrategy {
eachDependency {
if (it.requested.group == 'org.springframework.boot') {
it.useVersion project.bootVersion
}
}
}
}
dependencies {
implementation project(":library")
}
task('processTestAotClasspath') {
dependsOn configurations.processTestAotClasspath
doFirst {
tasks.findByName('processTestAot').classpath.files.each { println it }
configurations.processTestAotClasspath.files.each { println it }
}
}

View File

@@ -6,6 +6,17 @@ plugins {
repositories {
mavenCentral()
maven { url 'file:repository' }
}
configurations.all {
resolutionStrategy {
eachDependency {
if (it.requested.group == 'org.springframework.boot') {
it.useVersion project.bootVersion
}
}
}
}
dependencies {
@@ -13,7 +24,8 @@ dependencies {
}
task('processTestAotClasspath') {
dependsOn configurations.processTestAotClasspath
doFirst {
tasks.findByName('processTestAot').classpath.files.each { println it }
configurations.processTestAotClasspath.files.each { println it }
}
}

View File

@@ -22,6 +22,11 @@
<artifactId>spring-boot-starter</artifactId>
<version>TEST-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.9.1</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>