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