common/templates/source-spec.ant.xml.ftl
changeset 890 41f3579ef67e
parent 856 0e553fdaa218
child 892 24ecf67cba71
equal deleted inserted replaced
889:89a04d480b55 890:41f3579ef67e
    15 <#if ("${ant['sf.spec.sourcesync.bug419']}")?? && "${ant['sf.spec.sourcesync.bug419']}" == "true">
    15 <#if ("${ant['sf.spec.sourcesync.bug419']}")?? && "${ant['sf.spec.sourcesync.bug419']}" == "true">
    16   <#assign bug419 = true />
    16   <#assign bug419 = true />
    17 <#else>
    17 <#else>
    18   <#assign bug419 = false />
    18   <#assign bug419 = false />
    19 </#if>
    19 </#if>
    20 
       
    21     <!-- remove previous version of BOM file (if exists)  -->
       
    22     <target name="reset-bom-sources-csv">
       
    23         <delete file="${ant['build.drive']}/output/logs/BOM/sources.csv" quiet="true"/>
       
    24     </target>
       
    25 
    20 
    26 <#list data as csv_file>
    21 <#list data as csv_file>
    27   <#list csv_file as pkg_detail>
    22   <#list csv_file as pkg_detail>
    28     <target name="sf-prebuild-${count}">
    23     <target name="sf-prebuild-${count}">
    29         <sequential>
    24         <sequential>
    45                   <arg value="-r"/>
    40                   <arg value="-r"/>
    46                   <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
    41                   <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
    47                   <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    42                   <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    48               </exec>
    43               </exec>
    49             <#else>
    44             <#else>
    50             <exec executable="hg" dir="${ant['build.drive']}">
    45 	    <exec executable="hg" dir="${ant['build.drive']}/">
    51                 <arg value="clone"/>
    46                 <arg value="clone"/>
    52                 <arg value="-U"/>
    47                 <arg value="-U"/>
    53                 <arg value="${pkg_detail.source}"/>
    48                 <arg value="${pkg_detail.source}"/>
    54                 <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    49                 <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    55             </exec>
    50             </exec>
    89                 <arg value="-i"/>
    84                 <arg value="-i"/>
    90             </exec>
    85             </exec>
    91           </#if>  
    86           </#if>  
    92         </sequential>
    87         </sequential>
    93     </target>
    88     </target>
    94 
    89     
    95     <target name="sf-bom-info-${count}">
    90     <target name="sf-bom-info-${count}">
    96         <sequential>
    91         <!-- record info on source code repo/rev in BOM file  -->
    97             <!-- record info on source code repo/rev in BOM file  -->
    92         <echo file="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true" message="${pkg_detail.source},${pkg_detail.dst},changeset,${dollar}{sf.sourcesync.${count}.checksum},${pkg_detail.sysdef}${dollar}{line.separator}"/>
    98             <echo message="dir ${ant['build.drive']}${pkg_detail.dst} : ${dollar}{sf.sourcesync.${count}.checksum}"/>
       
    99             <exec executable="cmd" output="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true">
       
   100                 <arg value="/c"/>
       
   101                 <arg value="echo"/>
       
   102                 <arg value="${pkg_detail.source},${pkg_detail.dst},changeset,${dollar}{sf.sourcesync.${count}.checksum},${pkg_detail.sysdef}"/>
       
   103             </exec>
       
   104         </sequential>
       
   105     </target>
    93     </target>
   106 
    94     
   107     <target name="sf-bom-change-info-${count}">
    95     <target name="sf-bom-change-info-${count}">
   108         <sequential>
    96         <if><not><isset property="sf.sourcesync.${count}.checksum"/></not>
   109       		<if><not><isset property="sf.sourcesync.${count}.checksum"/></not>
    97             <then>
   110       			<then>
    98                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
   111               <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
    99                     <arg value="identify"/>
   112                 <arg value="identify"/>
   100                     <arg value="-i"/>
   113                 <arg value="-i"/>
   101                 </exec>
   114               </exec>
   102             </then>
   115       			</then>
   103         </if>
   116       		</if>
   104         <echo message="Writing BOM changes since ${dollar}{sf.previous.pdk.tag} for ${pkg_detail.dst}" />
   117       		  <echo message="Writing BOM changes since ${dollar}{sf.previous.pdk.tag} for ${pkg_detail.dst}" />
   105         <echo file="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true" message="${dollar}{line.separator}${pkg_detail.source}${dollar}{line.separator}${pkg_detail.dst}${dollar}{line.separator}${dollar}{line.separator}" />
   118       		  <echo file="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true" message="${dollar}{line.separator}${pkg_detail.source}${dollar}{line.separator}${pkg_detail.dst}${dollar}{line.separator}${dollar}{line.separator}" />
       
   119             <#if fast_sync > 
   106             <#if fast_sync > 
   120               <exec executable="hg" dir="${pkg_detail.source}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
   107               <exec executable="hg" dir="${pkg_detail.source}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
   121             <#else>      		  
   108             <#else>      		  
   122               <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
   109               <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" output="${ant['build.drive']}/output/logs/BOM/changes.txt" append="true">
   123             </#if>
   110             </#if>
   127                 <#if "${pkg_detail.type}"=="branch">
   114                 <#if "${pkg_detail.type}"=="branch">
   128                 <arg value="-b"/>
   115                 <arg value="-b"/>
   129                 <arg value="${pkg_detail.pattern}"/>
   116                 <arg value="${pkg_detail.pattern}"/>
   130                 </#if>    
   117                 </#if>    
   131             </exec>
   118             </exec>
   132           </sequential>
       
   133     </target>
   119     </target>
   134 
   120     
   135     <#assign fileset = "${fileset}" + "<fileset dir=\"${ant['build.drive']}${pkg_detail.dst}\" includes=\"${pkg_detail.sysdef}\"/>\r\n        " />       
   121     <#assign fileset = "${fileset}" + "<fileset dir=\"${ant['build.drive']}${pkg_detail.dst}\" includes=\"${pkg_detail.sysdef}\"/>\r\n        " />       
   136     <#assign sync_list = "${sync_list}" + "<runtarget target=\"sf-prebuild-${count}\"/>\r\n    "/>
   122     <#assign sync_list = "${sync_list}" + "<runtarget target=\"sf-prebuild-${count}\"/>\r\n            "/>
   137     <#assign bom_list = "${bom_list}" + "<runtarget target=\"sf-bom-info-${count}\"/>\r\n  "/>
   123     <#assign bom_list = "${bom_list}" + "<runtarget target=\"sf-bom-info-${count}\"/>\r\n        "/>
   138     <#assign change_list = "${change_list}" + "<runtarget target=\"sf-bom-change-info-${count}\"/>\r\n  "/>
   124     <#assign change_list = "${change_list}" + "<runtarget target=\"sf-bom-change-info-${count}\"/>\r\n        "/>
   139     <#assign count = count + 1 />
   125     <#assign count = count + 1 />
   140   </#list>
   126   </#list>
   141 </#list>
   127 </#list>
   142 
   128     
   143     <path id="system.definition.files">
   129     <path id="system.definition.files">
   144         <fileset dir="${dollar}{sf.common.config.dir}/sysdefs" includes="*.sysdef.xml"/>
   130         <fileset dir="${dollar}{sf.common.config.dir}/sysdefs" includes="*.sysdef.xml"/>
   145         ${fileset}
   131         ${fileset}
   146     </path>
   132     </path>
   147 
   133     
   148 <target name="all" depends="reset-bom-sources-csv">
   134     <target name="all">
   149   <parallel threadCount="${ant['env.NUMBER_OF_PROCESSORS']}">
   135         <parallel threadsPerProcessor="1">
   150     ${sync_list}
   136             ${sync_list}
   151   </parallel>
   137         </parallel>
   152 
   138         
   153   <echo message="Adding BOM header"/>
   139         <echo message="Adding BOM header"/>
   154       <mkdir dir="${ant['build.drive']}/output/logs/BOM/"/>
   140         <mkdir dir="${ant['build.drive']}/output/logs/BOM/"/>
   155       <exec executable="cmd" output="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true">
   141         <echo file="${ant['build.drive']}/output/logs/BOM/sources.csv" message="source,dst,type,pattern,sysdef${dollar}{line.separator}"/>
   156       <arg value="/c"/>
   142         
   157       <arg value="echo"/>
   143         ${bom_list}
   158       <arg value="source,dst,type,pattern,sysdef"/>
   144         
   159   </exec>
   145         <delete file="${ant['build.drive']}/output/logs/BOM/changes.txt" quiet="true"/>
   160   
   146         
   161   ${bom_list}
   147         ${change_list}
   162   <runtarget target="sf-bom-change-info" />
   148     </target>
   163 </target>
   149     
   164 
       
   165 <target name="sf-bom-change-info">
       
   166   <mkdir dir="${ant['build.drive']}/output/logs/BOM/"/>
       
   167   <delete file="${ant['build.drive']}/output/logs/BOM/changes.txt" quiet="true"/>
       
   168 
       
   169   ${change_list}
       
   170 </target>
       
   171 
       
   172 </project>
   150 </project>