Currently three scripting languages are supported, respectively:
- MVEL: this language will be used if the script
is prefixed with mvel:. For example, mvel: util.calendar.year
- Groovy: this language will be used if the
script is prefixed with groovy:. For example, groovy: util.calendar.year
- OGNL: this language will be used if
the script is prefixed with ognl:. For example: ognl: util.calendar.year
If the script is NOT prefixed, MVEL language will be assumed, for example,
util.calendar.year.
To facilitate the interaction between script and QuickBuild system, below root objects are made
available in the script execution context.
Inside the script, methods of these objects can be called using language specific grammar. Below are some examples
demonstrating the usage:
-
Example1: The method get(java.lang.String) can be called against the root object
vars to get variable of specified name, and the returned variable object has a method
increase() to increase the variable value by one. Assume we've defined a configuration
variable named 'buildNumber' with initial value being '1'. We can then increase value of this
variable with below script:
vars.get("buildNumber").increase()
-
Example2: The method getRepository(java.lang.String) can be called against root object
configuration to get repository object of specified name, and the returned
repository object has a method getRevision() which can be called to get repository
revision used for current build. We can then get value of that revision with below script:
configuration.getRepository("yourRepositoryName").getRevision()