From d1e7c9bd70970e0652c01ec3319e1e9f5f0bb014 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 14 Sep 2022 22:18:57 -0700 Subject: [PATCH] Introduce 'nativeTest' maven profile Update `spring-boot-start-parent` with a new `nativeTest` profile. When active, this profile will trigger AOT processing of test code and call the native build tools 'test' goal. Closes gh-32383 --- .../spring-boot-starter-parent/build.gradle | 62 ++++++++++++++----- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle b/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle index 1434d63c94..e8deba8ec9 100644 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle +++ b/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle @@ -135,9 +135,7 @@ publishing.publications.withType(MavenPublication) { plugin { delegate.groupId('org.graalvm.buildtools') delegate.artifactId('native-maven-plugin') - configuration { - delegate.extensions('true') - } + delegate.extensions('true') } plugin { delegate.groupId('io.github.git-commit-id') @@ -233,13 +231,6 @@ publishing.publications.withType(MavenPublication) { profiles { profile { delegate.id("native") - delegate.dependencies { - dependency { - delegate.groupId('org.junit.platform') - delegate.artifactId('junit-platform-launcher') - delegate.scope('test') - } - } build { plugins { plugin { @@ -252,12 +243,7 @@ publishing.publications.withType(MavenPublication) { delegate.goal('process-aot') } } - execution { - delegate.id('process-test-aot') - goals { - delegate.goal('process-test-aot') - } - } } + } } plugin { delegate.groupId('org.graalvm.buildtools') @@ -280,6 +266,50 @@ publishing.publications.withType(MavenPublication) { } } } + profile { + delegate.id("nativeTest") + delegate.dependencies { + dependency { + delegate.groupId('org.junit.platform') + delegate.artifactId('junit-platform-launcher') + delegate.scope('test') + } + } + build { + plugins { + plugin { + delegate.groupId('org.springframework.boot') + delegate.artifactId('spring-boot-maven-plugin') + executions { + execution { + delegate.id('process-test-aot') + goals { + delegate.goal('process-test-aot') + } + } + } + } + plugin { + delegate.groupId('org.graalvm.buildtools') + delegate.artifactId('native-maven-plugin') + configuration { + delegate.classesDirectory('${project.build.outputDirectory}') + metadataRepository { + delegate.enabled('true') + } + } + executions { + execution { + delegate.id('native-test') + goals { + delegate.goal('test') + } + } + } + } + } + } + } } } }