OSDN Git Service

Add logic to display stacks in notebook tree
[neighbornote/NeighborNote.git] / build.xml
index c81c108..f2ceeba 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -2,6 +2,7 @@
 <project default="jar" basedir=".">
   <!-- program name -->
   <property name="project.name" value="nevernote"/>
 <project default="jar" basedir=".">
   <!-- program name -->
   <property name="project.name" value="nevernote"/>
+  <property name="application.name" value="sandbox"/>
 
   <!-- targeted QtJambi library version  -->
   <property name="qtjambi.ver" value="4.6.3"/>
 
   <!-- targeted QtJambi library version  -->
   <property name="qtjambi.ver" value="4.6.3"/>
@@ -13,6 +14,7 @@
   <property name="lib.dir" value="lib"/>
   <property name="bin.dir" value="bin"/>
   <property name="doc.dir" value="doc"/>
   <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 -->
   <property name="db.dir" value="db"/>
 
   <!-- needed for running -->
   <property name="db.dir" value="db"/>
   <property name="shell.command" value="nevernote.sh"/>
   <property name="bat.command" value="nevernote.bat"/>
 
   <property name="shell.command" value="nevernote.sh"/>
   <property name="bat.command" value="nevernote.bat"/>
 
+  <!-- qt utils -->
+  <property name="linguist.update" value="lupdate"/>
+  <property name="linguist.release" value="lrelease"/>
+
+  <!-- translations -->
+  <property name="linguist.project" value="nevernote.pro"/>
+
   <!-- documents -->
   <property name="doc.changelog" value="changelog.txt"/>
   <property name="doc.release" value="release.txt"/>
   <!-- documents -->
   <property name="doc.changelog" value="changelog.txt"/>
   <property name="doc.release" value="release.txt"/>
       <os name="Mac OS X" />
   </condition>
 
       <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"/>
 
   <!-- os dependent library path and lib file -->
   <target name="check_syslib_path" depends="lib-if_windows, lib-if_linux, lib-if_linux64"/>
 
       <property name="qtjambi-platform" value="win32-msvc2005"/>
   </target>
 
       <property name="qtjambi-platform" value="win32-msvc2005"/>
   </target>
 
-  <target name="lib-if_linux" if="isLinux">
+  <target name="lib-if_linux" depends="set-jambi-path32" if="isLinux">
       <property name="system.lib.dir" value="/usr/share/java"/>
       <property name="system.lib.dir" value="/usr/share/java"/>
-      <property name="qtlib.dir" value="/home/miurahr/lib/qtjambi"/>
       <property name="qtjambi.platform" value="linux32-gcc"/>
       <property name="qtjambi.platform" value="linux32-gcc"/>
+      <echo message="use qtjambi library at ${qtlib.dir}"/>
   </target>
   </target>
-  <target name="lib-if_linux64" if="isLinux64">
+  <target name="lib-if_linux64" depends="set-jambi-path64" if="isLinux64">
       <property name="system.lib.dir" value="/usr/share/java"/>
       <property name="system.lib.dir" value="/usr/share/java"/>
-      <property name="qtlib.dir" value="lib"/>
       <property name="qtjambi.platform" value="linux64-gcc"/>
       <property name="qtjambi.platform" value="linux64-gcc"/>
+      <echo message="use qtjambi library at ${qtlib.dir}"/>
   </target>
   </target>
-  <target name="lib-if_macosx" if="isMacOSX">
+  <target name="lib-if_macosx" depends="set-jambi-pathmac" if="isMacOSX">
       <property name="system.lib.dir" value="/Library/Java/Extensions"/>
       <property name="system.lib.dir" value="/Library/Java/Extensions"/>
-      <property name="qtlib.dir" value="lib"/>
       <property name="qtjambi.platform" value="macosx-gcc"/>
       <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">
   </target>
 
   <!-- compiler classpath -->
   <target name="set_classpath" depends="check_syslib_path">
     <path id="java.classpath">
-      <!-- system third party library -->
-      <pathelement location="${system.lib.dir}/pdfrenderer.jar"/>
-      <pathelement location="${system.lib.dir}/log4j-1.2.jar"/>
-      <pathelement location="${lib.dir}/h2-1.2.136.jar"/>
       <!-- bundled library -->
       <pathelement location="${lib.dir}/evernote.jar"/>
       <pathelement location="${lib.dir}/libthrift.jar"/>
       <!-- bundled library -->
       <pathelement location="${lib.dir}/evernote.jar"/>
       <pathelement location="${lib.dir}/libthrift.jar"/>
+      <pathelement location="${lib.dir}/PDFRenderer.jar"/>
+      <pathelement location="${lib.dir}/log4j-1.2.14.jar"/>
+      <pathelement location="${lib.dir}/h2-1.2.136.jar"/>
+      <pathelement location="${lib.dir}/commons-lang-2.4.jar"/>
+      <pathelement location="${lib.dir}/jtidy-r938.jar"/>
       <!-- dependent library -->
       <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.ver}.jar"/>
       <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.platform}-${qtjambi.ver}.jar"/>
       <!-- dependent library -->
       <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.ver}.jar"/>
       <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.platform}-${qtjambi.ver}.jar"/>
     </path>
   </target>
 
     </path>
   </target>
 
-  <!-- build -->
   <target name="init" depends="set_classpath">
     <tstamp/>
     <mkdir dir="${classes.dir}"/>
   </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}"
   <target name="compile" depends="init">
     <javac srcdir="${src.dir}"
        destdir="${classes.dir}"
     </javac>
   </target>
 
     </javac>
   </target>
 
-  <target name="resources" depends="init">
+  <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>
       <copy file="${src.dir}/com/swabunga/spell/engine/configuration.properties"
             todir="${classes.dir}/com/swabunga/spell/engine/"/>
       <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>
       <copy file="${src.dir}/com/swabunga/spell/engine/configuration.properties"
             todir="${classes.dir}/com/swabunga/spell/engine/"/>
+      <mkdir dir="${classes.dir}/translations"/>
+      <copy todir="${classes.dir}/translations">
+          <fileset file="translations/*.qm"/>
+      </copy>
   </target>
 
   </target>
 
-  <target name="jar" depends="compile,resources">
+  <target name="jar" depends="compile,resources,release-tr">
     <jar destfile="${jar.name}" basedir="${classes.dir}"/>
   </target>
 
     <jar destfile="${jar.name}" basedir="${classes.dir}"/>
   </target>
 
   </target>
 
   <!-- test run -->
   </target>
 
   <!-- test run -->
-  <target name="run-init" depends="init, jar">
+  <target name="run-init" depends="init, resources, jar">
     <tstamp/>
     <mkdir dir="${logs.dir}"/>
     <mkdir dir="${db.dir}"/>
     <tstamp/>
     <mkdir dir="${logs.dir}"/>
     <mkdir dir="${db.dir}"/>
       classpathref="java.classpath" classpath="${jar.name}">
       <jvmarg value="-XX:NewRatio=${jvm.newratio}"/>
       <jvmarg value="-X${jvm.gcs}"/>
       classpathref="java.classpath" classpath="${jar.name}">
       <jvmarg value="-XX:NewRatio=${jvm.newratio}"/>
       <jvmarg value="-X${jvm.gcs}"/>
+      <arg value="--name=${application.name}"/>
     </java>
   </target>
 
     </java>
   </target>
 
     <delete dir="${logs.dir}" />
     <delete dir="${db.dir}" />
     <delete file="secure.txt"/>
     <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>
 
     <delete dir="res"/>
   </target>