netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Support for project output artifacts

Open sdedic opened this issue 3 years ago • 1 comments

This PR actually consists of a series of features. I should probably make separate requests for that, but ... that would prolong the review process, I believe.

The overall goal was to add a project query to get the project's output in form of an identifiable artifact(s) and their supposed (not built yet) or existing locations - and expose the analysis result through LSP.

Overview:

ProjectActionContext

This one I wanted for a long time already. Many project APIs or services are likely to be affected by project configurations - and it's rather hard to invoke the services for a specific configuration, which is not the active one. By default UI works against the active configuration, which is fine, but API access should have an option to specify it. Adding configurations to all APIs is hard, and sometimes it is even impossible when the execution goes through some uncooperative layers.; the ProjectActionContext is a way how to pass the information 'out of band'.

I needed to pass specifically project action to distinguish different types of build; for example Micronaut plugins (gradle, maven) support a regular build, and a native-image build, that produces different output(s).

Important note for reviewers: while the ProjectActionContext allows to specify a profile or user properties, which can be ignored by the underlying project system, and give almost complete control over project model evaluation to the caller (at least for gradle and maven), I am not 100% sure if the properties + profiles is a good idea. A conservative approach would be to insist on creating a ProjectConfiguration for the profile+properties setup and use that.

Reviewers, share your opinion on this; these ProjectActionContext properties could be eventually added (compatibly) later.

ProjectArtifactsQuery

this is a project query as usual, asking for project output with GAV coordinates (if applicable). I am almost sure the ArtifactSpec will satisfy PHP, too ... but I still keep it private until Gradle implementation is complete.

The Filter specification does not cover all query cases, but works for the basic ones. When one wants "any output" and a specific output type / classifier.

Micronaut support for native image build

Added a project action and project action mapping for Maven to execute native-image build of the micronaut app. The action becomes available (and is configurable in project customizer) when one adds Micronaut plugin to the maven project build configuration.

Maven fixes

During implementation I've realized that the native-build action, contributed to the Maven by MavenActionsProvider is not visible in the customizer. I was little shocked when I realized that the customizer essentially hardcodes the list of (standard) actions and only displays user-defined ones in addition to the hardcoded list. I've corrected the behaviour of M2Configuration in that it lists just config-specific mappings, the others are retrieved through ActionToGoalUtils. I've also realized that the declarative actions lack proper support for I18N; so I've added a convenience lookup in Bundle.proeprties using the action's (profile's) id, and in additiona specifying displayName that starts with '#' also makes a lookup, with the possbility to identify the Bundle path as well.

sdedic avatar Aug 10 '22 19:08 sdedic

added @lkishalmi since I'm going to make equivalent changes for Gradle in a separate PR. Please comment on the APIs.

sdedic avatar Aug 11 '22 06:08 sdedic

One more reviewer / approver would be awesome...

sdedic avatar Aug 18 '22 12:08 sdedic

2 approvals; going to merge soon, after rebasing to master (minor clash) + consolidating fixes (less clutter).

sdedic avatar Aug 19 '22 11:08 sdedic