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 agent modes to Maven plugin #260

Closed
lazar-mitrovic opened this issue Jun 29, 2022 · 5 comments
Closed

Add agent modes to Maven plugin #260

lazar-mitrovic opened this issue Jun 29, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request maven-plugin Related to Maven plugin
Milestone

Comments

@lazar-mitrovic
Copy link
Collaborator

lazar-mitrovic commented Jun 29, 2022

Similar to #230 for Gradle plugin, we should implement something similar for the Maven plugin:

<configuration>
    <agent>
        <enabled>true</enabled>
        <defaultMode>standard</defaultMode>
        <modes>
            <conditional>
                <userCodeFilterPath>path-to-filter.json</userCodeFilterPath>
                <extraFilterPath>path-to-another-filter.json</extraFilterPath>
            </conditional>
            <direct>agent-command-line</direct>
        </modes>
        <options>
            <callerFilterFiles>filter.json</callerFilterFiles>
            <accessFilterFiles>filter.json</accessFilterFiles>
            <builtinCallerFilter>true</builtinCallerFilter>
            <builtinHeuristicFilter>true</builtinHeuristicFilter>
            <enableExperimentalPredefinedClasses>false</enableExperimentalPredefinedClasses>
            <enableExperimentalUnsafeAllocationTracing>false</enableExperimentalUnsafeAllocationTracing>
            <trackReflectionMetadata>true</trackReflectionMetadata>
        </options>
        <metadataCopy>
            <disabledPhases>
            <phase>test</phase>
            </disabledPhases>
            <outputDirectory>src/main/resources/META-INF/native-image</outputDirectory>
        </metadataCopy>
    </agent>
</configuration>
@lazar-mitrovic lazar-mitrovic added enhancement New feature or request maven-plugin Related to Maven plugin labels Jun 29, 2022
@lazar-mitrovic lazar-mitrovic added this to the 0.9.13 milestone Jun 29, 2022
@lazar-mitrovic lazar-mitrovic self-assigned this Jun 29, 2022
@lazar-mitrovic lazar-mitrovic modified the milestones: 0.9.13, 0.9.14 Jun 30, 2022
@sdeleuze
Copy link
Collaborator

Concrete use case that will hopefully be solved by this issue : allowing Spring native agent sample to remove this usage of maven-antrun-plugin

Unrelated : I am quite puzzled by the DevXP people get with everything in red in the IDE :
image

I think this is related to our usage of a Maven extension to parse the XML.

@lazar-mitrovic Could you please detail why this is needed? I would like to explore if there is a path where at least most common parts of the XML config can discoverable and not in red like that.

@alvarosanchez
Copy link
Member

The reason why those elements are in red is because the generated META-INF/maven/plugin.xml has all the descriptions as <description></description>.

When building a Maven plugin with Maven, those are taken from the Javadoc. In the case of our Gradle-based build, I'm not sure yet what is the missing piece that makes them to be empty.

@alvarosanchez
Copy link
Member

Sorry, I misread your comment. What I described would cause the existing config elements to not have documentation (eg by pressing F1).

agent in particular is in red because it's not part of plugin.xml, as is being read by NativeExtension as you described.

One possible workaround would be to add agent and its nested options as @Parameters to any mojo (even if unused now). But probably it's not worth it since this task will precisely revamp agent configuration, and by doing so, we would need to add such @Parameters

@sdeleuze
Copy link
Collaborator

So after the refactoring, will users have proper autocompletion and not anymore everything in red in IDEs?

@alvarosanchez
Copy link
Member

Yes, as part of this task, agent and all its structure should be defined as @Parameter in AbstractNativeMojo, which will make them be present in plugin.xml and therefore autocomplete

chrisvest pushed a commit to netty/netty that referenced this issue Jul 27, 2022
…ault (#12635)

Motivation:
See #12601 for more detailed information.

Modifications:
 - Switch Netty 5 to runtime class initialization when used in a `native-image`.
 - Remove native-image substitutions. These are no longer necessary as Netty is now initialized at runtime.
 - Add a script to automatically collect conditional native-image metadata by running the Netty tests with the `native-image-agent` attached.
 - Set the default of `PlatformDependent0.IS_EXPLICIT_TRY_REFLECTION_SET_ACCESSIBLE` to `true` when running in a `native-image`.
 - Remove the `svm` artifact from Netty dependencies - this is no longer needed as Netty doesn't have substitutions.
 - Use the Maven plugin provided by [Native Build Tools](https://github.com/graalvm/native-build-tools) instead of the old GraalVM Maven plugin. The previous plugin has been deprecated in favor of the one provided by the NBT. 
 - Bump the GraalVM version used in the gates to GraalVM 22.1, Java 17

Result:
Hopefully, native-image support should now be easier to maintain. All that's required to regenerate the metadata is to run the `native-image/ni_metadata.sh` script. In the initial testing with the Spring native samples, we noticed a minor increase in the resulting image size.
Automatically generating metadata can be done even cleaner in the future, once the Native Build Tools Maven Plugin gets support for the new conditional metadata collection mode of the agent: graalvm/native-build-tools#260
@melix melix modified the milestones: 0.9.14, 0.9.15 Sep 19, 2022
@melix melix modified the milestones: 0.9.15, 0.9.16 Oct 17, 2022
@sdeleuze sdeleuze modified the milestones: 0.9.16, 0.9.17 Oct 17, 2022
@sdeleuze sdeleuze modified the milestones: 0.9.17, 0.9.18 Oct 28, 2022
@dnestoro dnestoro modified the milestones: 0.9.18, 0.9.19 Nov 17, 2022
@dnestoro dnestoro removed this from the 0.9.19 milestone Dec 2, 2022
@dnestoro dnestoro added this to the 0.9.20 milestone Dec 2, 2022
@dnestoro dnestoro closed this as completed Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request maven-plugin Related to Maven plugin
Projects
None yet
Development

No branches or pull requests

5 participants