buildframework/helium/tools/blocks/blocks.ant.xml
changeset 645 b8d81fa19e7d
equal deleted inserted replaced
643:27cf35f95864 645:b8d81fa19e7d
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : blocks.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 <!--* @package preparation -->
       
    24 <project name="blocks" xmlns:hlm="http://www.nokia.com/helium">
       
    25     <description>
       
    26         Blocks integration.
       
    27     </description>
       
    28         
       
    29     <!-- The directory where the blocks configuration will be generated.
       
    30     @type string
       
    31     -->
       
    32     <property name="blocks.config.dir" location="${build.output.dir}/blocks/config" />
       
    33     <!-- The directory where the bundles will be generated.
       
    34     @type string
       
    35     -->
       
    36     <property name="blocks.bundle.dir" location="${build.output.dir}/blocks/bundles" />
       
    37     <!-- The directory where the blocks metadata will be generated.
       
    38     @type string
       
    39     -->
       
    40     <property name="blocks.metadata.dir" location="${build.output.dir}/blocks/metadata" />
       
    41     <!-- Name of the writer to use while creating bundles.
       
    42     @type string
       
    43     -->
       
    44     <property name="blocks.writer" value="deb" />
       
    45     <!-- Number of workers to use while creating the bundles.
       
    46     @type string
       
    47     -->
       
    48     <property name="blocks.workers" value="4" />
       
    49     <!-- Location of the blocks log.
       
    50     @type string
       
    51     -->
       
    52     <property name="blocks.log.dir" location="${build.output.dir}/blocks/logs" />
       
    53     <!-- File extension of the blocks log.
       
    54     @type string
       
    55     -->
       
    56     <property name="blocks.log.extension" value="blocks.log" />
       
    57     <!-- Boolean attribute for the packager application to support generation of packages with inter-dependency. 
       
    58     @type boolean
       
    59     @scope public
       
    60     @deprecated Since 11.0
       
    61     -->
       
    62     <property name="blocks.interdeps.generation" value="false" />
       
    63     
       
    64     <!-- Boolean attribute for the packager application to support generation of packages with inter-dependency. 
       
    65     @type boolean
       
    66     @scope public
       
    67     -->
       
    68     <property name="blocks.interdeps.generation.enabled" value="false" />
       
    69     
       
    70     <!--* @property internal.blocks.interdeps.generation.enabled
       
    71     Internal property set if blocks.interdeps.generation.enabled set to true. 
       
    72     @type boolean
       
    73     @scope private
       
    74     @since 11.0
       
    75     -->
       
    76     
       
    77     <!--* @property blocks.enabled
       
    78     Set to true to enable blocks.
       
    79     @type boolean
       
    80     @editable required
       
    81     @scope public
       
    82     @since 11.0
       
    83     -->
       
    84     
       
    85     <!--* @property internal.blocks.enabled
       
    86     Internal property to run the targets if blocks.enabled property is set to true.
       
    87     @type boolean
       
    88     @scope private
       
    89     -->
       
    90     
       
    91     <!-- Check, is blocks enabled -->
       
    92     <condition property="internal.blocks.enabled">
       
    93         <istrue value="${blocks.enabled}"/>
       
    94     </condition>
       
    95     
       
    96     <hlm:metadatafilterset id="filterset.blocks.archiving">
       
    97         <metadatafilter priority="error" regex="^ERROR:.*" description="" />
       
    98         <metadatafilter priority="warning" regex="^WARNING:.*" description="" />
       
    99     </hlm:metadatafilterset>
       
   100         
       
   101     <!--
       
   102         This target will run the packager application using all configurations
       
   103         generated during the build under blocks.config.dir.
       
   104      -->
       
   105     <target name="blocks-create-bundles" if="internal.blocks.enabled">
       
   106         <mkdir dir="${blocks.config.dir}" />
       
   107         <mkdir dir="${blocks.bundle.dir}" />
       
   108         <mkdir dir="${blocks.metadata.dir}" />
       
   109         <mkdir dir="${blocks.log.dir}" />
       
   110         
       
   111         <condition property="arg.blocks.target.rules" value="--targetRules=${blocks.target.rules}" else="">
       
   112             <isset property="blocks.target.rules" />
       
   113         </condition>
       
   114         
       
   115         <condition property="arg.blocks.source.rules" value="--sourceRules=${blocks.source.rules}" else="">
       
   116             <isset property="blocks.source.rules" />
       
   117         </condition>
       
   118         
       
   119         <condition property="arg.blocks.package.directives" value="--pkgDirectives=${blocks.package.directives}" else="">
       
   120             <isset property="blocks.package.directives" />
       
   121         </condition>
       
   122         
       
   123         <condition property="internal.blocks.interdeps.generation.enabled" value="true" else="false">
       
   124             <or>
       
   125                 <istrue value="${blocks.interdeps.generation.enabled}"/>
       
   126                 <istrue value="${blocks.interdeps.generation}"/>
       
   127             </or>
       
   128         </condition>
       
   129         
       
   130         <exec executable="python" failonerror="false" output="${blocks.log.dir}/${build.id}_blocks_archiving.${blocks.log.extension}">
       
   131             <arg value="-m"/>
       
   132             <arg value="packager.cli"/>
       
   133             <arg value="--epocroot=${build.drive}/" />
       
   134             <arg value="--config=${blocks.config.dir}" />
       
   135             <arg value="--outputdir=${blocks.bundle.dir}" />
       
   136             <arg value="--metadatadir=${blocks.metadata.dir}" />
       
   137             <arg value="--workers=${blocks.workers}" />
       
   138             <arg value="--writer=${blocks.writer}" />
       
   139             <arg line="${arg.blocks.target.rules}" />
       
   140             <arg line="${arg.blocks.source.rules}" />
       
   141             <arg line="${arg.blocks.package.directives}" />
       
   142             <arg value="--createBundle" />
       
   143             <arg value="--debug" />
       
   144             <arg value="--interdeps=${internal.blocks.interdeps.generation.enabled}" />
       
   145         </exec>
       
   146         <hlm:metadatarecord database="${metadata.dbfile}">
       
   147             <hlm:textmetadatainput>
       
   148                 <fileset casesensitive="false" file= "${blocks.log.dir}/${build.id}_blocks_archiving.${blocks.log.extension}"/>
       
   149                 <metadatafilterset refid="filterset.blocks.archiving" />
       
   150             </hlm:textmetadatainput>
       
   151         </hlm:metadatarecord>
       
   152         <hlm:blocksCreateRepositoryIndex dest="${blocks.bundle.dir}" verbose="true" failonerror="false" />
       
   153     </target>
       
   154     
       
   155     <!--* @property blocks.workspace.id
       
   156      The blocks.workspace.id gets defined by the blocks-create-workspace target while reusing or
       
   157       creating a new workspace.     
       
   158      @scope public
       
   159      @since 12.0.0
       
   160      -->
       
   161     
       
   162     <!--
       
   163      The blocks-create-workspace will try to reuse existing workspace mapped on "${build.drive}/", or
       
   164      create a new one if none exists.
       
   165      
       
   166      If a new workspace is created then repositories from blocks.repositories.id blocksRespositorySet
       
   167      will be added to the newly created workspace.
       
   168      
       
   169      @scope public
       
   170      @since 12.0.0
       
   171      -->
       
   172     <target name="blocks-create-workspace" if="internal.blocks.enabled">
       
   173         <if>
       
   174             <hlm:blocksWorkspaceExists dir="${build.drive}/" verbose="true" />
       
   175             <then>
       
   176                 <echo>Reusing current workspace.</echo>
       
   177                 <hlm:blocksGetWorkspaceId wsidoutput="blocks.workspace.id" dir="${build.drive}/" verbose="true" /> 
       
   178             </then>
       
   179             <else>
       
   180                 <echo>Creating new workspace under ${build.drive}${file.separator}.</echo>
       
   181                 <hlm:blocksAddWorkspace name="${build.family}" dir="${build.drive}/" wsidproperty="blocks.workspace.id"  verbose="true" />
       
   182                 <if>
       
   183                     <and>
       
   184                         <not>
       
   185                             <hlm:blocksRepositoryExists wsid="${blocks.workspace.id}" verbose="true"/>
       
   186                         </not>
       
   187                         <isreference refid="blocks.repositories.id" />
       
   188                     </and>
       
   189                     <then>
       
   190                         <echo>Creating new repsoitory for workspace ID ${blocks.workspace.id}.</echo>
       
   191                         <hlm:blocksAddRepository wsid="${blocks.workspace.id}">
       
   192                             <repositorySet refid="blocks.repositories.id" />
       
   193                         </hlm:blocksAddRepository>
       
   194                     </then>
       
   195                     <else>
       
   196                         <echo level="warning">'blocks.repositories.id' reference doesn't exist/repository already exists.</echo>
       
   197                     </else>
       
   198                 </if>
       
   199             </else>
       
   200         </if>
       
   201     </target>
       
   202 
       
   203     <!--
       
   204      The blocks-install-bundles will install bundles on the workspace under build.drive.
       
   205      @scope public
       
   206      @since 12.0.0
       
   207      -->
       
   208     <target name="blocks-install-bundles" if="internal.blocks.enabled" depends="blocks-create-workspace">
       
   209         <if>
       
   210             <isreference refid="blocks.bundle.filters.id" />
       
   211             <then>
       
   212                 <hlm:blocksInstallBundle wsid="${blocks.workspace.id}" verbose="true">
       
   213                     <hlm:bundleFilterSet refid="blocks.bundle.filters.id" />
       
   214                 </hlm:blocksInstallBundle>
       
   215             </then>
       
   216             <else>
       
   217                 <echo level="warning">Nothing to do, blocks.bundle.filters.id reference doesn't exist.</echo>
       
   218             </else>
       
   219         </if>
       
   220         <if>
       
   221             <isreference refid="blocks.group.filters.id" />
       
   222             <then>
       
   223                 <hlm:blocksInstallBundle wsid="${blocks.workspace.id}" verbose="true">
       
   224                     <hlm:groupFilterSet refid="blocks.group.filters.id" />
       
   225                 </hlm:blocksInstallBundle>
       
   226             </then>
       
   227             <else>
       
   228                 <echo level="warning">Nothing to do, blocks.group.filters.id reference doesn't exist.</echo>
       
   229             </else>
       
   230         </if>
       
   231     </target>
       
   232 
       
   233     <!--
       
   234      The blocks-update-bundles will update the workspace under build.drive.
       
   235      @scope public
       
   236      @since 12.0.0
       
   237      -->
       
   238     <target name="blocks-update-bundles" if="internal.blocks.enabled" depends="blocks-create-workspace">
       
   239         <hlm:blocksUpdate wsid="${blocks.workspace.id}" />
       
   240     </target>
       
   241 
       
   242     <!--
       
   243      The blocks-add-repo will update the current workspace using repositories defined by the
       
   244      blocks.repositories.id reference.
       
   245      
       
   246      @scope public
       
   247      @since 12.0.0
       
   248      -->
       
   249     <target name="blocks-add-repo" if="internal.blocks.enabled" depends="blocks-create-workspace">
       
   250         <if>
       
   251             <and>
       
   252                 <not>
       
   253                     <hlm:blocksRepositoryExists wsid="${blocks.workspace.id}" verbose="true"/>
       
   254                 </not>
       
   255                 <isreference refid="blocks.repositories.id" />
       
   256             </and>
       
   257             <then>
       
   258                 <hlm:blocksAddRepository wsid="${blocks.workspace.id}">
       
   259                     <repositorySet refid="blocks.repositories.id" />
       
   260                 </hlm:blocksAddRepository>
       
   261             </then>
       
   262             <else>
       
   263                 <echo level="warning">'blocks.repositories.id' reference doesn't exist/repository already exists.</echo>
       
   264             </else>
       
   265         </if>
       
   266     </target>
       
   267 </project>