buildframework/helium/tools/compile/compile.antlib.xml
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    44     
    44     
    45     <!-- Generates compilation report for diamonds. -->
    45     <!-- Generates compilation report for diamonds. -->
    46     <macrodef name="calculateErrorsFromLog" uri="http://www.nokia.com/helium">
    46     <macrodef name="calculateErrorsFromLog" uri="http://www.nokia.com/helium">
    47         <sequential>
    47         <sequential>
    48             <if>
    48             <if>
    49                 <not>
    49                 <or>
    50                     <isset property="skip.diamonds"/>
    50                     <istrue value="${diamonds.enabled}"/>
    51                 </not>
    51                     <isfalse value="${skip.diamonds}"/>
       
    52                     <not>
       
    53                         <isset property="skip.diamonds"/>
       
    54                     </not>
       
    55                 </or>
    52                 <then>
    56                 <then>
    53                     <fmpp sourceFile="${helium.dir}/tools/common/templates/diamonds/faults_metadata_orm.ftl"
    57                     <fmpp sourceFile="${helium.dir}/tools/common/templates/diamonds/faults_metadata_orm.ftl"
    54                                  outputfile="${diamonds.build.output.dir}/compile-main.xml">
    58                                  outputfile="${diamonds.build.output.dir}/compile-main.xml">
    55                         <data expandProperties="yes">
    59                         <data expandProperties="yes">
    56                             dbPath: ${metadata.dbfile}
    60                             dbPath: ${metadata.dbfile}
    69         <attribute name="phase" default="compile"/>
    73         <attribute name="phase" default="compile"/>
    70         <sequential>
    74         <sequential>
    71             <hlm:calculateErrorsFromLog />
    75             <hlm:calculateErrorsFromLog />
    72             <var name="build.errors.total" unset="true" />
    76             <var name="build.errors.total" unset="true" />
    73             <var name="compile.result" unset="true" />
    77             <var name="compile.result" unset="true" />
    74             <if>
    78             <hlm:metadataCountSeverity severity="ERROR" log="@{compile.summary.file}"
    75                 <equals arg1="${compile.signal.input}" arg2="compileCleanSignalInput" />
    79                 database="${metadata.dbfile}"
    76                 <then>
    80                 property="build.errors.total"/>
    77                     <hlm:metadataCountSeverity severity="ERROR" log="@{compile.summary.file}"
       
    78                         db="${metadata.dbfile}"
       
    79                         countMissing="false"
       
    80                         property="build.errors.total"/>
       
    81                 </then>
       
    82                 <else>
       
    83                     <hlm:metadataCountSeverity severity="ERROR" log="@{compile.summary.file}"
       
    84                         db="${metadata.dbfile}"
       
    85                         property="build.errors.total"/>
       
    86                 </else>
       
    87             </if>
       
    88                 
    81                 
    89             <echo>Errors after compile-main: ${build.errors.total}</echo>
    82             <echo>Errors after compile-main: ${build.errors.total}</echo>
    90             <echo message="${build.errors.limit}" />
    83             <echo message="${build.errors.limit}" />
    91             <echo message="@{error.limit}" />
    84             <echo message="@{error.limit}" />
    92             <if>
    85             <if>
   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>