-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
125 lines (113 loc) · 5.24 KB
/
build.xml
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
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright (c) 2011, Carlos Tse <copperoxide@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<project name="jopencc" default="run" basedir=".">
<property name="jar.fileName" value="jopencc" />
<property name="main.class" value="jopencc.Main" />
<property name="class.home" value="bin" />
<property name="build.dir" value="build" />
<property name="src.dir" value="./src/main/java" />
<property name="res.dir" value="./src/main/resources" />
<property name="swt.jar" value="../org.eclipse.swt/org.eclipse.swt.cocoa.macosx.x86_64-4.3.jar" />
<!-- <property name="swt.jar" value="../org.eclipse.swt/org.eclipse.swt.win32.win32.x86_64<" /> -->
<!-- <property name="swt.jar" value="../org.eclipse.swt/org.eclipse.swt.gtk.linux.x86_64" /> -->
<target name="clean" depends="" description="clean the project">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${class.home}" includes="**/*"/>
<fileset dir="${build.dir}" includes="**/*"/>
</delete>
</target>
<target name="prepare" depends="" description="prepare to build">
<mkdir dir="${class.home}" />
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir}/data" />
</target>
<target name="compile" depends="prepare" description="compile java classess">
<javac destdir="${class.home}"
debug="true" debuglevel="lines,vars,source"
optimize="on" deprecation="on" verbose="on"
encoding="utf-8" source="1.7" target="1.7" nowarn="true">
<src path="${src.dir}" />
<exclude name="test/**" />
<!-- Define CLASSPATH -->
<classpath>
<!-- Include SWT libraries -->
<pathelement location="${swt.jar}"/>
<!-- Include Servlet and SEM core class path -->
<pathelement path="${java.class.path}" />
</classpath>
</javac>
<exec executable="native2ascii">
<arg line="-encoding UTF-8 ${res.dir}/interface.zhs.properties ${class.home}/interface_zh_CN.properties"/>
</exec>
<exec executable="native2ascii">
<arg line="-encoding UTF-8 ${res.dir}/interface.zht.properties ${class.home}/interface_zh.properties"/>
</exec>
<exec executable="native2ascii">
<arg line="-encoding UTF-8 ${res.dir}/interface.en.properties ${class.home}/interface.properties"/>
</exec>
</target>
<target name="lib" depends="compile" description="build the library without GUI">
<jar jarfile="${build.dir}/${jar.fileName}-lib.jar">
<fileset dir="bin" includes="**/*.class">
<exclude name="jopencc/gui/*.class"/>
</fileset>
<fileset dir="." includes="*.properties" />
</jar>
</target>
<target name="build" depends="compile" description="build the GUI program">
<jar jarfile="${build.dir}/${jar.fileName}.jar">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="./"/>
</manifest>
<fileset dir="${class.home}">
<include name="**/*.class" />
<include name="*.properties" />
</fileset>
<!-- fileset dir="bin" includes="*.properties" / -->
<zipfileset src="${swt.jar}" excludes="META-INF/*" />
</jar>
<!-- don't want the following files included in the jar file -->
<copy overwrite="yes" file="icon.png" todir="${build.dir}" />
<copy todir="${build.dir}">
<fileset dir="." includes="*.properties" />
</copy>
<copy todir="${build.dir}/data">
<fileset dir="data" includes="*.txt" />
</copy>
</target>
<target name="run" depends="build" description="run the application">
<java jar="${build.dir}/${jar.fileName}.jar" fork="true">
<jvmarg value="-Xms32M" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-Xmn16M" />
<!--
<jvmarg value="-XX:PermSize=32M" />
<jvmarg value="-XX:MaxPermSize=256m" />
-->
</java>
</target>
</project>