Daniel
08/20/2017, 9:08 PM@Extension
public class PluginDescriptor extends BuildStepDescriptor<Publisher> {
public PluginDescriptor() {
super(Plugin.class);
}
@Override
public boolean isApplicable(Class type) {
return true;
}
@Override
public String getDisplayName() {
return "My Plugin In Kotlin";
}
}
Kotlin:
@Extension
class PluginDescriptor : BuildStepDescriptor<Publisher>(Plugin::class.java) {
override fun isApplicable(type: Class<out AbstractProject<*, *>>) = true
override fun getDisplayName() = "My Plugin In Kotlin"
}
I made sure to check if the class is instantiated in its kotlin form, which is not the case.
isApplicaple controls if the build step is available for a job type.
The annotation in question is: @Extension
Its used by the jenkins source code to mark that this class extends their functionality (for example with another build step). Sadly the source code is very convoluted and I am not 100% sure how they achiev that.