jamesfredley commented on code in PR #16528:
URL: https://github.com/apache/grails-core/pull/16528#discussion_r4214779630
##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -1343,24 +1341,14 @@ ${importStatements}
def extraProperties =
project.extensions.getByType(ExtraPropertiesExtension)
def overriddenMainClass = propertyMainClassName ?:
springBootMainClassName
if (!overriddenMainClass) {
- // the findMainClass task needs to set these values
- extraProperties.set('mainClassName', project.provider {
- File cacheFile =
findMainClassTask.get().mainClassCacheFile.orNull?.asFile
- if (!cacheFile?.exists()) {
- return null
- }
-
- cacheFile?.text
- })
-
- springBootExtension.mainClass.set(project.provider {
- File cacheFile =
findMainClassTask.get().mainClassCacheFile.orNull?.asFile
- if (!cacheFile?.exists()) {
- return null
- }
-
- cacheFile?.text
- })
+ // the findMainClass task finds the value. A task-output
provider would fail anything reading it
+ // while the build is configured, and a project.provider
would keep the value the file held
+ // when the configuration cache entry was stored, so both
read it through a value source
+ Provider<String> foundMainClass =
project.providers.of(FoundMainClassValueSource) {
Review Comment:
Rechecked bf91fe0c. The main-class provider is obtained again at execution
time, and the shard manifest is printed from a task that still runs when a
cached configuration is reused.
##########
build-logic/plugins/src/test/groovy/org/apache/grails/buildsrc/TestTaskShardingPluginSpec.groovy:
##########
@@ -225,15 +265,15 @@ class TestTaskShardingPluginSpec extends Specification {
private BuildResult run(String... arguments) {
GradleRunner.create()
.withProjectDir(testProjectDir.toFile())
- .withArguments(arguments + ['--stacktrace'])
+ .withArguments(arguments + ['--stacktrace',
'--configuration-cache', '--configuration-cache-problems=fail'])
Review Comment:
Rechecked bf91fe0c. The main-class provider is obtained again at execution
time, and the shard manifest is printed from a task that still runs when a
cached configuration is reused.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]