In my plugin (dotnet-sdk), I have several properties that are essentially lists or maps of strings; for example:
- list of targets to build
- properties (keyword/value) to pass to the build
- additional command-line options to pass
Currently, these are all string properties.
The logically-map properties are editable as a multiline text box and parsed as Java properties.
The logically-list properties are regular textboxes, with values processed at runtime via Util.tokenize().
This matches what the Ant plugin does, I believe, and it works well enough.
The only minor thing is that it's not obvious to have to use Java properties syntax for MSBuild properties.
However, for use in pipelines, this is not a very nice interface. I'd want to be able to use actual lists (or a map, in the case of the properties) to set the values.
Is there a way to do this properly? You can't seem to set any property that has no @DataboundSetter, and you can have only setter marked that way (which makes sense).
I suppose what I could do is:
- use an array/map for the backing field
- change the existing properties to "targetsString", "propertiesString" and "optionsString"
- the setter maps the value into the backing field
- the getter turns it back into a string (but there doesn't seem to be an inverse of Util.tokenize(), so making sure quoting is added where needed might be tricky)
- add new "targets" and "options" properties taking String..., and a "properties" taking a Map<String,String>
- are getters required for this? or are setters enough for pipeline use
At that point, things would work, but the snippet generator would not offer any way to generate the nicer versions of the property.
I seem to recall there was an API to hook into to affect this, but I'm not sure.
The other path would be to try and get the jelly set up to have actual separate controls for each list entry (or a pair of controls for the map), with associated add/remove/move up/move down/... controls. That seems tricky at best.
I'd be happy to hear suggestions as to how to get this right and/or links to plugins that have already done this in a nice way.
Small secondary question: is there a page generated somewhere with all names used by builders/wrappers/... defined by (jenkinsci-managed) plugins? Just as a means of avoiding duplicates.