241 <attribute name="dir"/> |
234 <attribute name="dir"/> |
242 <attribute name="annodetail"/> |
235 <attribute name="annodetail"/> |
243 <attribute name="root"/> |
236 <attribute name="root"/> |
244 <attribute name="failonerror"/> |
237 <attribute name="failonerror"/> |
245 <attribute name="phase"/> |
238 <attribute name="phase"/> |
246 self.setTaskName("emake"); |
239 self.setTaskName("emake"); |
247 // check attributes |
240 // check attributes |
248 if (attributes.get("name") == null) |
241 if (attributes.get("name") == null) { |
249 throw new org.apache.tools.ant.BuildException("name attribute is not defined"); |
242 throw new org.apache.tools.ant.BuildException("name attribute is not defined"); |
250 self.log("Name: " + attributes.get("name")); |
243 } |
251 if (attributes.get("makefile") == null) |
244 self.log("Name: " + attributes.get("name")); |
252 throw new org.apache.tools.ant.BuildException("makefile attribute is not defined"); |
245 if (attributes.get("makefile") == null) { |
253 self.log("Makefile: " + attributes.get("makefile")); |
246 throw new org.apache.tools.ant.BuildException("makefile attribute is not defined"); |
254 String target = "all"; |
247 } |
255 String custom = ""; |
248 self.log("Makefile: " + attributes.get("makefile")); |
256 String annofileDir = ""; |
249 String target = "all"; |
257 if (attributes.get("target") != null) |
250 String custom = ""; |
258 target = attributes.get("target"); |
251 String annofileDir = ""; |
259 self.log("Target: " + target); |
252 if (attributes.get("target") != null) { |
260 if (attributes.get("custom") != null) |
253 target = attributes.get("target"); |
261 custom = attributes.get("custom"); |
254 } |
262 if (attributes.get("root") != null) |
255 self.log("Target: " + target); |
263 root = attributes.get("root"); |
256 if (attributes.get("custom") != null) { |
264 else |
257 custom = attributes.get("custom"); |
265 root = ""; |
258 } |
266 |
259 if (attributes.get("root") != null) { |
267 self.log("Custom: " + custom); |
260 root = attributes.get("root"); |
268 |
261 } |
269 // Create and configure exec target |
262 else { |
270 org.apache.tools.ant.taskdefs.ExecTask task = new org.apache.tools.ant.taskdefs.ExecTask(); |
263 root = ""; |
271 task.setProject(self.getProject()); |
264 } |
272 task.setTaskName(self.getTaskName()); |
265 |
273 String emake = com.nokia.ant.util.Helper.getProperty(project, "ec.emake"); |
266 self.log("Custom: " + custom); |
274 task.setExecutable(emake); |
267 |
275 if (attributes.get("failonerror") != null) { |
268 // Create and configure exec target |
276 task.setFailonerror(Boolean.parseBoolean(attributes.get("failonerror"))); |
269 org.apache.tools.ant.taskdefs.ExecTask task = new org.apache.tools.ant.taskdefs.ExecTask(); |
277 } else { |
270 task.setProject(self.getProject()); |
278 task.setFailonerror(true); |
271 task.setTaskName(self.getTaskName()); |
279 } |
272 String emake = com.nokia.ant.util.Helper.getProperty(project, "ec.emake"); |
280 String buildDrive = com.nokia.ant.util.Helper.getProperty(project, "build.drive"); |
273 task.setExecutable(emake); |
281 task.setDir(new java.io.File(buildDrive + "/")); |
274 if (attributes.get("failonerror") != null) { |
282 if (attributes.get("log") != null) { |
275 task.setFailonerror(Boolean.parseBoolean(attributes.get("failonerror"))); |
283 self.log("Log: " + attributes.get("log")); |
276 } |
284 task.setOutput(new java.io.File(attributes.get("log"))); |
277 else { |
285 } |
278 task.setFailonerror(true); |
286 if (attributes.get("dir") != null) { |
279 } |
287 self.log("dir: " + attributes.get("dir")); |
280 String buildDrive = com.nokia.ant.util.Helper.getProperty(project, "build.drive"); |
288 task.setDir(new java.io.File(attributes.get("dir"))); |
281 task.setDir(new java.io.File(buildDrive + "/")); |
289 } |
282 if (attributes.get("log") != null) { |
290 String buildId = com.nokia.ant.util.Helper.getProperty(project, "build.id"); |
283 self.log("Log: " + attributes.get("log")); |
291 task.createArg().setValue("--emake-build-label=" + buildId + "-" + attributes.get("name")); |
284 task.setOutput(new java.io.File(attributes.get("log"))); |
292 String eclass = com.nokia.ant.util.Helper.getProperty(project, "ec.build.class"); |
285 } |
293 task.createArg().setValue("--emake-class=" + eclass); |
286 if (attributes.get("dir") != null) { |
294 String eroot = com.nokia.ant.util.Helper.getProperty(project, "env.EMAKE_ROOT"); |
287 self.log("dir: " + attributes.get("dir")); |
295 String heliumDir = com.nokia.ant.util.Helper.getProperty(project, "helium.dir"); |
288 task.setDir(new java.io.File(attributes.get("dir"))); |
296 if (attributes.get("root") != null) { |
289 } |
297 self.log("--emake-root=" + eroot + ";" + heliumDir + ";" + root); |
290 String buildId = com.nokia.ant.util.Helper.getProperty(project, "build.id"); |
298 } |
291 task.createArg().setValue("--emake-build-label=" + buildId + "-" + attributes.get("name")); |
299 task.createArg().setValue("--emake-root=" + eroot + ";" + heliumDir + ";" + root); |
292 String eclass = com.nokia.ant.util.Helper.getProperty(project, "ec.build.class"); |
300 if (attributes.get("phase") != null) { |
293 task.createArg().setValue("--emake-class=" + eclass); |
301 annofileDir = com.nokia.ant.util.Helper.getProperty(project, "build.log.dir") + "/" + attributes.get("phase"); |
294 String eroot = com.nokia.ant.util.Helper.getProperty(project, "env.EMAKE_ROOT"); |
302 } |
295 String heliumDir = com.nokia.ant.util.Helper.getProperty(project, "helium.dir"); |
303 else { |
296 if (attributes.get("root") != null) { |
304 annofileDir = com.nokia.ant.util.Helper.getProperty(project, "build.log.dir"); |
297 self.log("--emake-root=" + eroot + ";" + heliumDir + ";" + root); |
305 } |
298 } |
306 if (attributes.get("annodetail") != null) { |
299 task.createArg().setValue("--emake-root=" + eroot + ";" + heliumDir + ";" + root); |
307 task.createArg().setValue("--emake-annodetail=" + attributes.get("annodetail")); |
300 if (attributes.get("phase") != null) { |
308 task.createArg().setValue("--emake-annofile=" + annofileDir + "/" + buildId + "-" + attributes.get("name") + ".emake.anno.xml"); |
301 annofileDir = com.nokia.ant.util.Helper.getProperty(project, "build.log.dir") + "/" + attributes.get("phase"); |
309 } |
302 } |
310 task.createArg().setLine(custom); |
303 else { |
311 task.createArg().setLine("-f " + attributes.get("makefile")); |
304 annofileDir = com.nokia.ant.util.Helper.getProperty(project, "build.log.dir"); |
312 task.createArg().setLine(target); |
305 } |
313 // Execute. |
306 if (attributes.get("annodetail") != null) { |
314 task.execute(); |
307 task.createArg().setValue("--emake-annodetail=" + attributes.get("annodetail")); |
|
308 task.createArg().setValue("--emake-annofile=" + annofileDir + "/" + buildId + "-" + attributes.get("name") + ".emake.anno.xml"); |
|
309 } |
|
310 task.createArg().setLine(custom); |
|
311 task.createArg().setLine("-f " + attributes.get("makefile")); |
|
312 task.createArg().setLine(target); |
|
313 |
|
314 task.execute(); |
315 </scriptdef> |
315 </scriptdef> |
316 |
316 |
317 |
317 |
318 <!-- Macro to build using Raptor.--> |
318 <!-- Macro to build using Raptor.--> |
319 <scriptdef name="sbsMacro" language="beanshell" uri="http://www.nokia.com/helium"> |
319 <scriptdef name="sbsMacro" language="beanshell" uri="http://www.nokia.com/helium"> |
323 <attribute name="skipbuild"/> |
323 <attribute name="skipbuild"/> |
324 <attribute name="singlejob"/> |
324 <attribute name="singlejob"/> |
325 <attribute name="layer-order"/> |
325 <attribute name="layer-order"/> |
326 <attribute name="command"/> |
326 <attribute name="command"/> |
327 <attribute name="components"/> |
327 <attribute name="components"/> |
328 <![CDATA[ |
328 <![CDATA[ |
329 import com.nokia.tools.sbs.SBSTool; |
329 import com.nokia.tools.sbs.SBSTool; |
330 SBSTool sbsTool = new SBSTool(); |
330 SBSTool sbsTool = new SBSTool(); |
331 sbsTool.execute(attributes,project); |
331 sbsTool.execute(attributes,project); |
332 ]]> |
332 ]]> |
333 </scriptdef> |
333 </scriptdef> |
334 |
334 |
335 |
335 |
336 <scriptdef name="getSBSConfigMacro" language="beanshell" uri="http://www.nokia.com/helium"> |
336 <scriptdef name="getSBSConfigMacro" language="beanshell" uri="http://www.nokia.com/helium"> |
337 <attribute name="sbs.sysdef.file"/> |
337 <attribute name="sbs.sysdef.file"/> |
338 <![CDATA[ |
338 <![CDATA[ |
339 import com.nokia.config.SAXConfigParser; |
339 import com.nokia.config.SAXConfigParser; |
340 SAXConfigParser configParser = new SAXConfigParser(attributes.get("sbs.sysdef.file")); |
340 SAXConfigParser configParser = new SAXConfigParser(attributes.get("sbs.sysdef.file")); |
341 project.setProperty("sbs.configs",configParser.getConfigs()); |
341 project.setProperty("sbs.configs",configParser.getConfigs()); |
342 ]]> |
342 ]]> |
343 </scriptdef> |
343 </scriptdef> |
344 |
344 |
345 </antlib> |
345 </antlib> |