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 new service types to AOT optimizations by default #812

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

melix
Copy link
Collaborator

@melix melix commented Aug 31, 2023

And you would ask: why don't you use the constant available in io.micronaut.aot.std.sourcegen.AbstractStaticServiceLoaderSourceGenerator? Good question! That's because Micronaut AOT is a compile only dependency: we have the ability to override the version of AOT which is used at runtime, so the types that we use in the task are limited, and we cannot use any of the AOT types at this point in time.

This means that ideally, we should have an additional AOT module which simply exposes such constants, and use it as a runtime dependency. However, it's a bit overkill for a single constant right now. Worse, this wouldn't improve the situation in case the user overrides the AOT version, since the plugin would only "see" the version it was compiled with. This means a proper fix would be to actually read the constant dynamically, before we invoke AOT. Lots of work for something which would slow down execution and be a bit hackish.

And you would ask: why don't you use the constant available in
`io.micronaut.aot.std.sourcegen.AbstractStaticServiceLoaderSourceGenerator`?
Good question! That's because Micronaut AOT is a _compile only_ dependency:
we have the ability to override the version of AOT which is used at runtime,
so the types that we use in the task are limited, and we cannot use any
of the AOT types at this point in time.

This means that ideally, we should have an additional AOT module which
simply exposes such constants, and use it as a runtime dependency. However,
it's a bit overkill for a single constant right now. Worse, this wouldn't
improve the situation in case the user overrides the AOT version, since
the plugin would only "see" the version it was compiled with. This means
a proper fix would be to actually read the constant dynamically, _before_
we invoke AOT. Lots of work for something which would slow down execution
and be a bit hackish.
@melix melix added the type: improvement A minor improvement to an existing feature label Aug 31, 2023
@melix melix added this to the 4.0.4 milestone Aug 31, 2023
@melix melix requested a review from yawkat August 31, 2023 13:37
@melix melix self-assigned this Aug 31, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@melix melix merged commit b6b3c67 into master Sep 1, 2023
@melix melix deleted the cc/aot-improvements branch September 1, 2023 07:10
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