Abstract
In this article, we will describe how to support a new tool (new application) in R2build system. R2build uses plugin mechanism and config XML to make it easy to support new tools.
R2build is a tool/Framework for desktop application developers to establish your daily build (or nightly build, or build automation, or continuous integration system) in a very easy manner. It includes, but is not limited to, plug-ins for VB/VC++/.NET/Delphi/Ant/Nant/C++ Builder, email notification, FTP, various Installer packaging tools, and various source control tools such as vss, clearcase, cvs, perfoce….
R2build uses XML file to describe the Node UI dialog and the related parameter. To support a new tool/application in R2build, you should check the command console parameter of this new application, then create a new XML file in the $R2buildInstallDir/plugins, When R2build starts, it will scan all the plugin config XML file, and build the corresponding nodes in the toolbox. This XML describes the console parameter, it's also called application description XML.
Let's start from a very simple example. You get a new application, simple.exe, by calling simple.exe –h
, you know simple.exe has two parameters:
Simple.exe –f filename –x text
-f filename: file to open
-x text: text to delete from file.
To add simple.exe into R2build toolbox, you need create a simple.xml into the $R2BuildInstallDir/Plugins, you can create your own folder, and put simple.xml into that folder. The following is the XML file:
='1.0'='utf-8'
<Plugin version='1' group="" name="Simple" appName="Simple" description="">
<Type>command</Type> - a command console application
<Executor>simple.exe</Executor> - the application's executable file name
<FixedParameter></FixedParameter> -Fixed parameter
<SubExecutor></SubExecutor> -the sub executor of this application
<Icon>simple.png</Icon> -the icon file of this application
<ParameterConfigUI> - the main config section
<FileBrowser display="File to open" BrowseDir="FALSE"
Filter="" type="Parameter" relatedParameter="-f "></FileBrowser> -first parameter
<LineEdit display="Text to delete" type="Parameter" relatedParameter="-x">
</LineEdit> -the second parameter
</ParameterConfigUI>
<ReturnValues> -enum return values of this application
<ReturnValue name="Yes" Condition="$RETURN!=0"></ReturnValue>
<ReturnValue name="No" Condition="$RETURN==0"></ReturnValue>
</ReturnValues>
</Plugin>
Will show in R2build as the following screenshot:
Structure of the XML File
<Plugin>
<Type>command</Type>
//Type is the plugin type, values are : command/plugin
<Executor>cleartool.exe</Executor>
//provide the executor file name, for command plugin,
//it's command's executable file, for plugin, it's plugin's .dll file name
//in the same dir of this file
<FixedParameter></FixedParameter>
//provide the required and non-configurable parameters
<SubExecutor>update</SubExecutor>
//The sub-command of this plugin, some of the tool support sub-command,
//for example cleartool.exe has a sub-command update
<Icon>Update Snapshot View.png</Icon>
//The icon of this plugin
<ParameterConfigUI>
//The section for describing the plugin parameter dialog
//and the related plugin parameterA list of Config items…
<ComboBox display="this is a combox sample" relatedParameter="-d">
availableValue="selectionA;selectionB;selectionC" value="selectionA"></ ComboBox >
<LineEdit display="UserName and password(seperate by ',')"
type="Parameter" relatedParameter="-Y"></LineEdit>
<FileBrowser display="Sourcesafe Database " BrowseDir="TRUE"
Filter="srcsafe.ini" type="Env" relatedParameter="SSDIR"></FileBrowser>
……
……
……
</ParameterConfigUI>
<ReturnValues> //the possible return values for this plugin
<ReturnValue name="Success" Condition="$RETURN==0"></ReturnValue>
<ReturnValue name="Fail" Condition="$RETURN!=0"></ReturnValue>
</ReturnValues>
</Plugin>
The following table lists all the supported ParameterConfigUI
Items. The XML attributes of any item is composed by "Common Attribute" + "Specific Attribute".
Config UI item | Description | Specific attribute for this UI Item (see "common attribute" for attribute that's applicable for all items) |
ComboBox | Show many items in ComboBox , and let user select one availableValue : list all the available values in the listbox , separated by ; | availableValue | List all the available displayed values in the listbox , separated by ; between values |
InternalValue | The internal value is the real value that will apply in the command, separated by ; between values |
ListBox | Show multiple items, and let user select more | availableValue | List all the available values in the listbox , separated by ; between values |
selectionMode | :single,multi,extended |
InputBox : | Show input box, and let user input the parameter directly | | |
RadioGroupBox | Show radio groups | checkable | If checkable is TRUE , put a check box in the group box to enable /disable the whole group |
layout | The layout for the child of this RadioGroupBox . If it's 1 , means we have one column, 2 means 2 columns |
value | The default value for checkable |
RadioBox | Show selection item in radio button groups, and let user select one of them | | |
LineEdit | Show multiple line editor, let user input multiple lines as parameter | isPasswordBox | If this lineedit is a password edit, the value is TRUE or FALSE , if it's a password box, will show mask while inputting |
CheckBox | Show check box, and let user check/uncheck some parameter | | |
FileBrowser | Show the open file/dir dialog to let user select a file or dir, have the following attrs | BrowserDir | If this file browser is a Dir Broswer(TRUE) or File browser(FALSE) , all upper case |
Filter | The filter for this filebrowser , correct format "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"" |
VarViewBox | Show all the defined variables | | |
TabView | Show the tab view | CurrentPage | The current page of the tab |
TabViewItem | Show one tab | | |
Each Config UI Item has the following common attributes:
display
: This label(display) for this itemtype
: See "Supported ParameterConfigUI Item Type"relatedParameter
: The related parameter for this config itemParaSeperator
: Parameter separator for this config item, will add separator between the relatedParameter
and the value, if not config there is no separator between para flag and values. For example -i"c:\aaa.txt" the paraSeperator is comma , -i c:\aaa.txt , the paraSeparator
is one space Required
: If this field is a required parameter, values are : TRUE
or FALSE
(all upper case), TRUE
means this parameter is required. Default value is TRUE
if not setting.
Supported ParameterConfigUI Item Type
For each Config UI Item, they should belong to the following types:
Group
: This config UI item is used to hold other config UI itemsExecutorParameter
: The parameter for the main executor, this config UI item is used to get the values for command parameter, the relatedParameter
field show its related parameterParameter
: The parameter for the sub executor, this config UI item is used to get the values for command parameter, the relatedParameter
field show its related parameterEnv
: This config UI item is used to set the values for environment variable, the relatedParameter
field is the env
variable name. NOTE: Env
variable will be passed to the command as working environment variables.Property
: This config UI item is used to get the other property of the command, the relatedParameter
field is the property name. The supported property is WorkingFolder
(the folder where this command is working)
See $R2buildInstallDir/Plugins for more examples.
Share your Plugins
Send your plugin to R2build@gmail.com to be able to be included in R2build official release or posted on R2build website, your feedback is so important.
R2Build 2.0 Build 416 - SOFTPEDIA "100% CLEAN" AWARD
This product was last tested in the Softpedia Labs on 12 September 2008 by Alexandra Anton Softpedia guarantees that R2Build 2.0 Build 416 is 100% Clean, which means it does not contain any form of malware, including but not limited to: spyware, viruses, trojans and backdoors.
URL: http://www.softpedia.com/progClean/R2Build-Clean-89119.html.