build/utilities.xml
branchRCL_3
changeset 19 04becd199f91
child 23 98ccebc37403
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 <!--
       
     2 #
       
     3 # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 # All rights reserved.
       
     5 # This component and the accompanying materials are made available
       
     6 # under the terms of "Eclipse Public License v1.0"
       
     7 # which accompanies this distribution, and is available
       
     8 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 #
       
    10 # Initial Contributors:
       
    11 # Nokia Corporation - initial contribution.
       
    12 #
       
    13 # Contributors:
       
    14 #
       
    15 # Description: 
       
    16 #
       
    17 -->
       
    18 
       
    19 <project name="Utilities">
       
    20 
       
    21 <!--
       
    22   This file contains common utilities for each build.xml file.
       
    23   Following properties are mandatory for a basic build process. Most of the
       
    24   APIs can use default values, but if some property is not suitable, it can
       
    25   be overridden.
       
    26 
       
    27     java.src.paths    The source path. If there are more than one source path 
       
    28                       concatenate the paths using ':' as separator. Default is
       
    29                       '../javasrc
       
    30 
       
    31     java.src.second.paths    The source path for the second phase compilation. 
       
    32                       If there are more than one source path concatenate the 
       
    33                       paths using ':' as separator. Default is '../javasrc.cdc
       
    34 
       
    35     bootclasspath     The bootclasspath used for compile time. Default is CLDC
       
    36 
       
    37     bootclasspath.second     The bootclasspath used for the second phase 
       
    38                       compilation.. Default is CDC
       
    39 
       
    40     native.dll.name   The name of the dll (without extension) which will 
       
    41                       contain the rommized byte code. The default value is the 
       
    42                       name of the ant project.
       
    43   
       
    44   
       
    45   Following properties are optionals:
       
    46 
       
    47     javah.classnames        A list of classes using ',' as separator to be 
       
    48                             "javah"ed.
       
    49 
       
    50 -->
       
    51 
       
    52 
       
    53   <import file="properties.xml"/>
       
    54 
       
    55   
       
    56   <!--Importing platform specific utilities. This might seem quite complex,
       
    57       since we need to import a default one (utilities.fake.xml), because
       
    58       the property ${platform.utilities.xml.file} need to have some meaningful
       
    59       value when the utilities.xml is used for the first time. The default one 
       
    60       isn't used at all, instead the platform dependent xml file is defined 
       
    61       using additional antcall after the dynamic properties have been defined.
       
    62       See targets deploy and deploy.dual-->
       
    63   <import file="${platform.utilities.xml.file}"/>
       
    64 
       
    65 
       
    66   <!-- Importing emma utilities for Java code coverage measurement. -->
       
    67   <import file="emmautilities.xml"/>
       
    68 
       
    69 
       
    70 
       
    71 
       
    72 
       
    73 
       
    74 
       
    75 
       
    76 
       
    77 
       
    78 <!--STARTING POINTS START-->
       
    79 
       
    80   <!--The start point of the component's build when there are classes that can
       
    81       be compiled against same configuration (cldc, cdc, etc). This is the 
       
    82       normal case for the most of the components-->
       
    83   <target name="deploy" depends="init.properties, make.target.dirs">
       
    84     <antcall target="deploy.internal">
       
    85       <param name="platform.utilities.xml.file" 
       
    86              value="${dyn.platform.utilities.xml.file}"/>
       
    87     </antcall>
       
    88   </target>
       
    89 
       
    90   <!--The start point of the component's build when there are classes from two
       
    91       different configurations (cldc, cdc, etc). The default order is that cldc
       
    92       is compiled in first phase and cdc in the second, but the component is 
       
    93       able to variate the behavior.
       
    94   -->
       
    95   <target name="deploy.dual" depends="init.properties, make.target.dirs">
       
    96     <antcall target="deploy.dual.internal">
       
    97       <param name="platform.utilities.xml.file" value="${dyn.platform.utilities.xml.file}"/>
       
    98     </antcall>
       
    99   </target>
       
   100 
       
   101 <!--STARTING POINTS END-->
       
   102 
       
   103 
       
   104 
       
   105 
       
   106 
       
   107 
       
   108 
       
   109 
       
   110 
       
   111 
       
   112 
       
   113 <!--TARGETS FOR THE FIRST PHASE COMPILATION START-->
       
   114 
       
   115 
       
   116   <!--An internal target to be called using antcall in order to import correct
       
   117       platform specific helper xml file for the first phase compilation. 
       
   118       This targe assumes that the antcall to this target (or target that 
       
   119       depends on this) defines following property:
       
   120          * platform.utilities.xml.file   A file containg platform specific 
       
   121                                          implementations of certain common
       
   122                                          targets
       
   123   -->
       
   124   <target name="deploy.internal" depends="do.export, deploy.first, finalize">
       
   125   </target>
       
   126 
       
   127 
       
   128   <!--Target that launches the first phase compilation. After this target
       
   129       classes are compiled into classes/first directory, copied to 
       
   130       classes/collection directory, finetuned (platform specific) and
       
   131       copied into jar containig all the classes of the different components.-->
       
   132   <target name="deploy.first" depends="do.export">
       
   133 
       
   134     <!--If the platform specific directory exists, it is added to the 
       
   135         source path -->
       
   136     <condition property="additional.java.src.path.first"
       
   137                value=";${javasrc.platform.specific}"
       
   138                else="">
       
   139       <isset property="javasrc.platform.specific.present" />
       
   140     </condition>
       
   141 
       
   142     <!--Start the job described above using antcall -->
       
   143     <antcall target="do.java.compile">
       
   144       <param name="compile.target" value="compile"/>
       
   145       <param name="int.bcp" value=""/>
       
   146       <param name="bcp" value="${bootclasspath}"/>
       
   147       <param name="jsrc" 
       
   148              value="${java.src.paths}${additional.java.src.path.first}"/>
       
   149       <param name="dst.dir" value="${classes.first.dir}"/>
       
   150     </antcall>
       
   151   </target>
       
   152 
       
   153 <!--TARGETS FOR THE FIRST PHASE COMPILATION END-->
       
   154 
       
   155 
       
   156 
       
   157 
       
   158 
       
   159 
       
   160 
       
   161 
       
   162 <!--TARGETS FOR THE SECOND PHASE COMPILATION START-->
       
   163 
       
   164   <!--An internal target for the second phase compilation. Look for the
       
   165       description of the target 'deploy.internal'.
       
   166   -->
       
   167   <target name="deploy.dual.internal" depends="deploy.second, finalize">
       
   168   </target>
       
   169 
       
   170   <!--Target that launches the second phase compilation. After this target
       
   171       classes are compiled into classes/second directory, copied to 
       
   172       classes/collection directory, finetuned (platform specific) and
       
   173       copied into jar containig all the classes of the different components.-->
       
   174   <target name="deploy.second" depends="deploy.first, init.second.phase">
       
   175 
       
   176     <!--If the platform specific cdc directory exists, it is added to the 
       
   177         source path -->
       
   178     <condition property="additional.java.src.path.second"
       
   179                value=";${javasrc.platform.specific.cdc}"
       
   180                else="">
       
   181       <isset property="javasrc.platform.specific.cdc.present" />
       
   182     </condition>
       
   183 
       
   184     <!--Start the job described above using antcall -->
       
   185     <antcall target="do.java.compile">
       
   186       <param name="compile.target" value="compile.second"/>
       
   187       <param name="int.bcp" value="${classes.first.dir}"/>
       
   188       <param name="bcp" value="${bootclasspath.second}"/>
       
   189       <param name="jsrc" 
       
   190            value="${java.src.second.paths}${additional.java.src.path.second}"/>
       
   191       <param name="dst.dir" value="${classes.second.dir}"/>
       
   192     </antcall>
       
   193   </target>
       
   194 
       
   195 <!--TARGETS FOR THE SECOND PHASE COMPILATION END-->
       
   196 
       
   197 
       
   198 
       
   199 
       
   200 
       
   201 
       
   202 
       
   203 <!--COMPILE AND FINALIZE START-->
       
   204 
       
   205   <!--This target compiles the java code, finetunes the classes in
       
   206       platform specific way (if exists) and adds the classes into
       
   207       collection jar file. The target is meant to be called using
       
   208       <antcall> which must define following properties:
       
   209         *compile.target   Target to be used doing the 'javac'
       
   210         *bcp              The bootclasspath for the 'javac'
       
   211         *jsrc             A list of dir(s) containing the Java files.
       
   212         *dst.dir          A directory where to put the resulted classes.
       
   213         *int.bcp          An internal additional bootclasspath. This is used
       
   214                           in the second phase of the dual compilation for
       
   215                           adding the classes compiled in the first phase
       
   216                           into bootclasspath of the 'javac'
       
   217     -->
       
   218   <target name="do.java.compile" depends="do.java.preprocessing">
       
   219     <!--If the pre-processing is done change the java source to point
       
   220         to preprocessed sources.-->
       
   221     <condition property="jsrc.for.javac"
       
   222                value="${java.cpp.tmp.dir}"
       
   223                else="${jsrc}">
       
   224       <isset property="java.cpp.tmp.dir" />
       
   225     </condition>
       
   226 
       
   227     <ant target="${compile.target}"/>
       
   228     <ant target="finetune.classes"/>
       
   229     <ant target="emma.instr"/>
       
   230     <ant target="add.classes.to.collection.jar"/>
       
   231     <ant target="collect.localisation.files"/>
       
   232     
       
   233     <!--Copy only changed classes into collection dir -->
       
   234     <copy todir="${classes.collection.dir}">
       
   235       <fileset dir="${dst.dir}" includes="**/*.class">
       
   236         <depend targetdir="${classes.collection.dir}"/>
       
   237       </fileset>
       
   238     </copy>
       
   239   </target>
       
   240 
       
   241 
       
   242   <!--Target that does the pre rpocessing of the java code. This is not done
       
   243       by default - it is done only if property java.cpp.defines has been
       
   244       defined by the component. Java source files are pre processed into 
       
   245       component's classes/firstjavacpp (or classes/secondjavacpp in case of
       
   246        second phase compilation) directory
       
   247   -->
       
   248   <target name="do.java.preprocessing" if="java.cpp.defines">
       
   249     <property name="java.cpp.tmp.dir" location="${dst.dir}javacpp"/>
       
   250     <mkdir dir="${java.cpp.tmp.dir}"/>
       
   251     <exec executable="python" failonerror="true">
       
   252       <arg value="${java.src.root}/build/buildutils/javacpp.py"/>
       
   253       <arg value="${jsrc}"/>
       
   254       <arg value="${java.cpp.tmp.dir}"/>
       
   255     </exec>
       
   256     
       
   257   </target>
       
   258 
       
   259   <!--Groups a set of functionalities that are done after java code has
       
   260       been compiled ad finetuned -->
       
   261   <target name="finalize" depends="create.internal.api.jar, 
       
   262                                    create.public.api.jar, javah, generate.odc,
       
   263                                    rommize.classes, jni.utils">
       
   264   </target>
       
   265 
       
   266 <!--COMPILE AND FINALIZE END-->
       
   267 
       
   268 
       
   269 
       
   270 
       
   271 
       
   272 
       
   273 
       
   274 
       
   275 <!--INITIALIZATIONS START-->
       
   276 
       
   277   <!--Creates target directories -->
       
   278   <target name="make.target.dirs">
       
   279     <mkdir dir="${classes.collection.dir}"/>
       
   280     <mkdir dir="${classes.first.dir}"/>
       
   281     <mkdir dir="${temp.javah.dir}"/>
       
   282     <mkdir dir="${javah.dir}"/>
       
   283     <mkdir dir="${jar.destination.root}"/>
       
   284   </target>
       
   285 
       
   286   <!--Creates target directories when dual phase compilation is
       
   287       used. In normal case this is not used.-->
       
   288   <target name="init.second.phase">
       
   289     <property name="second.phase.compilation" value="true"/>
       
   290     <mkdir dir="${classes.second.dir}"/>
       
   291   </target>
       
   292 
       
   293   <!--Target for making component specific initalizations depending on
       
   294       the values of dynamic properties (e.g. Target platform).
       
   295       The default implementation of this target is empty and the component 
       
   296       should override this if it provides public APIs -->
       
   297   <target name="init.target">
       
   298   </target>
       
   299 
       
   300 <!--INITIALIZATIONS END-->
       
   301 
       
   302 
       
   303 
       
   304 
       
   305 <!--JAVAC START-->
       
   306 
       
   307   <!--Javac 
       
   308        TODO: bootclasspath should look like this:
       
   309       bootclasspath="${bcp}:${int.bcp}:${platform.api.jar}:${public.api.jar}">
       
   310   -->
       
   311   <presetdef name="omj.javac">
       
   312     <javac 
       
   313       source="${javac.source}" 
       
   314       target="${javac.target}"
       
   315       destdir="${dst.dir}"
       
   316       debug="${javac.debug.on}"
       
   317       debuglevel="lines,vars,source"
       
   318       bootclasspath="${bcp}:${int.bcp}:${platform.api.jar}:${public.api.jar}${eswt.jar}">
       
   319       <src path="${jsrc.for.javac}"/>
       
   320     </javac>
       
   321   </presetdef>
       
   322 
       
   323   <!--Do the first Java compilation. May be overridden-->
       
   324   <target name="compile">
       
   325     <omj.javac/>
       
   326   </target>
       
   327 
       
   328   <!--Do the second Java compilation. May be overridden-->
       
   329   <target name="compile.second">
       
   330     <omj.javac/>
       
   331   </target>
       
   332 
       
   333 <!--JAVAC END-->
       
   334 
       
   335 
       
   336 
       
   337 
       
   338 
       
   339 <!--SYSTEM PROPERTIES START-->
       
   340 
       
   341   <!--Default empty target for the system properties. If the componen wants
       
   342       to publish some system properties, it must override this target. Example:
       
   343       <target name="system.properties">
       
   344           <properties>
       
   345               microedtion.locale=Fi-fi
       
   346               microedtion.encoding=utf-8
       
   347           </properties>
       
   348       </target>
       
   349   -->
       
   350   <target name="system.properties">
       
   351   </target>
       
   352 
       
   353   <!--Used in overridable target 'system.properties' to list the properties
       
   354       into component's properties.txt file-->
       
   355   <presetdef name="properties">
       
   356       <echo file="${component.root.dir}/properties.txt">
       
   357       </echo>
       
   358   </presetdef>
       
   359 
       
   360 <!--SYSTEM PROPERTIES END-->
       
   361 
       
   362 
       
   363 
       
   364 
       
   365 
       
   366 <!--ODC FILE START-->
       
   367 
       
   368   <!--Generate the odc files -->
       
   369   <target name="generate.odc" depends="system.properties">
       
   370     <exec executable="python" failonerror="true">
       
   371       <arg value="${java.src.root}/build/buildutils/generateOdcFile.py"/>
       
   372       <arg value="${component.root.dir}/${odc.file.name}.odc"/>
       
   373       <arg value="${native.dll.name}"/>
       
   374       <arg value="${classes.collection.dir}"/>
       
   375       <arg value="${component.root.dir}/properties.txt"/>
       
   376     </exec>
       
   377 
       
   378     <!--Copy the odc file into location where the VM can find it -->
       
   379     <copy file="${component.root.dir}/${odc.file.name}.odc" 
       
   380           todir="${bcp.dest.directory}"/>
       
   381   </target>
       
   382 
       
   383 <!--ODC FILE END-->
       
   384 
       
   385 
       
   386 
       
   387 <!--INTERNAL, PUBLIC AND COLLECTION JAR FILE GENERATION START-->
       
   388 
       
   389   <presetdef name="omj.internal.apis">
       
   390      <jar destfile="${platform.api.jar}"
       
   391            basedir="${classes.collection.dir}"
       
   392            update="true"/>
       
   393   </presetdef>
       
   394 
       
   395   <!--Create an internal API jar file into directory containig all the 
       
   396       internal API jar files. The default implementation of this target is 
       
   397       empty and the component should override this if it provides internal 
       
   398       APIs -->
       
   399   <target name="create.internal.api.jar">
       
   400   </target>
       
   401 
       
   402   <!--Public APIs -->
       
   403   <presetdef name="omj.public.apis">
       
   404      <jar destfile="${public.api.jar}"
       
   405            basedir="${classes.collection.dir}"
       
   406            update="true"
       
   407       />
       
   408   </presetdef>
       
   409 
       
   410   <!--Create a public API jar file into directory containig all the 
       
   411       public API jar files. The default implementation of this target is 
       
   412       empty and the component should override this if it provides public 
       
   413       APIs -->
       
   414   <target name="create.public.api.jar">
       
   415   </target>
       
   416 
       
   417   <!--Updated the classes into the common jar file. If the Java code contains
       
   418       cldc compilable code it is put into jar file ${impl.cldc.jar} otherwise
       
   419       ${impl.cdc.jar} is updated.-->
       
   420   <target name="add.classes.to.collection.jar">
       
   421       <condition property="collection.target.jar"
       
   422                value="${impl.cdc.jar}"
       
   423                else="${impl.cldc.jar}">
       
   424         <equals arg1="${bcp}" arg2="${bootclasspath.cdc}"/>
       
   425       </condition>
       
   426 
       
   427       <jar destfile="${collection.target.jar}"
       
   428            basedir="${dst.dir}"
       
   429            update="true"
       
   430       />
       
   431   </target>
       
   432 
       
   433 <!--INTERNAL, PUBLIC AND COLLECTION JAR FILE GENERATION END-->
       
   434 
       
   435 
       
   436 
       
   437 
       
   438 <!--JAVAH START-->
       
   439 
       
   440 
       
   441   <!--Run the javah if needed. Javah results goes to temp directory and
       
   442       if they have changed, then they are copied into a directory that
       
   443       is included to the component's makefile -->
       
   444   <target name="javah" if="javah.classnames">
       
   445     <javah destdir="${temp.javah.dir}" force="yes" 
       
   446        classpath="${classes.collection.dir}:${platform.api.jar}:${public.api.jar}"
       
   447        class = "${javah.classnames}">
       
   448     </javah>
       
   449     <!--Copy the files if they are changed-->
       
   450     <copy todir="${javah.dir}">
       
   451       <fileset dir="${temp.javah.dir}" includes="*.h" casesensitive="false">
       
   452           <different targetdir="${javah.dir}"
       
   453                      ignoreFileTimes="true"/>
       
   454       </fileset>
       
   455     </copy>
       
   456   </target>
       
   457 
       
   458 <!--JAVAH END-->
       
   459 
       
   460 
       
   461 
       
   462 <!--EXPORT START-->
       
   463   <!--Start the do.export using antcall. The usage of ant call is needed
       
   464       in order to include platform specific utility xml file.-->
       
   465   <target name="export" depends="init.properties, make.target.dirs">
       
   466     <antcall target="do.export">
       
   467       <param name="platform.utilities.xml.file" 
       
   468              value="${dyn.platform.utilities.xml.file}"/>
       
   469     </antcall>
       
   470   </target>
       
   471 <!--EXPORT START-->
       
   472 
       
   473 
       
   474 
       
   475 
       
   476 <!--RELEASEABLES FOR S60 START-->
       
   477 
       
   478   <!--The common releasables-->
       
   479   <target name="common.releasables" depends="init.properties">
       
   480     <echo file="${java.src.root}/build/java_releasables_${target.platform}_${target.cfg}.tmp" append="false">${platform.api.jar}
       
   481 ${public.api.jar}
       
   482 ${impl.cldc.jar}
       
   483 ${impl.cdc.jar}
       
   484 ${signature.jar}
       
   485 </echo>
       
   486   </target>
       
   487 
       
   488 
       
   489   <!--The only releasable in S60 is the odc file-->
       
   490   <target name="s60releasables" if="target.s60">
       
   491     <echo file="java_releasables_${target.platform}_${target.cfg}.tmp" append="false">${bcp.dest.directory}\${odc.file.name}.odc
       
   492 </echo>
       
   493   </target>
       
   494 
       
   495   <!--The start point for releasables-->
       
   496   <target name="releasables" depends="init.properties, s60releasables">
       
   497   </target>
       
   498 <!--RELEASEABLES FOR S60 END-->
       
   499 
       
   500 
       
   501 <!--LOCALISATION START-->
       
   502   <target name="collect.localisation.files" depends="init.properties"
       
   503           if="localisation.file.base">
       
   504     <zip destfile="${resource.jar}" update="true" filesonly="true">
       
   505       <!-- Original localisation file -->
       
   506       <zipfileset dir="../loc" prefix="resources/com/nokia/mj/impl"
       
   507                   includes="${localisation.file.base}.loc"/>
       
   508     </zip>
       
   509   </target>
       
   510 
       
   511 
       
   512 <!--LOCALISATION END-->
       
   513 
       
   514 
       
   515 
       
   516 <!--CLEANING START-->
       
   517   <!--Do the cleaning-->
       
   518   <target name="clean" depends="init.properties, emma.clean">
       
   519     <!--
       
   520     <echo message = "target.platform = ${target.platform}"/>
       
   521     <echo message = "target.cfg = ${target.cfg}"/>
       
   522     <echo message = "bootclasspath = ${bootclasspath}"/>
       
   523     -->
       
   524 
       
   525     <echo message=""/>
       
   526     <!--Clean the javah results from inc.javah-->
       
   527     <delete>
       
   528       <fileset dir="${javah.dir}" includes="*.h">
       
   529           <present present="both" targetdir="${temp.javah.dir}"/>
       
   530       </fileset>
       
   531     </delete>
       
   532 
       
   533     <delete dir="${component.root.dir}"/>
       
   534     <delete file="${bcp.dest.directory}/${jar.filename}"/>
       
   535     <delete file="${bcp.dest.directory}/${odc.file.name}.odc"/>
       
   536   </target>
       
   537 
       
   538 
       
   539   <!--Do the cleaning-->
       
   540   <target name="clean.api.jars" depends="init.properties">
       
   541     <delete file="${platform.api.jar}"/>
       
   542     <delete file="${public.api.jar}"/>
       
   543     <delete file="${impl.cldc.jar}"/>
       
   544     <delete file="${impl.cdc.jar}"/>
       
   545     <delete file="${signature.jar}"/>
       
   546   </target>
       
   547 
       
   548 
       
   549 <!--CLEANING END-->
       
   550 
       
   551 
       
   552   <!--Generate signature jar file-->
       
   553   <target name="generate.signature.jars" depends="init.properties">
       
   554    <zip destfile="${signature.jar}">  
       
   555      <zipfileset src="${bootclasspath.cldc}"/>  
       
   556      <zipfileset src="${impl.cldc.jar}"/>  
       
   557    </zip>  
       
   558   </target>
       
   559 
       
   560 
       
   561 
       
   562 <!--GENERATE JAVADOC START-->
       
   563   <target name="javadoc" description="Create javadoc. Use -javadoc.dir=dir to override location">
       
   564      <property name="javadoc.dir" value="javadoc" />
       
   565 	 <javadoc destdir="${javadoc.dir}"
       
   566 			  version="true"
       
   567 			  use="true"
       
   568               defaultexcludes="true"
       
   569 			  windowtitle="Runtime API">
       
   570 
       
   571 	   <fileset dir="${java.src.root}/javacommons/" defaultexcludes="yes">
       
   572 		 <include name="utils/javasrc/com/nokia/mj/impl/rt/support/*.java"/>
       
   573 		 <include name="utils/javasrc/com/nokia/mj/impl/utils/**/*.java"/>
       
   574 		 <include name="fileutils/javasrc/**/*.java"/>
       
   575   	     <include name="comms/javasrc/**/*.java"/>
       
   576 		 <include name="javastorage/javasrc/**/*.java"/>
       
   577 	   </fileset>
       
   578 
       
   579 	   <doctitle><![CDATA[<h1>Runtime API</h1>]]></doctitle>
       
   580 	   <bottom><![CDATA[<i>Copyright &#169; 2008 Nokia. All Rights Reserved.</i>]]></bottom>
       
   581 	 </javadoc>
       
   582   </target>
       
   583 <!--GENERATE JAVADOC END-->
       
   584 
       
   585 
       
   586 
       
   587 
       
   588 
       
   589 
       
   590 </project>
       
   591