d62ce5abcf790031e14ed8543a72d2c9c4a52d23
[splitter-ng] / Splitter-ng-plugin-bitsplitter / build.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <project basedir="." default="makejar" name="Splitter-ng-plugin-bitsplitter">
3   <property environment="env"/>
4   <property name="Splitter-ng.location" value="../Splitter-ng"/>
5   <property name="bitsplitter.location" value="dispersedalgorithms/bitsplitter"/>
6   <property name="dispersedalgorithms.location" value="dispersedalgorithms"/>
7   <property name="dispersedalgorithms.url" value="git://serviceplatform.org/git/dispersedalgorithms"/>
8   <property name="dispersedalgorithms.branch" value="mq"/>
9   <property name="debuglevel" value="source,lines,vars"/>
10   <property name="target" value="1.7"/>
11   <property name="source" value="1.7"/>
12   <path id="Splitter-ng.classpath">
13     <pathelement location="${Splitter-ng.location}/bin"/>
14   </path>
15   <path id="Splitter-ng-plugin-bitsplitter.classpath">
16     <pathelement location="bin"/>
17     <!--pathelement location="${bitsplitter.location}/java/lib"/-->
18     <path refid="Splitter-ng.classpath"/>
19   </path>
20   <target name="init">
21     <mkdir dir="bin"/>
22     <copy includeemptydirs="false" todir="bin">
23       <fileset dir="src">
24         <exclude name="**/*.uad"/>
25         <exclude name="**/*.ucd"/>
26         <exclude name="**/*.uld"/>
27         <exclude name="**/*.upd"/>
28         <exclude name="**/*.udd"/>
29         <exclude name="**/*.uod"/>
30         <exclude name="**/*.usd"/>
31         <exclude name="**/*.utd"/>
32         <exclude name="**/*.uud"/>
33         <exclude name="**/*.odd"/>
34         <exclude name="**/*.ead"/>
35         <exclude name="**/*.ecd"/>
36         <exclude name="**/*.eld"/>
37         <exclude name="**/*.epd"/>
38         <exclude name="**/*.edd"/>
39         <exclude name="**/*.eod"/>
40         <exclude name="**/*.esd"/>
41         <exclude name="**/*.etd"/>
42         <exclude name="**/*.eud"/>
43         <exclude name="**/*.urd"/>
44         <exclude name="**/*.uml"/>
45         <exclude name="**/*.ecore"/>
46         <exclude name="**/*.ucls"/>
47         <exclude name="**/*.useq"/>
48         <exclude name="**/*.java"/>
49       </fileset>
50     </copy>
51   </target>
52   <target name="clean">
53     <delete dir="bin"/>
54     <delete dir="lib"/>
55     <delete file="src/BitSplitter/BitSplitter.java" />
56     <delete dir="${dispersedalgorithms.location}"/>
57     <!--exec executable="make" dir="${bitsplitter.location}" failonerror="true">
58       <arg line="-f Makefile clean"/>
59     </exec-->
60   </target>
61   <target depends="clean" name="cleanall">
62   </target>
63   <target depends="jni,build-subprojects,build-project" name="build"/>
64   <target name="build-subprojects">
65     <ant antfile="build.xml" dir="${Splitter-ng.location}" inheritAll="false" target="build-project"/>
66   </target>
67   <target depends="init" name="build-project">
68     <echo message="${ant.project.name}: ${ant.file}"/>
69     <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
70       <src path="src"/>
71       <classpath refid="Splitter-ng-plugin-bitsplitter.classpath"/>
72     </javac>
73   </target>
74   <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
75   <target name="jni" >
76     <exec executable="make" dir="${bitsplitter.location}" failonerror="true">
77       <arg line="-f Makefile bitsplitter"/>
78     </exec>
79     <exec executable="make" dir="${bitsplitter.location}" failonerror="true">
80       <arg line="-f Makefile libbitsplit.so"/>
81     </exec>
82         <exec executable="make" dir="${bitsplitter.location}/java" failonerror="true">
83         <arg line="-f Makefile"/>
84         </exec>
85         <mkdir dir="src/BitSplitter" />
86       <copy file="${bitsplitter.location}/java/BitSplitter.java"  todir="src/BitSplitter" />
87   </target>
88   <target name ="makejar" depends="build" description="Create a jar for the project">
89     <jar jarfile="bin/${ant.project.name}.jar" >
90       <fileset dir="bin" includes="**/*.class" />
91       <!--fileset dir="." includes="${bitsplitter.location}/java/lib/**/*.class" /-->
92       <fileset dir="." includes="${bitsplitter.location}/*.so" />
93       <fileset dir="." includes="${bitsplitter.location}/java/*.so" />
94     </jar>
95   </target>
96   <target name="dist" depends="makejar" description="Create a distribution Directory wirth splitter-ng and all Plugins">
97     <mkdir dir="../dist" />
98     <mkdir dir="../dist/plugin" />
99     <copy file="bin/${ant.project.name}.jar" todir="../dist/plugin/" />
100   </target>
101   <target name="fetchbitsplitter" depends="check-git-repo,createbitsplitter" description="Fetch Bitsplitter from dispersedalgorithms git repository">
102     <exec executable="git" dir="${dispersedalgorithms.location}" failonerror="false">
103       <arg value="pull"/>
104       <arg value="origin"/>
105       <arg value="${dispersedalgorithms.branch}"/>
106     </exec>
107     <exec executable="git" dir="${dispersedalgorithms.location}" failonerror="false">
108       <arg value="reset"/>
109       <arg value="--hard"/>
110       <arg value="HEAD"/>
111     </exec>
112   </target>
113   <target name="check-git-repo">
114     <available property="repo.exists" file="${dispersedalgorithms.location}/.git/info/sparse-checkout"/>
115   </target>  
116   <target name="createbitsplitter" depends="check-git-repo" unless="repo.exists">  
117     <mkdir dir="${dispersedalgorithms.location}"/>
118     <exec executable="git" dir="${dispersedalgorithms.location}" failonerror="true">
119       <arg value="init"/>
120     </exec>
121     <exec executable="git" dir="${dispersedalgorithms.location}" failonerror="no">
122       <arg value="remote"/>
123       <arg value="add"/>
124       <arg value="-f"/>
125       <arg value="origin"/>
126       <arg value="${dispersedalgorithms.url}"/>
127     </exec>
128     <exec executable="git" dir="${dispersedalgorithms.location}" failonerror="true">
129       <arg value="config"/>
130       <arg value="core.sparsecheckout"/>
131       <arg value="true"/>
132     </exec>
133     <echo file="${dispersedalgorithms.location}/.git/info/sparse-checkout" append="false">bitsplitter/
134     </echo>
135     <exec executable="git" dir="${dispersedalgorithms.location}" failonerror="true">
136       <arg value="pull"/>
137       <arg value="origin"/>
138       <arg value="${dispersedalgorithms.branch}"/>
139     </exec>
140   </target>
141 </project>
142   
143