~matsubara/nixnote/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<?xml version='1.0' encoding='utf-8'?>
<project default="jar" basedir=".">
  <!-- program name -->
  <property name="project.name" value="nixnote"/>
  <property name="application.name" value="sandbox"/>

  <!-- targeted QtJambi library version  -->
  <property name="qtjambi.ver" value="4.5.2_01"/>

  <!-- project directory hierarchy -->
  <property name="src.dir" value="src"/>
  <property name="classes.dir" value="build"/>
  <property name="dist.dir" value="dist"/>
  <property name="lib.dir" value="lib"/>
  <property name="bin.dir" value="bin"/>
  <property name="doc.dir" value="doc"/>
  <property name="tr.dir" value="translations"/>

  <!-- needed for running -->

  <!-- debug -->
  <property name="javac.debug" value="true"/>

  <!-- run parameter -->
  <!-- heap -->
  <property name="jvm.xms" value="256M"/><!-- initial memory size -->
  <property name="jvm.xmm" value="512M"/><!-- maximum memory size -->
  <property name="jvm.newratio" value="2"/>
  <property name="jvm.gcs" value="incgc"/><!-- GC strategy -->

  <!-- product jar file -->
  <property name="jar.name" value="nixnote.jar"/>

  <!-- product exec command -->
  <property name="shell.command" value="nixnote.sh"/>
  <property name="bat.command" value="nixnote.bat"/>

  <!-- qt utils -->
  <property name="linguist.update" value="lupdate"/>
  <property name="linguist.release" value="lrelease"/>

  <!-- translations -->
  <property name="linguist.project" value="nixnote.pro"/>

  <!-- documents -->
  <property name="doc.changelog" value="changelog.txt"/>
  <property name="doc.release" value="release.txt"/>
  <property name="doc.readme" value="README.txt"/>

  <!-- check os -->
  <condition property="isWindows">
      <os family="windows" />
  </condition>
  <condition property="isLinux">
      <os name="Linux" arch="i386" />
  </condition>
  <condition property="isLinux64">
      <os name="Linux" arch="amd64" />
  </condition>
  <condition property="isMacOSX">
      <os name="Mac OS X" />
  </condition>

  <!-- flexible looking for qtjambi library path -->
  <target name="set-jambi-path32" depends="set-jambi-path" unless="qtlib.dir">
      <available file="../qtjambi-linux32-lgpl-${qtjambi.ver}"
                 property="qtlib.dir" value="../qtjambi-linux32-lgpl-${qtjambi.ver}"/>
      <available file="../qtjambi-linux32-community-${qtjambi.ver}"
                 property="qtlib.dir" value="../qtjambi-linux32-community-${qtjambi.ver}"/>
  </target>
  <target name="set-jambi-path64" depends="set-jambi-path" unless="qtlib.dir">
      <available file="../qtjambi-linux64-lgpl-${qtjambi.ver}"
                 property="qtlib.dir" value="../qtjambi-linux64-lgpl-${qtjambi.ver}"/>
      <available file="../qtjambi-linux64-community-${qtjambi.ver}"
                 property="qtlib.dir" value="../qtjambi-linux64-community-${qtjambi.ver}"/>
  </target>
  <target name="set-jambi-pathmac" depends="set-jambi-path" unless="qtlib.dir">
      <available file="../qtjambi-macosx-lgpl-${qtjambi.ver}"
                 property="qtlib.dir" value="../qtjambi-macosx-lgpl-${qtjambi.ver}"/>
      <available file="../qtjambi-macosx-community-${qtjambi.ver}"
                 property="qtlib.dir" value="../qtjambi-macosx-community-${qtjambi.ver}"/>
  </target>
  <target name="set-jambi-path" unless="qtlib.dir">
      <available file="${user.home}/lib/qtjambi/qtjambi-${qtjambi.ver}.jar" 
                 property="qtlib.dir" value="${user.home}/lib/qtjambi"/>
      <available file="${user.home}/lib/qtjambi-${qtjambi.ver}.jar" 
                 property="qtlib.dir" value="${user.home}/lib"/>
      <available file="lib/qtjambi-${qtjambi.ver}.jar"
                 property="qtlib.dir" value="lib"/>
  </target>

  <!-- os dependent library path and lib file -->
  <target name="check_syslib_path" depends="lib-if_windows, lib-if_linux, lib-if_linux64"/>

  <target name="lib-if_windows" if="isWindows">
      <property name="system.lib.dir" value="D:/NeverNote/lib"/>
      <property name="qtlib.dir" value="D:/qtjambi-${qtjambi.ver}"/>
      <property name="qtjambi-platform" value="win32-msvc2005"/>
  </target>

  <target name="lib-if_linux" depends="set-jambi-path32" if="isLinux">
      <property name="system.lib.dir" value="/usr/share/java"/>
      <property name="qtjambi.platform" value="linux32-gcc"/>
      <echo message="use qtjambi library at ${qtlib.dir}"/>
  </target>
  <target name="lib-if_linux64" depends="set-jambi-path64" if="isLinux64">
      <property name="system.lib.dir" value="/usr/share/java"/>
      <property name="qtjambi.platform" value="linux64-gcc"/>
      <echo message="use qtjambi library at ${qtlib.dir}"/>
  </target>
  <target name="lib-if_macosx" depends="set-jambi-pathmac" if="isMacOSX">
      <property name="system.lib.dir" value="/Library/Java/Extensions"/>
      <property name="qtjambi.platform" value="macosx-gcc"/>
      <echo message="use qtjambi library at ${qtlib.dir}"/>
  </target>

  <!-- compiler classpath -->
  <target name="set_classpath" depends="check_syslib_path">
    <path id="java.classpath">
      <!-- bundled library -->
      <pathelement location="${lib.dir}/apache-mime4j-0.6.jar"/>
      <pathelement location="${lib.dir}/commons-codec-1.5.jar"/>
      <pathelement location="${lib.dir}/commons-compress-1.2.jar"/>
      <pathelement location="${lib.dir}/commons-lang3-3.0.jar"/>
      <pathelement location="${lib.dir}/commons-logging-1.1.1.jar"/>
      <pathelement location="${lib.dir}/evernote-api-1.20.jar"/>
      <pathelement location="${lib.dir}/libthrift.jar"/>
      <pathelement location="${lib.dir}/log4j-1.2.14.jar"/>
      <pathelement location="${lib.dir}/h2-1.3.158.jar"/>
      <pathelement location="${lib.dir}/jtidy-r938.jar"/>
      <pathelement location="${lib.dir}/httpclient-4.1.1.jar"/>
      <pathelement location="${lib.dir}/httpcore-4.1.jar"/>
      <pathelement location="${lib.dir}/httpmime-4.1.1.jar"/>
      <pathelement location="${lib.dir}/jaxen-1.1.3.jar"/>
      <pathelement location="${lib.dir}/jazzy.jar"/>
      <pathelement location="${lib.dir}/pdfbox-app-1.6.0.jar"/>
      <pathelement location="${lib.dir}/poi-3.7-20101029.jar"/>
      <pathelement location="${lib.dir}/poi-ooxml-3.7.jar"/>
      <pathelement location="${lib.dir}/poi-ooxml-schemas-3.7-20101029.jar"/>
      <pathelement location="${lib.dir}/poi-scratchpad-3.7-20101029.jar"/>
      <pathelement location="${lib.dir}/scribe-1.3.0.jar"/>
      <pathelement location="${lib.dir}/tika.jar"/>
      <pathelement location="${lib.dir}/xmlbeans-2.3.0.jar"/>
      <pathelement location="${lib.dir}/xsdlib-20060615.jar"/>
      <!-- dependent library -->
      <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.ver}.jar"/>
      <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.platform}-${qtjambi.ver}.jar"/>
      <pathelement location="${qtlib.dir}/qtjambi-util-${qtjambi.ver}.jar"/>
    </path>
  </target>

  <target name="init" depends="set_classpath">
    <tstamp/>
    <mkdir dir="${classes.dir}"/>
  </target>

  <!-- translate -->
  <target name="update-tr" depends="update-tr-if_linux, update-tr-if_linux64, update-tr-if_windows"/>
  <target name="update-tr-if_windows" depends="init" if="isWindows">
    <exec dir="." executable="cmd" os="Windows NT">
        <arg line="/c ${bin.dir}\${linguist.update} ${linguist.project}"/>
    </exec>
  </target>
  <target name="update-tr-if_linux" depends="init" if="isLinux">
    <exec executable="${linguist.update}">
        <arg line="${linguist.project}"/>
    </exec>
  </target>
  <target name="update-tr-if_linux64" depends="init" if="isLinux64">
    <exec executable="${linguist.update}">
        <arg line="${linguist.project}"/>
    </exec>
  </target>

  <target name="release-tr" depends="release-tr-if_linux, release-tr-if_linux64, release-tr-if_windows"/>
  <target name="release-tr-if_windows" depends="init" if="isWindows">
    <exec dir="." executable="cmd" os="Windows NT">
        <arg line="/c ${bin.dir}\${linguist.release} ${linguist.project}"/>
    </exec>
  </target>
  <target name="release-tr-if_linux" depends="init" if="isLinux">
    <exec executable="${linguist.release}">
        <arg line="${linguist.project}"/>
    </exec>
  </target>
  <target name="release-tr-if_linux64" depends="init" if="isLinux64">
    <exec executable="${linguist.release}">
        <arg line="${linguist.project}"/>
    </exec>
  </target>

  <!-- build -->
  <target name="compile" depends="init">
    <javac srcdir="${src.dir}"
       destdir="${classes.dir}"
       debug="${javac.debug}"
       includeantruntime="false">
       <classpath refid="java.classpath"/>
    </javac>
  </target>

  <target name="resources" depends="init,release-tr">
      <mkdir dir="${classes.dir}/cx/fbn/nevernote/icons"/>
      <copy todir="${classes.dir}/cx/fbn/nevernote/icons">
	  <fileset dir="${src.dir}/cx/fbn/nevernote/icons"/>
      </copy>
      <mkdir dir="${classes.dir}/translations"/>
      <copy todir="${classes.dir}/translations">
          <fileset file="translations/*.qm"/>
      </copy>
  </target>

  <target name="jar" depends="compile,resources,release-tr">
    <jar destfile="${jar.name}" basedir="${classes.dir}"/>
  </target>

  <!-- make distribution -->
  <target name="dist-init" depends="init">
    <mkdir dir="${dist.dir}"/>
    <mkdir dir="${dist.dir}/lib"/>
    <mkdir dir="${dist.dir}/bin"/>
    <mkdir dir="${dist.dir}/doc"/>
  </target>

  <target name="dist" depends="jar, dist-init">
     <copy file="${bin.dir}/${shell.command}" todir="${dist.dir}/bin"/>
     <copy file="${bin.dir}/${bat.command}" todir="${dist.dir}/bin"/>
     <copy todir="${dist.dir}/lib">
       <fileset file="${jar.name}"/>
       <fileset dir="${lib.dir}"/>
     </copy>
     <copy todir="${dist.dir}/doc">
       <fileset file="${doc.changelog}"/>
       <fileset file="${doc.release}"/>
       <fileset file="${doc.readme}"/>
       <fileset dir="${doc.dir}"/>
     </copy>
     <exec dir="dist" executable="tar">
         <arg line="czf ../../nixnote-bin.tar.gz ."/>
     </exec>
  </target>

  <!-- test run -->
  <target name="run-init" depends="init, resources, jar">
    <tstamp/>
    <mkdir dir="res"/>
  </target>

  <target name="run" depends="run-init">
    <java classname="cx.fbn.nevernote.NeverNote"
      fork="yes" maxmemory="${jvm.xmm}"
      classpathref="java.classpath" classpath="${jar.name}">
      <jvmarg value="-XX:NewRatio=${jvm.newratio}"/>
      <jvmarg value="-X${jvm.gcs}"/>
      <arg value="--name=${application.name}"/>
    </java>
  </target>

  <!-- script test run -->
  <target name="run-script" depends="run-if_windows, run-if_linux, run-if_linux64"
   description="run starter script">
  </target>

  <target name="run-if_windows" depends="run-init" if="isWindows">
    <exec dir="." executable="cmd" os="Windows NT">
        <arg line="/c ${bin.dir}\${batch.command}"/>
    </exec>
  </target>
  <target name="run-if_linux" depends="run-init" if="isLinux">
    <exec executable="${bin.dir}/${shell.command}"/>
  </target>
  <target name="run-if_linux64" depends="run-init" if="isLinux64">
    <exec executable="${bin.dir}/${shell.command}"/>
  </target>

  <!-- clean up -->
  <target name="clean"
   description="clean up without classes and run env" >
    <delete dir="${dist.dir}" />
    <delete file="${jar.name}"/>
  </target>

  <target name="all-clean" depends="clean"
   description="clean up all" >
    <delete dir="${classes.dir}" />
    <delete dir="${logs.dir}" />
    <delete dir="${db.dir}" />
    <delete file="secure.txt"/>
    <delete>
          <fileset file="${tr.dir}/*.qm"/>
          <fileset file="${tr.dir}/*.po"/>
    </delete>
    <delete dir="res"/>
  </target>

</project>