-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
94 changes: 0 additions & 94 deletions
94
buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesExtension.groovy
This file was deleted.
Oops, something went wrong.
162 changes: 162 additions & 0 deletions
162
buildSrc/src/main/java/org/elasticsearch/plugin/PluginPropertiesExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
package org.elasticsearch.gradle.plugin; | ||
|
||
import org.gradle.api.Project; | ||
import org.gradle.api.tasks.Input; | ||
import org.gradle.api.tasks.InputFile; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* A container for plugin properties that will be written to the plugin descriptor, for easy | ||
* manipulation in the gradle DSL. | ||
*/ | ||
public class PluginPropertiesExtension { | ||
|
||
@Input | ||
private String name; | ||
@Input | ||
private String version; | ||
@Input | ||
private String description; | ||
@Input | ||
private String classname; | ||
/** | ||
* Other plugins this plugin extends through SPI | ||
*/ | ||
@Input | ||
private List<String> extendedPlugins = new ArrayList<String>(); | ||
@Input | ||
private boolean hasNativeController = false; | ||
/** | ||
* Indicates whether the plugin jar should be made available for the transport client. | ||
*/ | ||
@Input | ||
private boolean hasClientJar = false; | ||
/** | ||
* True if the plugin requires the elasticsearch keystore to exist, false otherwise. | ||
*/ | ||
@Input | ||
private boolean requiresKeystore = false; | ||
/** | ||
* A license file that should be included in the built plugin zip. | ||
*/ | ||
private File licenseFile = null; | ||
/** | ||
* A notice file that should be included in the built plugin zip. This will be | ||
* extended with notices from the {@code licenses/} directory. | ||
*/ | ||
private File noticeFile = null; | ||
private Project project = null; | ||
|
||
public PluginPropertiesExtension(Project project) { | ||
name = project.getName(); | ||
version = project.getVersion().toString(); | ||
this.project = project; | ||
} | ||
|
||
@InputFile | ||
public File getLicenseFile() { | ||
return licenseFile; | ||
} | ||
|
||
public void setLicenseFile(File licenseFile) { | ||
//project.ext.licenseFile = licenseFile; | ||
this.licenseFile = licenseFile; | ||
} | ||
|
||
@InputFile | ||
public File getNoticeFile() { | ||
return noticeFile; | ||
} | ||
|
||
public void setNoticeFile(File noticeFile) { | ||
//project.ext.noticeFile = noticeFile; | ||
this.noticeFile = noticeFile; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public void setVersion(String version) { | ||
this.version = version; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getClassname() { | ||
return classname; | ||
} | ||
|
||
public void setClassname(String classname) { | ||
this.classname = classname; | ||
} | ||
|
||
public List<String> getExtendedPlugins() { | ||
return extendedPlugins; | ||
} | ||
|
||
public void setExtendedPlugins(List<String> extendedPlugins) { | ||
this.extendedPlugins = extendedPlugins; | ||
} | ||
|
||
public boolean getHasNativeController() { | ||
return hasNativeController; | ||
} | ||
|
||
public boolean isHasNativeController() { | ||
return hasNativeController; | ||
} | ||
|
||
public void setHasNativeController(boolean hasNativeController) { | ||
this.hasNativeController = hasNativeController; | ||
} | ||
|
||
public boolean getHasClientJar() { | ||
return hasClientJar; | ||
} | ||
|
||
public boolean isHasClientJar() { | ||
return hasClientJar; | ||
} | ||
|
||
public void setHasClientJar(boolean hasClientJar) { | ||
this.hasClientJar = hasClientJar; | ||
} | ||
|
||
public boolean getRequiresKeystore() { | ||
return requiresKeystore; | ||
} | ||
|
||
public boolean isRequiresKeystore() { | ||
return requiresKeystore; | ||
} | ||
|
||
public void setRequiresKeystore(boolean requiresKeystore) { | ||
this.requiresKeystore = requiresKeystore; | ||
} | ||
|
||
public Project getProject() { | ||
return project; | ||
} | ||
|
||
public void setProject(Project project) { | ||
this.project = project; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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 )
There was a problem hiding this comment.
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.