buildframework/helium/tools/compile/compile.ant.xml
changeset 587 85df38eb4012
parent 217 0f5e3a7fb6af
child 588 c7c26511138f
--- a/buildframework/helium/tools/compile/compile.ant.xml	Thu Mar 04 15:10:37 2010 +0200
+++ b/buildframework/helium/tools/compile/compile.ant.xml	Tue Apr 27 08:33:08 2010 +0300
@@ -21,7 +21,8 @@
 ============================================================================
 -->
 <!--* @package compile -->
-<project name="compile" xmlns:hlm="http://www.nokia.com/helium">
+<project name="compile" xmlns:hlm="http://www.nokia.com/helium"
+    xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
     <description>
         Targets related to compile stage. It includes cmaker,
         ec, ebs, sbs, sbs-ec build system.
@@ -118,8 +119,15 @@
                         <scriptmapper language="jython">
 <![CDATA[
 import os
+counter = project.getProperty(".unique.counter");
+if not counter:
+    counter = 0
+else:
+    counter = int(counter)
+counter = counter + 1
+project.setProperty(".unique.counter", str(counter));
 (drive, _) = os.path.splitdrive(r'@{file}')
-path = r'@{file}'.replace(drive + os.sep, "", 1)
+path = r'@{file}'.replace(drive + os.sep, "%08d%s" % ((counter-1), os.sep), 1)
 self.addMappedName(path)
 ]]>
                         </scriptmapper>
@@ -136,13 +144,60 @@
         <if>
             <istrue value="${schema.new}" />
             <then>
-                <echo message="system model file: ${system.model.file}" />
-                <copy file="${system.model.file}" tofile="${build.drive}/sf/os/deviceplatformrelease/foundation_system/system_model/system_model.xml"/> 
-                <hlm:joinSysdef epocroot="${build.drive}" srcfile="${build.drive}/sf/os/deviceplatformrelease/foundation_system/system_model/system_model.xml" 
-                    destfile="${canonical.sysdef.file}.join.xml" />
-                <!-- <hlm:mergeSysdef epocroot="${epocroot}" destfile="${canonical.sysdef.file}" srcfile="${canonical.sysdef.file}.join.xml" downstreamfile="${epocroot}/layer2.sysdef.xml" /> -->
-                <hlm:downgradeSysdef epocroot="${build.drive}" srcfile="${canonical.sysdef.file}.join.xml" 
-                    destfile="${canonical.sysdef.file}"/>
+                <mkdir dir="${temp.build.dir}/root" />
+                <mkdir dir="${temp.build.dir}/join" />
+                <delete>
+                    <fileset dir="${temp.build.dir}/root" />
+                    <fileset dir="${temp.build.dir}/join" />
+                </delete>
+                <!-- creating the root sysdef file for packages referenced directly -->
+                <hlm:createRootSysdef destFile="${temp.build.dir}/root/generated.root.xml" epocroot="${build.drive}">
+                    <restrict>
+                        <resources refid="system.definition.files" />
+                        <rsel:name name="**${file.separator}package_definition.xml" />
+                    </restrict>
+                </hlm:createRootSysdef>
+                <!-- Joining all the Root sysdef files -->
+                <for param="file">
+                    <path>
+                        <restrict>
+                            <resources refid="system.definition.files" />
+                            <rsel:not>
+                                <rsel:name name="**${file.separator}package_definition.xml" />
+                            </rsel:not>
+                        </restrict>
+                        <fileset dir="${temp.build.dir}/root" includes="generated.root.xml" />
+                    </path>
+                    <sequential>
+                        <hlm:joinSysdef epocroot="${build.drive}/" srcfile="@{file}" 
+                            destfile="@{file}.join.xml" />
+                        <move todir="${temp.build.dir}/join/">
+                            <fileset file="@{file}.join.xml" />
+                            <mapper>
+                                <scriptmapper language="jython">
+<![CDATA[
+import os
+counter = project.getProperty(".unique.counter");
+if not counter:
+    counter = 0
+else:
+    counter = int(counter)
+counter = counter + 1
+project.setProperty(".unique.counter", str(counter));
+(drive, _) = os.path.splitdrive(r'@{file}')
+path = r'@{file}'.replace(drive + os.sep, "%08d%s" % ((counter-1), os.sep), 1)
+self.addMappedName(path)
+]]>
+                                </scriptmapper>
+                            </mapper>
+                        </move>
+                    </sequential>
+                </for>
+                <!-- Merging all the joined files together -->
+                <hlm:mergeSysdef epocroot="${build.drive}/" destfile="${canonical.sysdef.file}">
+                    <fileset dir="${temp.build.dir}/join" includes="**/*.xml" />
+                </hlm:mergeSysdef>
+                <hlm:assertFileExists file="${canonical.sysdef.file}" />
             </then>
             <else>
                 <pathconvert pathsep=" " property="system.definition.files.list">
@@ -152,7 +207,7 @@
                     </chainedmapper>
                 </pathconvert>
                 <hlm:compileGenxmlMergeMacro input="-x ${compile.sysdef.dtd.stub} ${system.definition.files.list}"
-                                            output="${canonical.sysdef.file}" logfile="${compile.log.dir}/${build.id}.sysdef_GenxmlMerge.log"/>
+                                            output="${canonical.sysdef.file}" logfile="${compile.log.dir}/${build.id}.sysdef_genxmlmerge.log"/>
             </else>
         </if>
     </target>