Skip to content

Enable aot - #1193

Merged
sdelamo merged 8 commits into
masterfrom
enable-aot
May 2, 2023
Merged

Enable aot#1193
sdelamo merged 8 commits into
masterfrom
enable-aot

Conversation

@sdelamo

@sdelamo sdelamo commented Jan 5, 2023

Copy link
Copy Markdown
Member

No description provided.

@sdelamo sdelamo added the relates-to: build label for issues related to the build file or CI label Jan 5, 2023
@sdelamo sdelamo added this to the 4.0.0 milestone Jan 5, 2023
@github-actions

github-actions Bot commented Jan 5, 2023

Copy link
Copy Markdown

❌ Java CI failed: https://ge.micronaut.io/s/lyflwyndjqzwm

@github-actions

github-actions Bot commented Jan 5, 2023

Copy link
Copy Markdown

❌ GraalVM CE CI 17 latest failed: https://ge.micronaut.io/s/ulexemo2kx5z2

@timyates

timyates commented Jan 5, 2023

Copy link
Copy Markdown
Contributor

@melix Any idea what's causing the failure? I assumed it was the public aot plugin pulling in old dependencies, but I couldn't fix it with substitutions 😞

@melix

melix commented Jan 5, 2023

Copy link
Copy Markdown
Contributor

Which failure are you talking about? Because there are many. If that's the failure about not being able to resolve some dependencies, it may be because of the change from the core BOM to the platform BOM.

@timyates

timyates commented Jan 6, 2023

Copy link
Copy Markdown
Contributor

So just running ./gradlew :s-aot:check, I get multiple possible InterceptorRegistry bean candidates

https://ge.micronaut.io/s/6iaddsbndjsqc/console-log?page=1#L180

From my experiance, this is usually due to multiple versions of micronaut-aop being on the classpath

And indeed, security-aot has aop 2.5 on in the annotationProcessor dependencies https://ge.micronaut.io/s/6iaddsbndjsqc/dependencies?dependencies=aop&expandAll&focusedDependency=WzMsMCw1ODcsWzIsMCxbMTNdXV0

Could this cause it? Do annotationProcessor dependencies end up on the test classpath?

Not sure what's pulling in 2.5 either 🤔

@timyates

timyates commented Jan 6, 2023

Copy link
Copy Markdown
Contributor

It seems to be

    id("io.micronaut.build.internal.aot-module")

pulling in the old version 🤔

@melix

melix commented Jan 6, 2023

Copy link
Copy Markdown
Contributor

Could this cause it? Do annotationProcessor dependencies end up on the test classpath?

The annotation process dependencies do not end up on the runtime classpath (test or not). You can see it in the build scan. It is possible that having aop 2.5 on the annotationProcessor path is the cause, though. It comes transitively via inject: https://ge.micronaut.io/s/6iaddsbndjsqc/dependencies?focusedDependency=WzMsMCw1ODcsWzMsMCxbNTY2LDU4N11dXQ&toggled=W1szXSxbMywwXSxbMywwLFs1NjZdXV0

If we look at the build script, we see that 2 plugins are applied: https://github.com/micronaut-projects/micronaut-security/blob/enable-aot/security-aot/build.gradle.kts#L2-L3

The 1st one is the security internal module, which doesn't seem to do anything suspicious.

The 2d one is the micronaut-build AOT plugin, which sets up the project in order to be able to build AOT modules. This plugin does not add anything to the annotationProcessor path, but it applies the base module transitively.

This plugin will read the micronautVersion property, and also the version from the catalog. In both cases, it should be 4.0.0-SNAPSHOT.

After looking closely, we can see that the 2.5.0 version comes transitively from micronaut-docs: https://ge.micronaut.io/s/4ybfol6q54q2q/dependencies?toggled=W1sxXSxbMSwwXSxbMSwwLFsxN11dLFsxLDAsWzE2XV1d

So a workaround would be to declare the BOM in annotation processor:

dependencies {
    annotationProcessor(platform(libs.micronaut.core.bom))
}

which then yields: https://ge.micronaut.io/s/fv4ulr7muc42g/dependencies?toggled=W1sxXSxbMSwwXV0

Also, set the platform for the annotationProcessor, and remove an un-required test dependency
@github-actions

github-actions Bot commented Jan 6, 2023

Copy link
Copy Markdown

❌ Java CI failed: https://ge.micronaut.io/s/oafl2b4o3n4lo

@github-actions

github-actions Bot commented Jan 6, 2023

Copy link
Copy Markdown

❌ GraalVM CE CI 17 dev failed: https://ge.micronaut.io/s/fyl6whhp52ny2

@github-actions

github-actions Bot commented Jan 6, 2023

Copy link
Copy Markdown

❌ Java CI failed: https://ge.micronaut.io/s/osvthaiic6lti

@github-actions

github-actions Bot commented Jan 6, 2023

Copy link
Copy Markdown

❌ GraalVM CE CI 17 dev failed: https://ge.micronaut.io/s/uiitkexcytzrm

@timyates

timyates commented Jan 6, 2023

Copy link
Copy Markdown
Contributor

@graemerocher @dstepanov When we re-enable the AOT module (and add the test back in), we get an error

Distributed Test Run :security-aot:test > Partition 1 in session 1 on localhost-executor-1 > OpenIdProviderMetadataFetcherCodeGeneratorSpec verify OpenIdProviderMetadataFetcherCodeGenerator generates OpenIdProviderMetadataFetcher per openid client FAILED

  io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type  [io.micronaut.serde.support.DefaultSerdeIntrospections]

  Message: Multiple possible bean candidates found: [InterceptorRegistry, InterceptorRegistry]

https://ge.micronaut.io/s/osvthaiic6lti/console-log?task=:security-aot:test

I seem to recall this is caused by having two different versions of micronaut-aop on the test runtime classpath, however I cannot see that

https://ge.micronaut.io/s/osvthaiic6lti/dependencies?dependencies=aop&expandAll&toggled=W1syLDNdLFsyLDJdLFsyLDFdLFsyLDBdLFsxXSxbMF0sWzNdLFs0XSxbNV0sWzZdLFs3XSxbOF0sWzldLFsxMF0sWzExXSxbMTJdLFsxM10sWzE0XSxbMTVdLFsxNl0sWzE3XV0

Do you have any idea what's wrong?

As an aside, a way of showing where beans were created in the case there are multiple in error would be awesome 😉

@timyates

timyates commented Jan 6, 2023

Copy link
Copy Markdown
Contributor

@dstepanov

Copy link
Copy Markdown
Contributor

@timyates @sdelamo Can you resolve the conflicts?

# Conflicts:
#	security-aot/build.gradle.kts
#	security-aot/src/test/groovy/io/micronaut/security/aot/OpenIdProviderMetadataFetcherCodeGeneratorSpec.groovy
@timyates

Copy link
Copy Markdown
Contributor

Updated the versions as well... I suspect the error will go away... CI will tell...

@sdelamo
sdelamo marked this pull request as ready for review April 27, 2023 15:18
@timyates

Copy link
Copy Markdown
Contributor

@sdelamo running ./test-suite-aot.sh, the second optimized test is failing as

Message: No bean of type [io.micronaut.security.oauth2.client.OpenIdProviderMetadataFetcher] exists.

Not sure what has gone wrong at the moment... Any ideas?

@sdelamo
sdelamo merged commit 55dd5a4 into master May 2, 2023
@sdelamo
sdelamo deleted the enable-aot branch May 2, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relates-to: build label for issues related to the build file or CI

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants