Skip to content

Resolve extra classpath lazily when configuring Protobuf generation tasks #377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

andrewparmet
Copy link
Collaborator

@andrewparmet andrewparmet commented May 2, 2025

Fixes this warning:

Configuration 'protoktExtensions' was resolved during configuration time.
This is a build performance and scalability issue.
See https://github.com/gradle/gradle/issues/2298
Run with --info for a stacktrace.
Configuration 'testProtoktExtensions' was resolved during configuration time.
This is a build performance and scalability issue.
See https://github.com/gradle/gradle/issues/2298
Run with --info for a stacktrace.

Definitely open to less hacky approaches...

@andrewparmet andrewparmet changed the title Try resolving extra classpath lazily Resolving extra classpath lazily when configuring Protobuf generation tasks May 2, 2025
@andrewparmet andrewparmet marked this pull request as ready for review May 2, 2025 02:57
@andrewparmet andrewparmet requested a review from ogolberg May 2, 2025 02:57
@andrewparmet andrewparmet changed the title Resolving extra classpath lazily when configuring Protobuf generation tasks Resolve extra classpath lazily when configuring Protobuf generation tasks Jun 13, 2025
private fun extraClasspath(project: Project, task: GenerateProtoTask): String {
var extensions: FileCollection = project.configurations.getByName(EXTENSIONS)

if (task.isTest) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out this isn't reliable - extractIncludeJvmTestProto is considered main because it doesn't perfectly match p-g-p's criteria. I haven't looked how deeply that check failing affects our config.

extractIncludeProtoTasks().forEach { task ->
val isTest = task.isTestTask()
if ((!test && !isTest) || (test && isTest)) {
logger.log(DEBUG_LOG_LEVEL, "Adding input files to task ${task.name} from ${it.taskName}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.debug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This constant maps to debug right now, but I like to be able to change the value to make logs noisier at will. I can back out that pattern in a separate PR but don't want to right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants