Skip to content
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

Fix compatibility with Gradle's configuration cache #538

Merged
merged 5 commits into from
Apr 5, 2023

Conversation

melix
Copy link
Contributor

@melix melix commented Mar 10, 2023

This pull request fixes our build plugins compatibility with Gradle's build cache. This is not intended for users, but really for our own builds. It should be of best interest in the IDE, when running tests (although I don't know if there's an option to only enable it when running in the IDE).

To test the changes, I have executed the build on Micronaut Test Resources. I was able to successfully:

Note that --configuration-cache is not meant to be used on CI, at least for now, since it would shave a few seconds at best, but we would still have to cache the configuration cache (maybe the Gradle GitHub action does that already, I didn't check).

IMPORTANT: This refactor also removes support for extraPomInfo, pomInfo and introPomInfo closures, which used to be used in Micronaut to customize the generated POM files. All customization, if ever needed, should be done via the type-safe API instead. It seems, by searching in the repositories, that only micronaut-helidon uses, but it's not officially maintained AFAIK and usage can be easily removed.

This commit is a potential breaking change: it converts the publishing
plugin to Java (to make things easier to maintain), and removed in
the process support for the `extraPomInfo`, `startPomInfo` and
`pomInfo` closures which were used to tweak the generated pom files. If
tweaking is required, then this must be done via the type-safe API
instead.

Relates to #536
This was a bit tricky, because we defer configuraton of the model
until the task is actually required (via our model builder). This
caused a number of things to be captured by the configuration cache,
like the extension, version catalog, or even project.

The solution was to use providers, so that the result of the provider
can be serialized.
It seems that the Groovy closures which are serialized by the
configuration cache do not resolve properly the delegates, leading
to strange errors like `logger` not found or `versionsJson` not
found.
@melix melix added the type: improvement A minor improvement to an existing feature label Mar 10, 2023
@melix melix added this to the 6.4.0 milestone Mar 10, 2023
@melix melix self-assigned this Mar 10, 2023
@melix melix merged commit 18faf68 into master Apr 5, 2023
@melix melix deleted the cc/config-cache-compat branch April 5, 2023 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants