-
Notifications
You must be signed in to change notification settings - Fork 212
/
build.xml
148 lines (133 loc) · 5.97 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?xml version="1.0" encoding="UTF-8"?>
<project name="jcseg" default="usage" basedir=".">
<!--Initialize-->
<target name="init">
<echo message="------------------------------------------------------------"/>
<echo message="----------BUILDING JCSEG PACKAGE----------------------------"/>
<echo message=""/>
<property name="bottom" value="jcseg 2012-2017"/>
<property name="jars" value="${basedir}"/>
<property name="sources" value="${basedir}/src"/>
<property name="classes" value="${basedir}/classes"/>
<property name="version" value="2.4.1"/>
<property name="lib.dir" value="${basedir}/vendors/lib"/>
<property name="api" value="${basedir}/doc"/>
<!--maven modules-->
<property name="mvn.main" value="src/main/java"/>
<property name="mvn.test" value="src/test/java"/>
<property name="core" value="jcseg-core"/>
<property name="analyzer" value="jcseg-analyzer"/>
<property name="elasticsearch" value="jcseg-elasticsearch"/>
<property name="server" value="jcseg-server"/>
<property name="jdk.version" value="1.8"/>
<delete dir="${classes}"/>
<delete dir="${sources}"/>
<delete dir="${api}"/>
<mkdir dir="${sources}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${api}"/>
<!--copy maven sub module sources to the src-->
<echo message="Coping sources of ${core}/${mvn.main} to ${sources}"/>
<copy todir="${sources}">
<fileset dir="${basedir}/${core}/${mvn.main}"/>
</copy>
<echo message="Coping lexicons to ${classes}"/>
<copy todir="${classes}/lexicon">
<fileset dir="${basedir}/vendors/lexicon"/>
</copy>
<echo message="Coping sources of ${analyzer} to ${sources}"/>
<copy todir="${sources}">
<fileset dir="${basedir}/${analyzer}/${mvn.main}"/>
</copy>
<echo message="Coping sources of ${elasticsearch} to ${sources}"/>
<copy todir="${sources}">
<fileset dir="${basedir}/${elasticsearch}/${mvn.main}"/>
</copy>
<echo message="Coping sources of ${server} to ${sources}"/>
<copy todir="${sources}">
<fileset dir="${basedir}/${server}/${mvn.main}"/>
</copy>
<!--specifal resource to copy-->
<copy file="${basedir}/jcseg.properties" todir="${classes}"/>
<copy file="${basedir}/jcseg-server.properties" todir="${classes}"/>
<copy todir="${classes}/res">
<fileset dir="${basedir}/${server}/${mvn.main}/res"/>
</copy>
</target>
<!--Build-->
<target name="build" depends="init">
<echo message="-------------Compiling Application--------------"/>
<echo message="${lib.dir}"/>
<javac srcdir="${sources}" destdir="${classes}" source="${jdk.version}" target="${jdk.version}">
<classpath>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
</classpath>
</javac>
</target>
<!--Archive-->
<target name="dist" depends="build">
<jar jarfile="${jars}/jcseg-core-${version}.jar" basedir="${classes}"
includes="org/lionsoul/jcseg/extractor/**/*,org/lionsoul/jcseg/sentence/**/*,org/lionsoul/jcseg/test/**/*,
org/lionsoul/jcseg/tokenizer/**/*,org/lionsoul/jcseg/util/*,jcseg.properties,lexicon/**/*">
<!--manifest information setting-->
<manifest>
<attribute name="Main-Class" value="org.lionsoul.jcseg.test.JcsegTest"/>
<attribute name="Class-Path" value=""/>
</manifest>
</jar>
<jar jarfile="${jars}/jcseg-analyzer-${version}.jar" basedir="${classes}"
includes="org/lionsoul/jcseg/analyzer/**/*"/>
<jar jarfile="${jars}/jcseg-elasticsearch-${version}.jar" basedir="${classes}"
includes="org/lionsoul/jcseg/elasticsearch/**/*,es-plugin.properties"/>
<jar jarfile="${jars}/jcseg-server-${version}.jar" basedir="${classes}"
includes="org/lionsoul/jcseg/server/**/*,org/lionsoul/jcseg/json/**/*,res/**/*,jcseg-server.properties">
<!--manifest information setting-->
<manifest>
<attribute name="Main-Class" value="org.lionsoul.jcseg.server.JcsegServer"/>
<attribute name="Class-Path" value=""/>
</manifest>
</jar>
</target>
<!--Java document-->
<target name="all" depends="dist">
<echo message="------------Making Java Document------------------"/>
<javadoc packagenames="org.*"
sourcepath="${sources}"
destdir="${api}"
bottom="${bottom}"
charset="UTF-8"
author="false">
<classpath>
<pathelement location="${classes}"/>
</classpath>
</javadoc>
<jar jarfile="${jars}/jcseg-${version}-javadoc.jar" basedir="${api}" includes="**/*"></jar>
<!--clean-->
<delete dir="${classes}"/>
<delete dir="${api}"/>
<delete dir="${sources}"/>
</target>
<!--project clean-->
<target name="clean">
<echo message="------------Cleaning project------------------"/>
<!--clean-->
<delete dir="${classes}"/>
<delete dir="${sources}"/>
<delete dir="${api}"/>
<delete>
<fileset dir="${basedir}" includes="*.jar"/>
</delete>
</target>
<target name="usage">
<echo message="*** Jcseg ANT Build Script ***"/>
<echo message="Usage: "/>
<echo message=" ant [target]"/>
<echo message=""/>
<echo message="target : "/>
<echo message=" build : Build Application"/>
<echo message=" dist : Build Application + Archive (JAR)"/>
<echo message=" all : Build Application + Archive + JavaDoc"/>
</target>
</project>