wasyl
03/31/2025, 10:23 AMgenerateXxxApolloSources
tasks created during configuration time. It happens when calling registerJavaGeneratingTask
, I think specifically in the outputDir.get()
part — the outputDir
is a provider based on outputDir
argument of DefaultDirectoryConnection
which in turn comes from sourcesBaseTaskProvider.flatMap { }
.
So in the end, the directory property is resolved which causes the task to be resolved/created, if I read that right? Or it's a misconfiguration on our end (because e.g. the variants shouldn't be resolved in the first place, or we may be doing something with Apollo tasks) or something else entirely?wasyl
03/31/2025, 10:25 AMwasyl
03/31/2025, 11:03 AMvariants.all { }
or equivalent somewhere, I just want to make sure that it's possible to not have these tasks created during configurationmbonnin
03/31/2025, 6:28 PMregisterJavaGeneratingTask()
because of https://issuetracker.google.com/u/1/issues/382215754
I have resisted a long time moving away from this because it’s so simple compared to the new way of doing things but looks like it’s time to finally make peace with this…mbonnin
03/31/2025, 6:29 PMwasyl
03/31/2025, 6:42 PMregisterJavaGeneratingTask
is somewhat lazy — at least the task passed is a provider, the issue is only with the output file. Which API is the new way, is it addGeneratedSourceDirectory
? I'll be honest I don't even know what the code that I linked to does 😄
> Out of curiosity, how bad is the eager task creation?
It's not bad, we have a handful of modules with Apollo so that's several tasks created. I was just going issue by issue looking to reduce configuration time (1k+ tasks created now) and I noticed Apollo.wasyl
03/31/2025, 6:45 PMextension.libraryVariants.configureEach
which I suppose should be lazy enough blob thinking fast
Also I didn't get to the bottom of where the outputDir
of the sourceBaseTaskProvider
is set in the first place, so thought that maybe the value is hardcoded anyway and could be passed as a File
. But I can't even read AGP sources enough to know it wouldn't break caching or something like thatmbonnin
03/31/2025, 7:34 PMWhich API is the new way, is itYup, exactly?addGeneratedSourceDirectory
mbonnin
03/31/2025, 7:37 PMSo theRight,is somewhat lazy — at least the task passed is a provider, the issue is only with the output file.registerJavaGeneratingTask
outputDir.get()
might be an issue still and I think we're always passing the same value there: https://github.com/apollographql/apollo-kotlin/blob/7668a302eb5c62ca1d3e423ccfefa1[…]tlin/com/apollographql/apollo/gradle/internal/BuildDirLayout.ktmbonnin
03/31/2025, 7:37 PMinternal fun outputDir(project: Project, service: Service): Provider<Directory> {
return project.layout.buildDirectory.dir(
"generated/source/apollo/${service.name}"
)
}
We might as well hardcode this, I think it would remove your issuembonnin
03/31/2025, 7:48 PMwasyl
04/01/2025, 10:16 AMwasyl
04/01/2025, 10:16 AMmbonnin
04/01/2025, 10:21 AM