1 <?xml version='1.0' encoding='utf-8'?>
2 <project default="jar" basedir=".">
4 <property name="project.name" value="nevernote"/>
5 <property name="application.name" value="sandbox"/>
7 <!-- targeted QtJambi library version -->
8 <property name="qtjambi.ver" value="4.6.3"/>
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 -->
20 <property name="db.dir" value="db"/>
21 <property name="logs.dir" value="logs"/>
24 <property name="javac.debug" value="true"/>
26 <!-- run parameter -->
28 <property name="jvm.xms" value="256M"/><!-- initial memory size -->
29 <property name="jvm.xmm" value="512M"/><!-- maximum memory size -->
30 <property name="jvm.newratio" value="2"/>
31 <property name="jvm.gcs" value="incgc"/><!-- GC strategy -->
33 <!-- product jar file -->
34 <property name="jar.name" value="nevernote.jar"/>
36 <!-- product exec command -->
37 <property name="shell.command" value="nevernote.sh"/>
38 <property name="bat.command" value="nevernote.bat"/>
41 <property name="linguist.update" value="lupdate"/>
42 <property name="linguist.release" value="lrelease"/>
45 <property name="linguist.project" value="nevernote.pro"/>
48 <property name="doc.changelog" value="changelog.txt"/>
49 <property name="doc.release" value="release.txt"/>
50 <property name="doc.readme" value="README.txt"/>
53 <condition property="isWindows">
54 <os family="windows" />
56 <condition property="isLinux">
57 <os name="Linux" arch="i386" />
59 <condition property="isLinux64">
60 <os name="Linux" arch="amd64" />
62 <condition property="isMacOSX">
63 <os name="Mac OS X" />
66 <!-- flexible looking for qtjambi library path -->
67 <target name="set-jambi-path32" depends="set-jambi-path" unless="qtlib.dir">
68 <available file="../qtjambi-linux32-lgpl-${qtjambi.ver}"
69 property="qtlib.dir" value="../qtjambi-linux32-lgpl-${qtjambi.ver}"/>
70 <available file="../qtjambi-linux32-community-${qtjambi.ver}"
71 property="qtlib.dir" value="../qtjambi-linux32-community-${qtjambi.ver}"/>
73 <target name="set-jambi-path64" depends="set-jambi-path" unless="qtlib.dir">
74 <available file="../qtjambi-linux64-lgpl-${qtjambi.ver}"
75 property="qtlib.dir" value="../qtjambi-linux64-lgpl-${qtjambi.ver}"/>
76 <available file="../qtjambi-linux64-community-${qtjambi.ver}"
77 property="qtlib.dir" value="../qtjambi-linux64-community-${qtjambi.ver}"/>
79 <target name="set-jambi-pathmac" depends="set-jambi-path" unless="qtlib.dir">
80 <available file="../qtjambi-macosx-lgpl-${qtjambi.ver}"
81 property="qtlib.dir" value="../qtjambi-macosx-lgpl-${qtjambi.ver}"/>
82 <available file="../qtjambi-macosx-community-${qtjambi.ver}"
83 property="qtlib.dir" value="../qtjambi-macosx-community-${qtjambi.ver}"/>
85 <target name="set-jambi-path" unless="qtlib.dir">
86 <available file="${user.home}/lib/qtjambi/qtjambi-${qtjambi.ver}.jar"
87 property="qtlib.dir" value="${user.home}/lib/qtjambi"/>
88 <available file="${user.home}/lib/qtjambi-${qtjambi.ver}.jar"
89 property="qtlib.dir" value="${user.home}/lib"/>
90 <available file="lib/qtjambi-${qtjambi.ver}.jar"
91 property="qtlib.dir" value="lib"/>
94 <!-- os dependent library path and lib file -->
95 <target name="check_syslib_path" depends="lib-if_windows, lib-if_linux, lib-if_linux64"/>
97 <target name="lib-if_windows" if="isWindows">
98 <property name="system.lib.dir" value="D:/NeverNote/lib"/>
99 <property name="qtlib.dir" value="D:/qtjambi-${qtjambi.ver}"/>
100 <property name="qtjambi-platform" value="win32-msvc2005"/>
103 <target name="lib-if_linux" depends="set-jambi-path32" if="isLinux">
104 <property name="system.lib.dir" value="/usr/share/java"/>
105 <property name="qtjambi.platform" value="linux32-gcc"/>
106 <echo message="use qtjambi library at ${qtlib.dir}"/>
108 <target name="lib-if_linux64" depends="set-jambi-path64" if="isLinux64">
109 <property name="system.lib.dir" value="/usr/share/java"/>
110 <property name="qtjambi.platform" value="linux64-gcc"/>
111 <echo message="use qtjambi library at ${qtlib.dir}"/>
113 <target name="lib-if_macosx" depends="set-jambi-pathmac" if="isMacOSX">
114 <property name="system.lib.dir" value="/Library/Java/Extensions"/>
115 <property name="qtjambi.platform" value="macosx-gcc"/>
116 <echo message="use qtjambi library at ${qtlib.dir}"/>
119 <!-- compiler classpath -->
120 <target name="set_classpath" depends="check_syslib_path">
121 <path id="java.classpath">
122 <!-- bundled library -->
123 <pathelement location="${lib.dir}/evernote.jar"/>
124 <pathelement location="${lib.dir}/libthrift.jar"/>
125 <pathelement location="${lib.dir}/PDFRenderer.jar"/>
126 <pathelement location="${lib.dir}/log4j-1.2.14.jar"/>
127 <pathelement location="${lib.dir}/h2-1.2.136.jar"/>
128 <pathelement location="${lib.dir}/commons-lang-2.4.jar"/>
129 <pathelement location="${lib.dir}/jtidy-r938.jar"/>
130 <!-- dependent library -->
131 <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.ver}.jar"/>
132 <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.platform}-${qtjambi.ver}.jar"/>
133 <pathelement location="${qtlib.dir}/qtjambi-util-${qtjambi.ver}.jar"/>
137 <target name="init" depends="set_classpath">
139 <mkdir dir="${classes.dir}"/>
143 <target name="update-tr" depends="update-tr-if_linux, update-tr-if_linux64, update-tr-if_windows"/>
144 <target name="update-tr-if_windows" depends="init" if="isWindows">
145 <exec dir="." executable="cmd" os="Windows NT">
146 <arg line="/c ${bin.dir}\${linguist.update} ${linguist.project}"/>
149 <target name="update-tr-if_linux" depends="init" if="isLinux">
150 <exec executable="${linguist.update}">
151 <arg line="${linguist.project}"/>
154 <target name="update-tr-if_linux64" depends="init" if="isLinux64">
155 <exec executable="${linguist.update}">
156 <arg line="${linguist.project}"/>
160 <target name="release-tr" depends="release-tr-if_linux, release-tr-if_linux64, release-tr-if_windows"/>
161 <target name="release-tr-if_windows" depends="init" if="isWindows">
162 <exec dir="." executable="cmd" os="Windows NT">
163 <arg line="/c ${bin.dir}\${linguist.release} ${linguist.project}"/>
166 <target name="release-tr-if_linux" depends="init" if="isLinux">
167 <exec executable="${linguist.release}">
168 <arg line="${linguist.project}"/>
171 <target name="release-tr-if_linux64" depends="init" if="isLinux64">
172 <exec executable="${linguist.release}">
173 <arg line="${linguist.project}"/>
178 <target name="compile" depends="init">
179 <javac srcdir="${src.dir}"
180 destdir="${classes.dir}"
181 debug="${javac.debug}">
182 <classpath refid="java.classpath"/>
186 <target name="resources" depends="init,release-tr">
187 <mkdir dir="${classes.dir}/cx/fbn/nevernote/icons"/>
188 <copy todir="${classes.dir}/cx/fbn/nevernote/icons">
189 <fileset dir="${src.dir}/cx/fbn/nevernote/icons"/>
191 <copy file="${src.dir}/com/swabunga/spell/engine/configuration.properties"
192 todir="${classes.dir}/com/swabunga/spell/engine/"/>
193 <mkdir dir="${classes.dir}/translations"/>
194 <copy todir="${classes.dir}/translations">
195 <fileset file="translations/*.qm"/>
199 <target name="jar" depends="compile,resources,release-tr">
200 <jar destfile="${jar.name}" basedir="${classes.dir}"/>
203 <!-- make distribution -->
204 <target name="dist-init" depends="init">
205 <mkdir dir="${dist.dir}"/>
206 <mkdir dir="${dist.dir}/lib"/>
207 <mkdir dir="${dist.dir}/bin"/>
208 <mkdir dir="${dist.dir}/doc"/>
209 <mkdir dir="${dist.dir}/db"/>
210 <mkdir dir="${dist.dir}/logs"/>
213 <target name="dist" depends="jar, dist-init">
214 <copy file="${bin.dir}/${shell.command}" todir="${dist.dir}/bin"/>
215 <copy file="${bin.dir}/${bat.command}" todir="${dist.dir}/bin"/>
216 <copy todir="${dist.dir}/lib">
217 <fileset file="${jar.name}"/>
218 <fileset dir="${lib.dir}"/>
220 <copy todir="${dist.dir}/doc">
221 <fileset file="${doc.changelog}"/>
222 <fileset file="${doc.release}"/>
223 <fileset file="${doc.readme}"/>
224 <fileset dir="${doc.dir}"/>
226 <exec dir="dist" executable="tar">
227 <arg line="czf ../../nevernote-bin.tar.gz ."/>
232 <target name="run-init" depends="init, resources, jar">
234 <mkdir dir="${logs.dir}"/>
235 <mkdir dir="${db.dir}"/>
239 <target name="run" depends="run-init">
240 <java classname="cx.fbn.nevernote.NeverNote"
241 fork="yes" maxmemory="${jvm.xmm}"
242 classpathref="java.classpath" classpath="${jar.name}">
243 <jvmarg value="-XX:NewRatio=${jvm.newratio}"/>
244 <jvmarg value="-X${jvm.gcs}"/>
245 <arg value="--name=${application.name}"/>
249 <!-- script test run -->
250 <target name="run-script" depends="run-if_windows, run-if_linux, run-if_linux64"
251 description="run starter script">
254 <target name="run-if_windows" depends="run-init" if="isWindows">
255 <exec dir="." executable="cmd" os="Windows NT">
256 <arg line="/c ${bin.dir}\${batch.command}"/>
259 <target name="run-if_linux" depends="run-init" if="isLinux">
260 <exec executable="${bin.dir}/${shell.command}"/>
262 <target name="run-if_linux64" depends="run-init" if="isLinux64">
263 <exec executable="${bin.dir}/${shell.command}"/>
268 description="clean up without classes and run env" >
269 <delete dir="${dist.dir}" />
270 <delete file="${jar.name}"/>
273 <target name="all-clean" depends="clean"
274 description="clean up all" >
275 <delete dir="${classes.dir}" />
276 <delete dir="${logs.dir}" />
277 <delete dir="${db.dir}" />
278 <delete file="secure.txt"/>
280 <fileset file="${tr.dir}/*.qm"/>
281 <fileset file="${tr.dir}/*.po"/>