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 <!-- os dependent library path and lib file -->
67 <target name="check_syslib_path" depends="lib-if_windows, lib-if_linux, lib-if_linux64"/>
69 <target name="lib-if_windows" if="isWindows">
70 <property name="system.lib.dir" value="D:/NeverNote/lib"/>
71 <property name="qtlib.dir" value="D:/qtjambi-${qtjambi.ver}"/>
72 <property name="qtjambi-platform" value="win32-msvc2005"/>
75 <target name="lib-if_linux" if="isLinux">
76 <property name="system.lib.dir" value="/usr/share/java"/>
77 <property name="qtlib.dir" value="/home/miurahr/lib/qtjambi"/>
78 <property name="qtjambi.platform" value="linux32-gcc"/>
80 <target name="lib-if_linux64" if="isLinux64">
81 <property name="system.lib.dir" value="/usr/share/java"/>
82 <property name="qtlib.dir" value="lib"/>
83 <property name="qtjambi.platform" value="linux64-gcc"/>
85 <target name="lib-if_macosx" if="isMacOSX">
86 <property name="system.lib.dir" value="/Library/Java/Extensions"/>
87 <property name="qtlib.dir" value="lib"/>
88 <property name="qtjambi.platform" value="macosx-gcc"/>
91 <!-- compiler classpath -->
92 <target name="set_classpath" depends="check_syslib_path">
93 <path id="java.classpath">
94 <!-- system third party library -->
95 <pathelement location="${system.lib.dir}/pdfrenderer.jar"/>
96 <pathelement location="${system.lib.dir}/log4j-1.2.jar"/>
97 <pathelement location="${lib.dir}/h2-1.2.136.jar"/>
98 <!-- bundled library -->
99 <pathelement location="${lib.dir}/evernote.jar"/>
100 <pathelement location="${lib.dir}/libthrift.jar"/>
101 <!-- dependent library -->
102 <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.ver}.jar"/>
103 <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.platform}-${qtjambi.ver}.jar"/>
104 <pathelement location="${qtlib.dir}/qtjambi-util-${qtjambi.ver}.jar"/>
108 <target name="init" depends="set_classpath">
110 <mkdir dir="${classes.dir}"/>
114 <target name="update-tr" depends="update-tr-if_linux, update-tr-if_linux64, update-tr-if_windows"/>
115 <target name="update-tr-if_windows" depends="init" if="isWindows">
116 <exec dir="." executable="cmd" os="Windows NT">
117 <arg line="/c ${bin.dir}\${linguist.update} ${linguist.project}"/>
120 <target name="update-tr-if_linux" depends="init" if="isLinux">
121 <exec executable="${linguist.update}">
122 <arg line="${linguist.project}"/>
125 <target name="update-tr-if_linux64" depends="init" if="isLinux64">
126 <exec executable="${linguist.update}">
127 <arg line="${linguist.project}"/>
131 <target name="release-tr" depends="release-tr-if_linux, release-tr-if_linux64, release-tr-if_windows"/>
132 <target name="release-tr-if_windows" depends="init" if="isWindows">
133 <exec dir="." executable="cmd" os="Windows NT">
134 <arg line="/c ${bin.dir}\${linguist.release} ${linguist.project}"/>
137 <target name="release-tr-if_linux" depends="init" if="isLinux">
138 <exec executable="${linguist.release}">
139 <arg line="${linguist.project}"/>
142 <target name="release-tr-if_linux64" depends="init" if="isLinux64">
143 <exec executable="${linguist.release}">
144 <arg line="${linguist.project}"/>
149 <target name="compile" depends="init">
150 <javac srcdir="${src.dir}"
151 destdir="${classes.dir}"
152 debug="${javac.debug}">
153 <classpath refid="java.classpath"/>
157 <target name="resources" depends="init">
158 <mkdir dir="${classes.dir}/cx/fbn/nevernote/icons"/>
159 <copy todir="${classes.dir}/cx/fbn/nevernote/icons">
160 <fileset dir="${src.dir}/cx/fbn/nevernote/icons"/>
162 <copy file="${src.dir}/com/swabunga/spell/engine/configuration.properties"
163 todir="${classes.dir}/com/swabunga/spell/engine/"/>
164 <mkdir dir="${classes.dir}/translations"/>
165 <copy todir="${classes.dir}/translations">
166 <fileset file="translations/*.qm"/>
170 <target name="jar" depends="compile,resources,release-tr">
171 <jar destfile="${jar.name}" basedir="${classes.dir}"/>
174 <!-- make distribution -->
175 <target name="dist-init" depends="init">
176 <mkdir dir="${dist.dir}"/>
177 <mkdir dir="${dist.dir}/lib"/>
178 <mkdir dir="${dist.dir}/bin"/>
179 <mkdir dir="${dist.dir}/doc"/>
180 <mkdir dir="${dist.dir}/db"/>
181 <mkdir dir="${dist.dir}/logs"/>
184 <target name="dist" depends="jar, dist-init">
185 <copy file="${bin.dir}/${shell.command}" todir="${dist.dir}/bin"/>
186 <copy file="${bin.dir}/${bat.command}" todir="${dist.dir}/bin"/>
187 <copy todir="${dist.dir}/lib">
188 <fileset file="${jar.name}"/>
189 <fileset dir="${lib.dir}"/>
191 <copy todir="${dist.dir}/doc">
192 <fileset file="${doc.changelog}"/>
193 <fileset file="${doc.release}"/>
194 <fileset file="${doc.readme}"/>
195 <fileset dir="${doc.dir}"/>
197 <exec dir="dist" executable="tar">
198 <arg line="czf ../../nevernote-bin.tar.gz ."/>
203 <target name="run-init" depends="init, jar">
205 <mkdir dir="${logs.dir}"/>
206 <mkdir dir="${db.dir}"/>
210 <target name="run" depends="run-init">
211 <java classname="cx.fbn.nevernote.NeverNote"
212 fork="yes" maxmemory="${jvm.xmm}"
213 classpathref="java.classpath" classpath="${jar.name}">
214 <jvmarg value="-XX:NewRatio=${jvm.newratio}"/>
215 <jvmarg value="-X${jvm.gcs}"/>
216 <arg value="--name=${application.name}"/>
220 <!-- script test run -->
221 <target name="run-script" depends="run-if_windows, run-if_linux, run-if_linux64"
222 description="run starter script">
225 <target name="run-if_windows" depends="run-init" if="isWindows">
226 <exec dir="." executable="cmd" os="Windows NT">
227 <arg line="/c ${bin.dir}\${batch.command}"/>
230 <target name="run-if_linux" depends="run-init" if="isLinux">
231 <exec executable="${bin.dir}/${shell.command}"/>
233 <target name="run-if_linux64" depends="run-init" if="isLinux64">
234 <exec executable="${bin.dir}/${shell.command}"/>
239 description="clean up without classes and run env" >
240 <delete dir="${dist.dir}" />
241 <delete file="${jar.name}"/>
244 <target name="all-clean" depends="clean"
245 description="clean up all" >
246 <delete dir="${classes.dir}" />
247 <delete dir="${logs.dir}" />
248 <delete dir="${db.dir}" />
249 <delete file="secure.txt"/>