common/templates/source-spec.ant.xml.ftl
changeset 312 97c01977a87b
parent 261 a0e85954c23c
child 584 920441a385c6
equal deleted inserted replaced
311:7d60f71b6a78 312:97c01977a87b
     4 <#assign fileset = "" />
     4 <#assign fileset = "" />
     5 <#assign sync_list = "" />
     5 <#assign sync_list = "" />
     6 <#assign bom_list  = "" />
     6 <#assign bom_list  = "" />
     7 <#assign dollar = "$"/>
     7 <#assign dollar = "$"/>
     8 <#assign count = 0 />
     8 <#assign count = 0 />
       
     9 
       
    10 <#if ("${ant['sf.spec.sourcesync.archive']}")??>
       
    11   <#if "${ant['sf.spec.sourcesync.archive']}" == "true">
       
    12     <#assign fast_sync = true />
       
    13   <#else>
       
    14     <#assign fast_sync = false />
       
    15   </#if>
       
    16 <#else>
       
    17   <#assign fast_sync = false />
       
    18 </#if>
     9 
    19 
    10     <!-- remove previous version of BOM file (if exists)  -->
    20     <!-- remove previous version of BOM file (if exists)  -->
    11     <target name="reset-bom-sources-csv">
    21     <target name="reset-bom-sources-csv">
    12         <delete file="${ant['build.drive']}/output/logs/BOM/sources.csv" quiet="true"/>
    22         <delete file="${ant['build.drive']}/output/logs/BOM/sources.csv" quiet="true"/>
    13     </target>
    23     </target>
    17         <#if (count > 0) >
    27         <#if (count > 0) >
    18             <#assign fileset = "${fileset}"  />
    28             <#assign fileset = "${fileset}"  />
    19         </#if>
    29         </#if>
    20         <sequential>
    30         <sequential>
    21             <!-- create sf\layer dir  -->
    31             <!-- create sf\layer dir  -->
    22             <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false"/>
       
    23             <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
    32             <mkdir dir="${ant['build.drive']}${pkg_detail.dst}"/>
    24             <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false"/>
    33             <delete dir="${ant['build.drive']}${pkg_detail.dst}" failonerror="false" />
    25 
    34             <!-- Don't use hg archive with tags, as we can have wildcards in the tags... -->
       
    35             <#if fast_sync && ("${pkg_detail.type}"!="tag") > 
       
    36               <!-- Identify the version on the cache first -->
       
    37               <exec executable="hg" dir="${pkg_detail.source}" outputproperty="sf.sourcesync.${count}.checksum">
       
    38                   <arg value="identify"/>
       
    39                   <arg value="-i"/>
       
    40                   <arg value="-r"/>
       
    41                   <arg value="${pkg_detail.pattern}"/>
       
    42               </exec>
       
    43               <!-- hg archive on the version we found -->
       
    44               <exec executable="hg" dir="${pkg_detail.source}">
       
    45                   <arg value="archive"/>
       
    46                   <arg value="-r"/>
       
    47                   <arg value="${dollar}{sf.sourcesync.${count}.checksum}"/>
       
    48                   <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
       
    49               </exec>
       
    50             <#else>
    26             <exec executable="hg" dir="${ant['build.drive']}">
    51             <exec executable="hg" dir="${ant['build.drive']}">
    27                 <arg value="clone"/>
    52                 <arg value="clone"/>
    28                 <arg value="-U"/>
    53                 <arg value="-U"/>
    29                 <arg value="${pkg_detail.source}"/>
    54                 <arg value="${pkg_detail.source}"/>
    30                 <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    55                 <arg value="${ant['build.drive']}${pkg_detail.dst}"/>
    31             </exec>
    56             </exec>
    32 
    57             
    33             <hlm:scm verbose="true" scmUrl="scm:hg:${pkg_detail.source}">
    58             <hlm:scm verbose="true" scmUrl="scm:hg:${pkg_detail.source}">
    34                 <!--hlm:checkout basedir="${ant['build.drive']}${pkg_detail.dst}"/-->
    59                 <!--hlm:checkout basedir="${ant['build.drive']}${pkg_detail.dst}"/-->
    35                 <#if "${pkg_detail.type}"=="tag" >
    60                 <#if "${pkg_detail.type}"=="tag" >
    36                 <hlm:tags basedir="${ant['build.drive']}${pkg_detail.dst}" reference="hg.tags.id${dollar}{refid}"/>
    61                 <hlm:tags basedir="${ant['build.drive']}${pkg_detail.dst}" reference="hg.tags.id${dollar}{refid}"/>
    37                 <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
    62                 <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
    44                 <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
    69                 <hlm:update basedir="${ant['build.drive']}${pkg_detail.dst}">
    45                      <hlm:tag name="${pkg_detail.pattern}"/>
    70                      <hlm:tag name="${pkg_detail.pattern}"/>
    46                 </hlm:update>
    71                 </hlm:update>
    47                 </#if>
    72                 </#if>
    48             </hlm:scm>
    73             </hlm:scm>
       
    74                 <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
       
    75                 <arg value="identify"/>
       
    76                 <arg value="-i"/>
       
    77             </exec>
       
    78           </#if>  
    49         </sequential>
    79         </sequential>
    50     </target>
    80     </target>
    51 
    81 
    52     <target name="sf-bom-info-${count}">
    82     <target name="sf-bom-info-${count}">
    53 
    83 
    54         <sequential>
    84         <sequential>
    55             
       
    56             <!-- record info on source code repo/rev in BOM file  -->
    85             <!-- record info on source code repo/rev in BOM file  -->
    57             <exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="sf.sourcesync.${count}.checksum">
       
    58                 <arg value="identify"/>
       
    59                 <arg value="-i"/>
       
    60             </exec>
       
    61             <echo message="dir ${ant['build.drive']}${pkg_detail.dst} : ${dollar}{sf.sourcesync.${count}.checksum}"/>
    86             <echo message="dir ${ant['build.drive']}${pkg_detail.dst} : ${dollar}{sf.sourcesync.${count}.checksum}"/>
    62             <exec executable="cmd" output="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true">
    87             <exec executable="cmd" output="${ant['build.drive']}/output/logs/BOM/sources.csv" append="true">
    63                 <arg value="/c"/>
    88                 <arg value="/c"/>
    64                 <arg value="echo"/>
    89                 <arg value="echo"/>
    65                 <arg value="${pkg_detail.source},${pkg_detail.dst},changeset,${dollar}{sf.sourcesync.${count}.checksum},${pkg_detail.sysdef}"/>
    90                 <arg value="${pkg_detail.source},${pkg_detail.dst},changeset,${dollar}{sf.sourcesync.${count}.checksum},${pkg_detail.sysdef}"/>