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

Add better control over generated files registration #31331

Closed
wilkinsona opened this issue Sep 28, 2023 · 1 comment
Closed

Add better control over generated files registration #31331

wilkinsona opened this issue Sep 28, 2023 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Milestone

Comments

@wilkinsona
Copy link
Member

Affects: 6.0

During test AOT processing, each merged context configuration results in a new initializer being generated. These initializers provide separation for the code that's required to bootstrap the AOT-processed context. When an AOT contribution adds files to the generated context (generationContext.getGeneratedFiles().addResourceFile(…) for example), no such separation occurs. As seen in this Spring Boot issue, this can lead to clashes as files from AOT processing of an earlier merged context configuration are overwritten by processing of a subsequent merged context configuration.

I think we need a way to separate the files that are generated during AOT processing so that they're isolated on a per-context basis. This would need to work both on the writing side when files are being generated during AOT processing and on the reading side when those generated files are being consumed at runtime when the AOT processed context is refreshed.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 28, 2023
@sbrannen sbrannen added in: test Issues in the test module in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing labels Sep 28, 2023
@snicoll snicoll removed the in: test Issues in the test module label Sep 29, 2023
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 17, 2023
@snicoll snicoll added this to the 6.2.x milestone Oct 17, 2023
@simonbasle simonbasle self-assigned this Jun 18, 2024
@snicoll snicoll self-assigned this Jun 22, 2024
@snicoll snicoll changed the title During test AOT processing with multiple merged context configurations generated files can clash as there's no per-context separation Add better control over genreated files registration Jun 22, 2024
@snicoll
Copy link
Member

snicoll commented Jun 22, 2024

We've been working on an API that would handle those clashes and return a ResourceReference that can generate the code to get back a Spring's Resource as MethodReference does for methods. Unfortunately, that didn't help very much as the use case is outside of Spring and all that's required really is to make sure that the model that is generated is the same as the one that was already generated, if any.

This issue is requalified to an advanced API in GeneratedFiles that provides a callback that let the caller determine what they want to do in case the file already exists.

@snicoll snicoll changed the title Add better control over genreated files registration Add better control over generated files registration Jun 22, 2024
@snicoll snicoll modified the milestones: 6.2.x, 6.2.0-M5 Jun 22, 2024
snicoll added a commit that referenced this issue Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants