Nokia Networks Home

Nokia nmake Product Builder

Quick Links

Related Products

Tool Repository

[ tool index ]

makefiles.scala

Reports information in HTML format about each makefile built.

Download makefiles.scala

Description

makefiles.scala is a Scala script that outputs an HTML document containing a table having a row for each makefile run during the build. The fields displayed in each row are make recursion level, directory relative to a specified root, and makefile execution start and end times. This is an example Scala script from the Build Log Overview.

Requirements

scala. Scala is a general purpose staticly typed programming language for the JVM that smoothly integrates features of object-oriented and functional programming and provides built-in parsing of inline standard XML syntax and library support for XPath style XML document queries. Since Scala runs on the JVM, it runs on platforms supporting the JVM including Linux, Solaris, and Windows.

Usage

scala targets.scala filename.xml

Example Command Line

scala makefiles.scala makelog.xml

Example Output

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

<?xml version='1.0' encoding='UTF-8'?>
<html>
	<head>
		<title>Triggered makefiles</title>
	</head>
	<body>
		<h1>Triggered makefiles</h1>
		<table>
			<tr>
				<th>makelevel</th>
				<th>pwd</th>
				<th>start time</th>
				<th>end time</th>
			</tr>
			<tr>
				<td>0</td>
				<td>src</td>
				<td>17:11:21.14</td>
				<td>17:11:21.58</td>
			</tr><tr>
				<td>1</td>
				<td>src/cmd</td>
				<td>17:11:21.20</td>
				<td>17:11:21.55</td>
			</tr><tr>
				<td>2</td>
				<td>src/cmd/hw</td>
				<td>17:11:21.25</td>
				<td>17:11:21.51</td>
			</tr>
		</table>
	</body>
</html>

Script

The XML parsing and filtering steps are similar to those in targets.scala. The HTML is specified in standard XML syntax using a Scala XML literal. Scala constructs such as for (ml <- (bl \\ "makelog")) yield ... may be interspersed with literal HTML tags by including them between curly braces. This allows iteration over input data structures to generate variable parts of the HTML document. See also the Build Log Overview.

import scala.xml.XML
val bl = XML.loadFile(args(0))
val root = "ex1/"
val xhtml =
<html>
	<head>
		<title>Triggered makefiles</title>
	</head>
	<body>
		<h1>Triggered makefiles</h1>
		<table>
			<tr>
				<th>makelevel</th>
				<th>pwd</th>
				<th>start time</th>
				<th>end time</th>
			</tr>
			{for (ml <- (bl \\ "makelog")) yield
			<tr>
				<td>{(ml \ "makeinfo" \ "makelevel").text}</td>
				<td>{(ml \ "makeinfo" \ "pwd").text.replaceFirst(".*"+root, "")}</td>
				<td>{(ml \ "makeinfo" \ "stime").text.substring(11,22)}</td>
				<td>{(ml \ "makeinfo" \ "etime").text.substring(11,22)}</td>
			</tr>
			}
		</table>
	</body>
</html>
XML.saveFull("out.html", xhtml, "UTF-8", true, null)
Last Update: Friday,12-Aug-2016 12:16:46 EDT