Skip to content

Conversation

@kelvinou01
Copy link

Before this PR

We are trying to get our repositories to run classes and test with the Configuration Cache. Currently, BaselineModuleJvmArgs has these CC issues:

- [error] cannot serialize object of type `org.gradle.api.internal.project.DefaultProject`, a subtype of `org.gradle.api.Project`, as these are not supported with the configuration cache.
    - field `val$project` of `com.palantir.baseline.plugins.BaselineModuleJvmArgs$1`
        - bean of type `com.palantir.baseline.plugins.BaselineModuleJvmArgs$1`
            - field `action` of `org.gradle.api.internal.AbstractTask$TaskActionWrapper`
                - bean of type `org.gradle.api.internal.AbstractTask$TaskActionWrapper`
                    - field `actions` of `org.gradle.api.tasks.javadoc.Javadoc`
                        - task `:gradle-guide-error-prone:javadoc` of type `org.gradle.api.tasks.javadoc.Javadoc`
- [error] cannot serialize object of type `org.gradle.api.internal.tasks.DefaultSourceSet`, a subtype of `org.gradle.api.tasks.SourceSet`, as these are not supported with the configuration cache.
    - field `val$sourceSet` of `com.palantir.baseline.plugins.BaselineModuleJvmArgs$1`
        - bean of type `com.palantir.baseline.plugins.BaselineModuleJvmArgs$1`
            - field `action` of `org.gradle.api.internal.AbstractTask$TaskActionWrapper`
                - bean of type `org.gradle.api.internal.AbstractTask$TaskActionWrapper`
                    - field `actions` of `org.gradle.api.tasks.javadoc.Javadoc`
                        - task `:gradle-guide-error-prone:javadoc` of type `org.gradle.api.tasks.javadoc.Javadoc`

After this PR

Instead of capturing Gradle domain objects (SourceSets and Projects) in tasks, use providers as inputs.

==COMMIT_MSG==
Make BaselineModuleJvmArgs Configuration-Cache friendly
==COMMIT_MSG==

Possible downsides?

@FinlayRJW
Copy link
Contributor

can we get a test case for this?

});

Provider<ImmutableList<JarManifestModuleInfo>> classpathInfo =
project.provider(() -> collectClasspathInfoForSourceSet(sourceSet));
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than wrapping this in a provider can we just make collectClasspathInfoForSourceSet return a provider - something like this should work I think:

        return classpath.getElements().map(fileSystemLocations -> fileSystemLocations.stream()
                .map(FileSystemLocation::getAsFile)
                .map(file -> { ... }))

@stale
Copy link

stale bot commented Oct 18, 2025

This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.

@stale stale bot added the stale label Oct 18, 2025
@kelvinou01
Copy link
Author

no!

@stale stale bot removed the stale label Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants