|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <!-- |
|
3 ============================================================================ |
|
4 Name : imaker.ant.xml |
|
5 Part of : Helium |
|
6 |
|
7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
8 All rights reserved. |
|
9 This component and the accompanying materials are made available |
|
10 under the terms of the License "Eclipse Public License v1.0" |
|
11 which accompanies this distribution, and is available |
|
12 at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
13 |
|
14 Initial Contributors: |
|
15 Nokia Corporation - initial contribution. |
|
16 |
|
17 Contributors: |
|
18 |
|
19 Description: |
|
20 |
|
21 ============================================================================ |
|
22 --> |
|
23 <project name="rombuild.imaker" xmlns:hlm="http://www.nokia.com/helium"> |
|
24 <description> |
|
25 ROM image creation using iMaker (future implementation). |
|
26 </description> |
|
27 |
|
28 <!-- Defining the default rom image creation templates. --> |
|
29 <property name="imaker.fmpp.makefile" location="${helium.dir}/tools/common/templates/imaker/build_imaker_roms_signing.mk.ftl"/> |
|
30 <property name="imaker.fmpp.ant" location="${helium.dir}/tools/common/templates/imaker/build_imaker_roms.ant.xml.ftl"/> |
|
31 |
|
32 |
|
33 <!-- The iMaker task. --> |
|
34 <macrodef name="imaker" uri="http://www.nokia.com/helium"> |
|
35 <element name="config"/> |
|
36 <attribute name="engine" default="ebs"/> |
|
37 <attribute name="name" default=""/> |
|
38 <attribute name="signal" default="true"/> |
|
39 <sequential> |
|
40 <hlm:tempRecordStartMacro name="${build.id}@{name}.roms.log"/> |
|
41 <hlm:imaker2tdd property="internal.imaker.tdd" dir="${build.drive}/"> |
|
42 <config/> |
|
43 </hlm:imaker2tdd> |
|
44 <echo> |
|
45 Generated TDD: |
|
46 ${internal.imaker.tdd} |
|
47 </echo> |
|
48 <mkdir dir="${build.log.dir}"/> |
|
49 <if> |
|
50 <matches pattern="ec(-helium)?" string="@{engine}"/> |
|
51 <then> |
|
52 <fmpp sourceFile="${imaker.fmpp.makefile}" |
|
53 outputFile="${temp.build.dir}/build_imaker_roms@{name}.mk"> |
|
54 <data expandProperties="yes"> |
|
55 data: ${internal.imaker.tdd} |
|
56 ant: antProperties() |
|
57 </data> |
|
58 </fmpp> |
|
59 <exec executable="${ec.emake}" dir="${build.drive}/"> |
|
60 <arg value="--emake-build-label=${build.id}@{name}-ROMS"/> |
|
61 <arg value="--emake-class=${ec.build.class}"/> |
|
62 <arg value="--emake-annofile=${build.log.dir}\${build.id}@{name}.ROMS.emake.anno.xml"/> |
|
63 <arg value="--emake-autodepend=1"/> |
|
64 <arg value="--emake-annodetail=basic,history,file,waiting"/> |
|
65 <arg line="-f ${temp.build.dir}/build_imaker_roms@{name}.mk all"/> |
|
66 </exec> |
|
67 </then> |
|
68 <else> |
|
69 <fmpp sourceFile="${imaker.fmpp.ant}" |
|
70 outputFile="${temp.build.dir}/build_imaker_roms@{name}.ant.xml"> |
|
71 <data expandProperties="yes"> |
|
72 data: ${internal.imaker.tdd} |
|
73 ant: antProperties() |
|
74 </data> |
|
75 </fmpp> |
|
76 <ant antfile="${temp.build.dir}/build_imaker_roms@{name}.ant.xml" target="all" /> |
|
77 </else> |
|
78 </if> |
|
79 |
|
80 <hlm:tempRecordStopMacro name="${build.id}@{name}.roms.log" filterref="filterset.imaker"/> |
|
81 <!-- Todo: metadata: insert assertions for metadata parsing here --> |
|
82 <if> |
|
83 <istrue value="@{signal}"/> |
|
84 <then> |
|
85 <hlm:signalMacro logfile="${build.log.dir}/${build.id}@{name}.roms.log" |
|
86 signal.input="rombuildSignalInput" /> |
|
87 </then> |
|
88 </if> |
|
89 </sequential> |
|
90 </macrodef> |
|
91 |
|
92 <!-- |
|
93 This task implements the transformation of iMaker introspection into a TDD for FMPP. |
|
94 Syntax will be like: |
|
95 <pre> |
|
96 <hlm:imaker2tdd property="internal.imaker.tdd"> |
|
97 <imakerconfigurationset> |
|
98 <imakerconfiguration> |
|
99 <makefileset> |
|
100 <include name="**/PRODUCT/*ui.mk"/> |
|
101 </makefileset> |
|
102 <categoryset> |
|
103 <include name="build"/> |
|
104 <include name="release"/> |
|
105 <include name="test"/> |
|
106 </categoryset> |
|
107 </imakerconfiguration> |
|
108 </imakerconfigurationset> |
|
109 </hlm:imaker2tdd> |
|
110 </pre> |
|
111 --> |
|
112 |
|
113 <scriptdef name="imaker2tdd" language="jython" uri="http://www.nokia.com/helium"> |
|
114 <element name="imakerconfigurationset" classname="com.nokia.ant.types.imaker.ConfigurationSet"/> |
|
115 <attribute name="property"/> |
|
116 <attribute name="file"/> |
|
117 <attribute name="dir"/> |
|
118 <![CDATA[ |
|
119 import imaker |
|
120 import traceback |
|
121 import ant |
|
122 import logging |
|
123 logging.getLogger('imaker.api').addHandler(ant.AntHandler(self)) |
|
124 try: |
|
125 imaker.ant_task_configuration(project, self, elements, attributes) |
|
126 except Exception, e: |
|
127 traceback.print_exc() |
|
128 # Propagate the exception |
|
129 raise e |
|
130 ]]> |
|
131 </scriptdef> |
|
132 |
|
133 <!-- |
|
134 This task merges all files mentioned in the fileset and output them in filename output file. |
|
135 --> |
|
136 <scriptdef name="mergeConfigXML" language="beanshell" uri="http://www.nokia.com/helium"> |
|
137 <element name="fileset" type="fileset"/> |
|
138 <attribute name="filename"/> |
|
139 <![CDATA[ |
|
140 import java.io.File; |
|
141 import org.dom4j.Node; |
|
142 import org.dom4j.io.SAXReader; |
|
143 import org.dom4j.DocumentHelper; |
|
144 import org.dom4j.Element; |
|
145 import org.dom4j.Document; |
|
146 import org.dom4j.io.OutputFormat; |
|
147 import org.dom4j.io.XMLWriter; |
|
148 |
|
149 Document document = DocumentHelper.createDocument(); |
|
150 Element root = document.addElement("build"); |
|
151 Element rootConfig = root.addElement( "config" ); |
|
152 rootConfig.addAttribute("abstract", "true"); |
|
153 rootConfig.addAttribute("name", "ee-roms"); |
|
154 |
|
155 filesets = elements.get("fileset"); |
|
156 for (i = 0; i < filesets.size(); ++i) { |
|
157 ds = filesets.get(i).getDirectoryScanner(project); |
|
158 ds.scan(); |
|
159 String[] files = ds.getIncludedFiles(); |
|
160 for (j = 0; j < files.length ; ++j) { |
|
161 romconf = new File(ds.getBasedir(), files[j]); |
|
162 self.log("Adding " + romconf + "."); |
|
163 SAXReader reader = new SAXReader(); |
|
164 Document document = reader.read(romconf); |
|
165 Node node = document.selectSingleNode("//build/config"); |
|
166 rootConfig.add(node.detach()); |
|
167 } |
|
168 } |
|
169 // lets write to a file |
|
170 OutputFormat format = OutputFormat.createPrettyPrint(); |
|
171 XMLWriter writer = new XMLWriter(new FileWriter(attributes.get("filename")), format); |
|
172 writer.write( document ); |
|
173 writer.close(); |
|
174 ]]> |
|
175 </scriptdef> |
|
176 |
|
177 <!-- |
|
178 This target is an helper to recompose the rom image configuration using the output of iMaker. |
|
179 --> |
|
180 <target name="imaker-merge-rom-xml"> |
|
181 <mkdir dir="${temp.build.dir}"/> |
|
182 <property name="rombuild.config.file.parsed" location="${build.output.dir}/rom_config.xml.parsed" /> |
|
183 <hlm:mergeConfigXML filename="${rombuild.config.file.parsed}"> |
|
184 <fileset dir="${release.images.dir}" includes="**/*.iconfig.xml"/> |
|
185 </hlm:mergeConfigXML> |
|
186 </target> |
|
187 |
|
188 <!-- Future official target for building roms using iMaker. |
|
189 To configure that target you have to define an imakerconfigurationset type identified by |
|
190 'imaker.rom.config'. |
|
191 --> |
|
192 <target name="build-roms" depends="rombuild-imaker-create-buildinfo"> |
|
193 <property name="imaker.engine" value="${build.system}" /> |
|
194 <property name="imaker.rom.name" value=""/> |
|
195 <hlm:imaker engine="${imaker.engine}" name="${imaker.rom.name}"> |
|
196 <config> |
|
197 <imakerconfigurationset refid="imaker.rom.config"/> |
|
198 </config> |
|
199 </hlm:imaker> |
|
200 <if> |
|
201 <istrue value="${blocks.enabled}" /> |
|
202 <then> |
|
203 <mkdir dir="${blocks.config.dir}" /> |
|
204 <exec executable="python"> |
|
205 <arg value="-m"/> |
|
206 <arg value="packager.cli"/> |
|
207 <arg value="--epocroot=${build.drive}/" /> |
|
208 <arg value="--config=${blocks.config.dir}" /> |
|
209 <arg value="--datasource=imaker-romdir" /> |
|
210 <arg value="-Dname=roms" /> |
|
211 <arg value="-Dversion=1" /> |
|
212 <arg value="-Ddir=${release.images.dir}" /> |
|
213 <arg value="--updateData" /> |
|
214 </exec> |
|
215 </then> |
|
216 </if> |
|
217 </target> |
|
218 |
|
219 </project> |