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

Refactor: Convert PluginPropertiesExtension to Java (#34459) #36673

Closed
wants to merge 2 commits into from
Closed

Refactor: Convert PluginPropertiesExtension to Java (#34459) #36673

wants to merge 2 commits into from

Conversation

fabiodrg
Copy link

This is the first time I am working at this level with Gradle, so I went through some challenges. One of them is not yet solved, which is how to access the extra properties from Project. Whenever I try to compile it fails saying the ext symbol is not defined (project.ext).
I am looking into Gradle documentation for days, and I can't find a workaround for this. I was having similar issues when accessing properties such version or name, but I could solve it buy using the methods available. Probably I am misunderstanding how this works. If anyone could provide some help, I would appreciate it a lot.

Due the problem with accessing the extra properties, the following methods are not completed, but they aren't used at the moment, so I decided to create the pull request anyway, and hopefully with the community and elastic team insights I will be able to complete this task.

  • setLicenseFile()
  • setNoticeFile()

@alpar-t
Copy link
Contributor

alpar-t commented Dec 17, 2018

@fabiodrg666 project.ext in java is project.getExtensions() .getByType(ExtraPropertiesExtension.class). Missing properties on a project are looked up from a number of places, extensions are among those, and ext is a special extension of type ExtraPropertiesExtension. I do think the setters are used. note that Groovy calls setters on assignment if they are available.

@colings86 colings86 added the :Delivery/Build Build or test infrastructure label Dec 19, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@jasontedor jasontedor requested a review from alpar-t December 20, 2018 17:21
*/
public class PluginPropertiesExtension {

@Input
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In groovy, the Input annotation adds the get/set capabilities, and is automatically tracked. However, that is for tasks. I'm not sure it actually makes sense (and was erroneous but harmless in the old groovy code). @atorok can you confirm my understanding? If so, I think all these Input annotations should be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, the annotations don't do anything on extensions, their for tasks and need to be placed on the getter method in Java ( having them on properties works on Groovy only )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback, I will remove the Input annotations.

@danielmitterdorfer
Copy link
Member

@fabiodrg666 are you still interested in getting this PR in?

@alpar-t
Copy link
Contributor

alpar-t commented Mar 7, 2019

Overlaps with #39605

@alpar-t
Copy link
Contributor

alpar-t commented Mar 7, 2019

@fabiodrg666 I'm going to close this, please reopen if you plan to work on it

@alpar-t alpar-t closed this Mar 7, 2019
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure feedback_needed Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants