Simplify the create-canonical-sysdef-file target as we can depend on there only being a single sysdef in the supplied reference.
authorSimon Howkins <simonh@symbian.org>
Thu, 13 Aug 2009 14:13:35 +0100
changeset 346 bf437da77ab4
parent 345 94b4a136d800
child 349 1fa0548ccf38
Simplify the create-canonical-sysdef-file target as we can depend on there only being a single sysdef in the supplied reference.
sf-platform/build.xml
--- a/sf-platform/build.xml	Thu Aug 13 18:10:32 2009 +0100
+++ b/sf-platform/build.xml	Thu Aug 13 14:13:35 2009 +0100
@@ -8,81 +8,47 @@
    -->
 
   <!-- workaround until GenXML can merge v2.0.0 fragments -->
-  <target name="create-canonical-sysdef-file">
-
-    <runtarget target="preprocess-sysdef-files"/>
-    <echo message="Exporting preprocessed System Definition"/>
-    <if><istrue value="${sf.spec.splitbuild}"/>
-       <then>
-       <if><istrue value="${sf.spec.os.skipbuild}" />
-            <then><echo message="Skipping OS sysdef creation"/></then>
-       <else>
-            <!-- TODO use better method to export or wait for GenXML fix?-->
-            <copy file="${build.output.dir}\build\input\0000000000000001_system_model_os.xml"
-            tofile="${canonical.sysdef.file}" failonerror="false" verbose="true"/>
-       </else>
-       </if>
+  <!--
+    This target is effectively a callback, called from compile-main.
+    Its responsibility is to convert the set of peices in ref "system.definition.files" into one sys def with absolute paths
 
-       <if><istrue value="${sf.spec.s60.skipbuild}" />
-            <then><echo message="Skipping S60 sysdef creation"/></then>
-       <else>
-            <!-- TODO use better method to export or wait for GenXML fix?-->
-            <copy file="${build.output.dir}\build\input\0000000000000001_system_model_s60.xml"
-            tofile="${canonical.sysdef.file}" failonerror="false" verbose="true"/>
-	   </else>
-	   </if>
-	   </then>
-	
-	<else>
-	    <!-- TODO use better method to export or wait for GenXML fix?-->
-        <copy file="${build.output.dir}\build\input\0000000000000001_system_model.xml"
-        tofile="${canonical.sysdef.file}" failonerror="false" verbose="true"/>
-
-	</else>
-        </if>
-
-  </target>
+    However, in our builds, we know that there will only be one sysdef peice passed in, so that makes things a lot simpler
+  -->
+  <target name="create-canonical-sysdef-file">
+    <fail message="Symbian builds create a canonical system definition from exactly one peice">
+      <condition>
+        <resourcecount refid="system.definition.files" when="ne" count="1"/>
+      </condition>
+    </fail>
 
-  <!--
-    == Name: PREPROCESS-SYSDEF-FILES
-    ==
-    == Desc: Override of default target in order to deal with symbian os
-    ==       system_definition.xml that does not have /sf source prefix
-    ==
-    ==       TODO get this moved as a Helium core target?
-    -->
-  <target name="preprocess-sysdef-files">
-        <mkdir dir="${build.output.dir}/build/input"/>
-        <delete verbose="true">
-            <fileset dir="${build.output.dir}/build/input/" includes="**"/>
-        </delete>
+    <!-- Locate the first/only item referenced -->
+    <for param="file">
+      <resources refid="system.definition.files"/>
+      <sequential>
+        <echo message="@{file}"/>
+        <!-- Once a property is set, it stays set - bingo! -->
+        <property name="sf.first.system.definition" value="@{file}"/>
+      </sequential>
+    </for>
 
-        <for param="file">
-            <resources refid="system.definition.files"/>
-            <sequential>
-                <copy todir="${build.output.dir}/build/input" verbose="true">
-                    <fileset file="@{file}"/>
-                    <filterchain>
-                        <replaceregex pattern="bldFile=&quot;os" replace="bldFile=&quot;sf\\\\os" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;os" replace="mrp=&quot;sf\\\\os" flags="gi"/>
-                        <replaceregex pattern="bldFile=&quot;mw" replace="bldFile=&quot;sf\\\\mw" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;mw" replace="mrp=&quot;sf\\\\mw" flags="gi"/>
-                        <replaceregex pattern="bldFile=&quot;app" replace="bldFile=&quot;sf\\\\app" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;app" replace="mrp=&quot;sf\\\\app" flags="gi"/>
-                        <replaceregex pattern="bldFile=&quot;tools" replace="bldFile=&quot;sf\\\\tools" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;tools" replace="mrp=&quot;sf\\\\tools" flags="gi"/>
-                        <replaceregex pattern="bldFile=&quot;adaptation" replace="bldFile=&quot;sf\\\\adaptation" flags="gi"/>
-                        <replaceregex pattern="mrp=&quot;adaptation" replace="mrp=&quot;sf\\\\adaptation" flags="gi"/>
-                        
-                        <expandproperties/>
-                    </filterchain>
-                    <mapper>
-                        <scriptmapper language="jep" src="${helium.dir}/tools/common/jep/unique_filename.jep"/>
-                    </mapper>
-                </copy>
-            </sequential>
-        </for>
-    </target>
+    <!-- Having located the file, copy it to the final desired location, absoluting tha paths as we go -->
+    <copy tofile="${canonical.sysdef.file}" file="${sf.first.system.definition}" overwrite="true" verbose="true">
+      <filterchain>
+        <replaceregex pattern="bldFile=&quot;os" replace="bldFile=&quot;/sf/os" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;os" replace="mrp=&quot;/sf/os" flags="gi"/>
+        <replaceregex pattern="bldFile=&quot;mw" replace="bldFile=&quot;/sf/mw" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;mw" replace="mrp=&quot;/sf/mw" flags="gi"/>
+        <replaceregex pattern="bldFile=&quot;app" replace="bldFile=&quot;/sf/app" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;app" replace="mrp=&quot;/sf/app" flags="gi"/>
+        <replaceregex pattern="bldFile=&quot;tools" replace="bldFile=&quot;/sf/tools" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;tools" replace="mrp=&quot;/sf/tools" flags="gi"/>
+        <replaceregex pattern="bldFile=&quot;adaptation" replace="bldFile=&quot;/sf/adaptation" flags="gi"/>
+        <replaceregex pattern="mrp=&quot;adaptation" replace="mrp=&quot;/sf/adaptation" flags="gi"/>
+        <expandproperties/>
+      </filterchain>
+    </copy>
+
+ </target>
 
   <!--
     == Name: SF-COMPILE