Allow subprojects within a project repo and model file relative to the subproject dir
authorDario Sestito <darios@symbian.org>
Mon, 27 Jul 2009 14:25:36 +0100
changeset 325 779cc88ed845
parent 324 f1baeb3f075f
child 326 47a6624f927d
Allow subprojects within a project repo and model file relative to the subproject dir
build.xml
common/build.xml
sf-package/build.xml
sf-package/package_props.ant.xml
sf-package/package_refs.ant.xml
--- a/build.xml	Wed Jul 22 10:58:34 2009 +0100
+++ b/build.xml	Mon Jul 27 14:25:36 2009 +0100
@@ -1,17 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="SF-CONFIG">
+<project name="SF-CONFIG" xmlns:hlm="http://www.nokia.com/helium">
   <!-- location of this config -->
   <dirname property="sf.config.dir" file="${ant.file.SF-CONFIG}"/>
-  <property name="sf.project.location" value="${sf.config.dir}/../build/config"/>
+  
+  <property name="sf.subproject.path" value=""/>
+  <property name="sf.project.location" value="${sf.config.dir}/../build/config/${sf.subproject.path}"/>
   <property name="sf.project.name" value="job"/>
+  
+  <path id="lib.path">
+    <fileset dir="${helium.dir}/external/antlibs" includes="**/*.jar"/>
+  </path>
+  <taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="lib.path"/>
+  <propertyregex override="yes" property="jobname" input="${sf.subproject.path}" regexp=".*[\\/]([^\\^/]+)" replace="\1"/>
+  <property name="jobname" value="${sf.subproject.path}"/>
+  <propertyregex override="yes" property="codeline" input="${sf.subproject.path}" regexp="^([^\\^/]+)[\\/].*" replace="\1"/>
+  <property name="codeline" value="default"/>
+  <property name="sf.spec.job.name" value="${jobname}"/>
+  <property name="sf.spec.job.codeline" value="${codeline}"/>
      
   <!-- import job properties -->
-  <import file="${sf.project.location}/${sf.project.name}_props.ant.xml" />
+  <import file="${sf.project.location}/${sf.project.name}_props.ant.xml" optional="yes"/>
   
   <!-- import project properties/targets/references -->
   <import file="sf-${sf.project.type}/build.xml" />
   
   <!-- import job references -->
-  <import file="${sf.project.location}/${sf.project.name}_refs.ant.xml" />
+  <import file="${sf.project.location}/${sf.project.name}_refs.ant.xml" optional="yes"/>
   
 </project>
\ No newline at end of file
--- a/common/build.xml	Wed Jul 22 10:58:34 2009 +0100
+++ b/common/build.xml	Mon Jul 27 14:25:36 2009 +0100
@@ -483,7 +483,7 @@
         </if>
     </target>
 
-    <target name="sf-build-noprep" depends="sf-truclean,sf-compile,sf-postbuild">
+    <target name="sf-build-noprep" depends="sf-truclean,sf-model-from-project,sf-compile,sf-postbuild">
         <echo>[SF-BUILD-NOPREP]</echo>
     </target>
     
@@ -520,6 +520,17 @@
       </else>
     </if>
   </target>
+  
+  <target name="sf-model-from-project">
+    <if>
+      <isset property="sf.spec.systemdefinition.source"/>
+      <then>
+        <echo message="Using ${sf.spec.systemdefinition.source} as model file"/>
+        <echo message="Copying to ${build.drive}/definition.xml"/>
+        <copy file="${sf.project.location}/${sf.spec.systemdefinition.source}" tofile="${build.drive}/definition.xml"/>
+      </then>
+    </if>
+  </target>
     
     <target name="sf-compile">
         <!-- TODO: add here assigments to raptor-related ant references -->
--- a/sf-package/build.xml	Wed Jul 22 10:58:34 2009 +0100
+++ b/sf-package/build.xml	Mon Jul 27 14:25:36 2009 +0100
@@ -21,8 +21,7 @@
       <arg value="--model=${build.drive}/${sf.spec.systemdefinition.location}"/>
       <arg value="--sources=${sf.spec.sourcesync.sourcespecdir}/${sf.spec.sourcesync.sourcespecfile}"/>
     </exec>
-        
-        
+    
     <runtarget target="sf-package-compile"/>
   </target>
   
--- a/sf-package/package_props.ant.xml	Wed Jul 22 10:58:34 2009 +0100
+++ b/sf-package/package_props.ant.xml	Mon Jul 27 14:25:36 2009 +0100
@@ -12,6 +12,10 @@
   <property name="sf.spec.build.clean.enable" value="true"/>
   
   <property name="sf.spec.systemdefinition.assemble" value="false"/>
+  <!-- if this is defined then the model is taken from this location (relative to the project dir) and copied to BUILDDRIVE\definition.xml -->
+  <property name="sf.spec.systemdefinition.source" value="package_definition.xml"/>
+  <!-- location of the model (related to the build drive) -->
+  <property name="sf.spec.systemdefinition.location" value="\definition.xml"/>
   <property name="sf.spec.sysdef.configurations.list" value="SF"/>
   
   <property name="sf.spec.sbs.config" value="winscw"/>
--- a/sf-package/package_refs.ant.xml	Wed Jul 22 10:58:34 2009 +0100
+++ b/sf-package/package_refs.ant.xml	Mon Jul 27 14:25:36 2009 +0100
@@ -4,8 +4,8 @@
 
   <path id="sf.spec.system.definition.files">
     <fileset dir="${sf.spec.job.drive}/" casesensitive="false">
-      <include name="${sf.spec.systemdefinition.location}" />
+      <include name="${sf.spec.systemdefinition.location}"/>
     </fileset>
   </path>
-
-  </project>
\ No newline at end of file
+  
+</project>
\ No newline at end of file