aboutsummaryrefslogtreecommitdiffstats
path: root/tools/antipede/build.xtarget
blob: 5326d5855ee89bc632651c6a116b637b040eacd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  <target name="-init">
   <tstamp>
     <format property="YEAR" pattern="yyyy" locale="en"/>
   </tstamp>
   
   <buildnumber/>

   <!--
    The location of tools.jar, relative to the JAVA_HOME home.
    If tools.jar is not present, exit with an error, since it
    means that a JDK is not installed.
    -->
    <property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
    <available file="${tools.jar}" property="tools.jar.present"/>
    <fail unless="tools.jar.present" message="tools.jar not found. Probably JDK not installed."/>    


    <!-- create fixed centipede dirs -->
    <property name="tools.dir"                   value="tools"/>
    <property name="temp.dir"                    value="tools/tmp"/>
    <property name="cents.dir"                   value="tools/cents"/>
    <property name="installed.cents.dir"         value="tools/installed"/>
    <property name="antipede.dir"                value="tools/antipede"/>
    <property name="antipede.lib.dir"            value="tools/antipede/lib"/>
    <property name="cent.lib.dir.name"           value="lib"/>
    <property name="task.properties.name"        value="tasks.properties"/>
    <property name="cent.jar.suffix"             value="cent.jar"/>    
    <property name="cent.dir.suffix"             value="cent"/>    
    <property name="cent.installed.suffix"       value="installed"/>      
    
                
    <!-- define all ant tasks in antipede -->
    <taskdef file="${antipede.dir}/${task.properties.name}">
     <classpath>
      <path>
       <fileset dir="${antipede.lib.dir}" casesensitive="yes"> 
         <include name="*.jar"/>
         <include name="*.zip"/>
       </fileset>  
      </path>
     </classpath>
    </taskdef>
 
    <!-- Unpack jarred cents -->
    <antipede-foreach target="-cent-unjar" param="current.cent.jar">
     <fileset dir="." casesensitive="yes"> 
      <patternset>
       <include name="${cents.dir}/*.${cent.jar.suffix}"/>
      </patternset>
     </fileset>  
    </antipede-foreach>
 
    <mkdir dir="${temp.dir}"/>
    <delete file="${temp.dir}/${task.properties.name}"/>
              
    <!-- put all ant task definitions in cents in a single file -->
    <concat destfile="${temp.dir}/${task.properties.name}" append="no">
      <fileset dir=".">
       <patternset>
         <include name="${cents.dir}/*.${cent.dir.suffix}/${task.properties.name}"/>
       </patternset>
     </fileset>          
    </concat>
    
    <!-- define the tasks found in cents -->
    <taskdef file="${temp.dir}/${task.properties.name}">
     <classpath>
       <fileset dir="${tools.dir}" casesensitive="yes"> 
         <include name="**/*.jar"/>
       </fileset> 
     </classpath>
    </taskdef>
    
   <!--
    Load project information
    -->
    <centipede-xml-property file="module.xml"     prefix="xgump"    keeproot="true" />
    <centipede-xml-property file="status.xml"     prefix="xstatus"  keeproot="false"  />   
    <centipede-xml-property file="layout.xml"     prefix="xlayout"  keeproot="false"  />
    <centipede-xml-property file="properties.xml"                   keeproot="false"  /> 
    
  </target>

  <!-- ================================ -->
  <!--  Used only by the -init target   -->
  <!-- =================================--> 
  <target  name="-cent-unjar">
    <unjar src="${current.cent.jar}" dest="${cents.dir}"/> 
  </target>       
        
  <!-- ============================================= -->
  <!-- Simple utility target to call a cent target   -->
  <!-- ==============================================-->
  <target name="call-cent">
     <ant antfile="tools/cents/${cent-name}.cent/xbuild.xml"
         inheritAll="true" 
         dir="."
         target="${cent-target}" />       
  </target>