Nokia Networks Home

Nokia nmake Product Builder

Quick Links

Related Products

Tool Repository

[ tool index ]

targets.groovy

Lists information about the triggered targets.

Download targets.groovy

Description

targets.groovy is a Groovy script that lists data about each triggered target. Data about each target appears on a separate output line in a space separated format. Each line displays target name, execution exit code, start time, and end time. This is an example Groovy script from the Build Log Overview.

Requirements

groovy. Groovy is a general purpose dynamic scripting language for the JVM that provides strong support for processing XML. Since Groovy runs on the JVM, scripts may be run on platforms supporting the JVM including Linux, Solaris, and Windows.

Usage

groovy targets.groovy filename.xml

Example Command Line

groovy targets.groovy makelog.xml

Example Output

See the Extended Example in the Build Log Overview for details and structure of the example build used.

cmd 0 17:11:21.16 17:11:21.57
hw 0 17:11:21.22 17:11:21.53
hw.o 0 17:11:21.31 17:11:21.36
hw 0 17:11:21.38 17:11:21.43
../../../bin 0 17:11:21.45 17:11:21.46
../../../bin/hw 0 17:11:21.48 17:11:21.50

Script

The first line parses the XML document and saves the parsed build log tree in variable bl. The second line sets up a pipeline-like processing chain using Groovy GPath. GPath allows navigation of hierarchical object structures much like XPath allows navigation of the structure of an XML document. The ** step provides recursive depth first traversal of the build log object nodes, and the grep step filters for nodes named tg. The each() method runs the following closure for each tg node found. The closure formats the output using a GString expansion and sends it to standard output using println. Within the GString, GPath expressions are used to pick out fields for output relative to the current node stored in variable it. For example, it.@nm accesses the attribute named nm. The [11..21] subscripts extract a substring from the provided String object. See also the Build Log Overview.

def bl = new XmlSlurper().parse(args[0])
bl.'**'.grep{it.name() == 'tg'}.each {
    println "${it.@nm} ${it.@ec} ${it.@st.text()[11..21]} ${it.@et.text()[11..21]}"
}
0
Last Update: Friday,12-Aug-2016 12:16:58 EDT