1 <?xml version='1.0' encoding='utf-8'?>
2 <project default="jar" basedir=".">
4 <property name="project.name" value="nixnote"/>
5 <property name="application.name" value="sandbox"/>
7 <!-- targeted QtJambi library version -->
8 <property name="qtjambi.ver" value="4.5.2_01"/>
10 <!-- project directory hierarchy -->
11 <property name="src.dir" value="src"/>
12 <property name="classes.dir" value="build"/>
13 <property name="dist.dir" value="dist"/>
14 <property name="lib.dir" value="lib"/>
15 <property name="bin.dir" value="bin"/>
16 <property name="doc.dir" value="doc"/>
17 <property name="tr.dir" value="translations"/>
19 <!-- needed for running -->
22 <property name="javac.debug" value="true"/>
24 <!-- run parameter -->
26 <property name="jvm.xms" value="256M"/><!-- initial memory size -->
27 <property name="jvm.xmm" value="512M"/><!-- maximum memory size -->
28 <property name="jvm.newratio" value="2"/>
29 <property name="jvm.gcs" value="incgc"/><!-- GC strategy -->
31 <!-- product jar file -->
32 <property name="jar.name" value="nixnote.jar"/>
34 <!-- product exec command -->
35 <property name="shell.command" value="nixnote.sh"/>
36 <property name="bat.command" value="nixnote.bat"/>
39 <property name="linguist.update" value="lupdate"/>
40 <property name="linguist.release" value="lrelease"/>
43 <property name="linguist.project" value="nixnote.pro"/>
46 <property name="doc.changelog" value="changelog.txt"/>
47 <property name="doc.release" value="release.txt"/>
48 <property name="doc.readme" value="README.txt"/>
51 <condition property="isWindows">
52 <os family="windows" />
54 <condition property="isLinux">
55 <os name="Linux" arch="i386" />
57 <condition property="isLinux64">
58 <os name="Linux" arch="amd64" />
60 <condition property="isMacOSX">
61 <os name="Mac OS X" />
64 <!-- flexible looking for qtjambi library path -->
65 <target name="set-jambi-path32" depends="set-jambi-path" unless="qtlib.dir">
66 <available file="../qtjambi-linux32-lgpl-${qtjambi.ver}"
67 property="qtlib.dir" value="../qtjambi-linux32-lgpl-${qtjambi.ver}"/>
68 <available file="../qtjambi-linux32-community-${qtjambi.ver}"
69 property="qtlib.dir" value="../qtjambi-linux32-community-${qtjambi.ver}"/>
71 <target name="set-jambi-path64" depends="set-jambi-path" unless="qtlib.dir">
72 <available file="../qtjambi-linux64-lgpl-${qtjambi.ver}"
73 property="qtlib.dir" value="../qtjambi-linux64-lgpl-${qtjambi.ver}"/>
74 <available file="../qtjambi-linux64-community-${qtjambi.ver}"
75 property="qtlib.dir" value="../qtjambi-linux64-community-${qtjambi.ver}"/>
77 <target name="set-jambi-pathmac" depends="set-jambi-path" unless="qtlib.dir">
78 <available file="../qtjambi-macosx-lgpl-${qtjambi.ver}"
79 property="qtlib.dir" value="../qtjambi-macosx-lgpl-${qtjambi.ver}"/>
80 <available file="../qtjambi-macosx-community-${qtjambi.ver}"
81 property="qtlib.dir" value="../qtjambi-macosx-community-${qtjambi.ver}"/>
83 <target name="set-jambi-path" unless="qtlib.dir">
84 <available file="${user.home}/lib/qtjambi/qtjambi-${qtjambi.ver}.jar"
85 property="qtlib.dir" value="${user.home}/lib/qtjambi"/>
86 <available file="${user.home}/lib/qtjambi-${qtjambi.ver}.jar"
87 property="qtlib.dir" value="${user.home}/lib"/>
88 <available file="lib/qtjambi-${qtjambi.ver}.jar"
89 property="qtlib.dir" value="lib"/>
92 <!-- os dependent library path and lib file -->
93 <target name="check_syslib_path" depends="lib-if_windows, lib-if_linux, lib-if_linux64"/>
95 <target name="lib-if_windows" if="isWindows">
96 <property name="system.lib.dir" value="D:/NeverNote/lib"/>
97 <property name="qtlib.dir" value="D:/qtjambi-${qtjambi.ver}"/>
98 <property name="qtjambi-platform" value="win32-msvc2005"/>
101 <target name="lib-if_linux" depends="set-jambi-path32" if="isLinux">
102 <property name="system.lib.dir" value="/usr/share/java"/>
103 <property name="qtjambi.platform" value="linux32-gcc"/>
104 <echo message="use qtjambi library at ${qtlib.dir}"/>
106 <target name="lib-if_linux64" depends="set-jambi-path64" if="isLinux64">
107 <property name="system.lib.dir" value="/usr/share/java"/>
108 <property name="qtjambi.platform" value="linux64-gcc"/>
109 <echo message="use qtjambi library at ${qtlib.dir}"/>
111 <target name="lib-if_macosx" depends="set-jambi-pathmac" if="isMacOSX">
112 <property name="system.lib.dir" value="/Library/Java/Extensions"/>
113 <property name="qtjambi.platform" value="macosx-gcc"/>
114 <echo message="use qtjambi library at ${qtlib.dir}"/>
117 <!-- compiler classpath -->
118 <target name="set_classpath" depends="check_syslib_path">
119 <path id="java.classpath">
120 <!-- bundled library -->
121 <pathelement location="${lib.dir}/apache-mime4j-0.6.jar"/>
122 <pathelement location="${lib.dir}/commons-codec-1.5.jar"/>
123 <pathelement location="${lib.dir}/commons-compress-1.2.jar"/>
124 <pathelement location="${lib.dir}/commons-lang3-3.0.jar"/>
125 <pathelement location="${lib.dir}/commons-logging-1.1.1.jar"/>
126 <pathelement location="${lib.dir}/evernote-api-1.19.jar"/>
127 <pathelement location="${lib.dir}/libthrift.jar"/>
128 <pathelement location="${lib.dir}/log4j-1.2.14.jar"/>
129 <pathelement location="${lib.dir}/h2-1.3.158.jar"/>
130 <pathelement location="${lib.dir}/jtidy-r938.jar"/>
131 <pathelement location="${lib.dir}/httpclient-4.1.1.jar"/>
132 <pathelement location="${lib.dir}/httpcore-4.1.jar"/>
133 <pathelement location="${lib.dir}/httpmime-4.1.1.jar"/>
134 <pathelement location="${lib.dir}/jaxen-1.1.3.jar"/>
135 <pathelement location="${lib.dir}/jazzy.jar"/>
136 <pathelement location="${lib.dir}/pdfbox-app-1.6.0.jar"/>
137 <pathelement location="${lib.dir}/poi-3.7-20101029.jar"/>
138 <pathelement location="${lib.dir}/poi-ooxml-3.7.jar"/>
139 <pathelement location="${lib.dir}/poi-ooxml-schemas-3.7-20101029.jar"/>
140 <pathelement location="${lib.dir}/poi-scratchpad-3.7-20101029.jar"/>
141 <pathelement location="${lib.dir}/tika.jar"/>
142 <pathelement location="${lib.dir}/xmlbeans-2.3.0.jar"/>
143 <pathelement location="${lib.dir}/xsdlib-20060615.jar"/>
144 <!-- dependent library -->
145 <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.ver}.jar"/>
146 <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.platform}-${qtjambi.ver}.jar"/>
147 <pathelement location="${qtlib.dir}/qtjambi-util-${qtjambi.ver}.jar"/>
151 <target name="init" depends="set_classpath">
153 <mkdir dir="${classes.dir}"/>
157 <target name="update-tr" depends="update-tr-if_linux, update-tr-if_linux64, update-tr-if_windows"/>
158 <target name="update-tr-if_windows" depends="init" if="isWindows">
159 <exec dir="." executable="cmd" os="Windows NT">
160 <arg line="/c ${bin.dir}\${linguist.update} ${linguist.project}"/>
163 <target name="update-tr-if_linux" depends="init" if="isLinux">
164 <exec executable="${linguist.update}">
165 <arg line="${linguist.project}"/>
168 <target name="update-tr-if_linux64" depends="init" if="isLinux64">
169 <exec executable="${linguist.update}">
170 <arg line="${linguist.project}"/>
174 <target name="release-tr" depends="release-tr-if_linux, release-tr-if_linux64, release-tr-if_windows"/>
175 <target name="release-tr-if_windows" depends="init" if="isWindows">
176 <exec dir="." executable="cmd" os="Windows NT">
177 <arg line="/c ${bin.dir}\${linguist.release} ${linguist.project}"/>
180 <target name="release-tr-if_linux" depends="init" if="isLinux">
181 <exec executable="${linguist.release}">
182 <arg line="${linguist.project}"/>
185 <target name="release-tr-if_linux64" depends="init" if="isLinux64">
186 <exec executable="${linguist.release}">
187 <arg line="${linguist.project}"/>
192 <target name="compile" depends="init">
193 <javac srcdir="${src.dir}"
194 destdir="${classes.dir}"
195 debug="${javac.debug}"
196 includeantruntime="false">
197 <classpath refid="java.classpath"/>
201 <target name="resources" depends="init,release-tr">
202 <mkdir dir="${classes.dir}/cx/fbn/nevernote/icons"/>
203 <copy todir="${classes.dir}/cx/fbn/nevernote/icons">
204 <fileset dir="${src.dir}/cx/fbn/nevernote/icons"/>
206 <mkdir dir="${classes.dir}/translations"/>
207 <copy todir="${classes.dir}/translations">
208 <fileset file="translations/*.qm"/>
212 <target name="jar" depends="compile,resources,release-tr">
213 <jar destfile="${jar.name}" basedir="${classes.dir}"/>
216 <!-- make distribution -->
217 <target name="dist-init" depends="init">
218 <mkdir dir="${dist.dir}"/>
219 <mkdir dir="${dist.dir}/lib"/>
220 <mkdir dir="${dist.dir}/bin"/>
221 <mkdir dir="${dist.dir}/doc"/>
224 <target name="dist" depends="jar, dist-init">
225 <copy file="${bin.dir}/${shell.command}" todir="${dist.dir}/bin"/>
226 <copy file="${bin.dir}/${bat.command}" todir="${dist.dir}/bin"/>
227 <copy todir="${dist.dir}/lib">
228 <fileset file="${jar.name}"/>
229 <fileset dir="${lib.dir}"/>
231 <copy todir="${dist.dir}/doc">
232 <fileset file="${doc.changelog}"/>
233 <fileset file="${doc.release}"/>
234 <fileset file="${doc.readme}"/>
235 <fileset dir="${doc.dir}"/>
237 <exec dir="dist" executable="tar">
238 <arg line="czf ../../nixnote-bin.tar.gz ."/>
243 <target name="run-init" depends="init, resources, jar">
248 <target name="run" depends="run-init">
249 <java classname="cx.fbn.nevernote.NeverNote"
250 fork="yes" maxmemory="${jvm.xmm}"
251 classpathref="java.classpath" classpath="${jar.name}">
252 <jvmarg value="-XX:NewRatio=${jvm.newratio}"/>
253 <jvmarg value="-X${jvm.gcs}"/>
254 <arg value="--name=${application.name}"/>
258 <!-- script test run -->
259 <target name="run-script" depends="run-if_windows, run-if_linux, run-if_linux64"
260 description="run starter script">
263 <target name="run-if_windows" depends="run-init" if="isWindows">
264 <exec dir="." executable="cmd" os="Windows NT">
265 <arg line="/c ${bin.dir}\${batch.command}"/>
268 <target name="run-if_linux" depends="run-init" if="isLinux">
269 <exec executable="${bin.dir}/${shell.command}"/>
271 <target name="run-if_linux64" depends="run-init" if="isLinux64">
272 <exec executable="${bin.dir}/${shell.command}"/>
277 description="clean up without classes and run env" >
278 <delete dir="${dist.dir}" />
279 <delete file="${jar.name}"/>
282 <target name="all-clean" depends="clean"
283 description="clean up all" >
284 <delete dir="${classes.dir}" />
285 <delete dir="${logs.dir}" />
286 <delete dir="${db.dir}" />
287 <delete file="secure.txt"/>
289 <fileset file="${tr.dir}/*.qm"/>
290 <fileset file="${tr.dir}/*.po"/>