-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
177 lines (152 loc) · 5.34 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
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
<project name="ssgallery" basedir="." default="build">
<property name="project.dir" location="." />
<property name="build.dir" location="${project.dir}\build" />
<property file="${basedir}/build.properties" />
<property name="conf.prod.dir" location="${project.dir}\conf\prod" />
<property name="conf.example.dir" location="${project.dir}\conf\example" />
<property file="${project.dir}/scripts/prod/remote.host.properties" />
<target name="build">
<antcall target="clean" />
<antcall target="create-build-dir" />
<antcall target="copy-resources" />
<antcall target="copy-example-conf" />
<antcall target="compile" />
<antcall target="remove-gwt-classes-from-classes" />
<antcall target="create-jar" />
<antcall target="compile-gwt" />
<antcall target="clean-after-build" />
</target>
<target name="build-prod">
<antcall target="clean" />
<antcall target="create-build-dir" />
<antcall target="copy-resources" />
<antcall target="copy-prod-conf" />
<antcall target="compile" />
<antcall target="remove-gwt-classes-from-classes" />
<antcall target="create-jar" />
<antcall target="compile-gwt" />
<antcall target="clean-after-build" />
<antcall target="deploy" />
</target>
<target name="clean" description="Cleans build directory">
<delete dir="${build.dir}">
</delete>
</target>
<target name="create-build-dir">
<mkdir dir="${build.dir}">
</mkdir>
<mkdir dir="${build.dir}/logs">
</mkdir>
</target>
<target name="copy-prod-conf">
<copy todir="${build.dir}/conf">
<fileset dir="${conf.prod.dir}">
</fileset>
</copy>
</target>
<target name="copy-example-conf">
<copy todir="${build.dir}/conf">
<fileset dir="${conf.example.dir}">
</fileset>
</copy>
</target>
<target name="copy-resources">
<copy todir="${build.dir}/war">
<fileset dir="${project.dir}/war">
<exclude name="gallery/**" />
<exclude name="WEB-INF/**" />
</fileset>
</copy>
<copy todir="${build.dir}/lib">
<fileset dir="${project.dir}/lib">
</fileset>
</copy>
<copy todir="${build.dir}/launch">
<fileset dir="${project.dir}/launch">
</fileset>
</copy>
<copy todir="${build.dir}">
<fileset dir="${project.dir}">
<include name="ssgallery.bat" />
</fileset>
</copy>
</target>
<path id="project.classpath">
<pathelement path="${build.dir}/classes" />
<fileset dir="${build.dir}/lib">
<include name="**/*.jar" />
</fileset>
<pathelement location="${gwt.sdk}/gwt-user.jar" />
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar" />
</path>
<target name="compile" description="Compiles Java source">
<copy todir="${build.dir}/classes">
<fileset dir="${project.dir}/src">
<exclude name="**/*.java" />
<exclude name="**/*ui.xml" />
<exclude name="**/*gwt.xml" />
</fileset>
</copy>
<javac srcdir="${project.dir}/src" destdir="${build.dir}/classes" classpathref="project.classpath" debug="on" encoding="utf-8" source="1.6" target="1.6" failonerror="true" />
</target>
<target name="create-jar">
<jar destfile="${build.dir}/lib/ssgallery-${build.number}.jar" basedir="${build.dir}/classes">
</jar>
</target>
<target name="remove-gwt-classes-from-classes">
<delete dir="${build.dir}/classes/com/ss/gallery/client">
</delete>
</target>
<target name="compile-gwt">
<antcall target="compile-gwt-impl">
<param name="module.name" value="com.ss.gallery.Gallery" />
</antcall>
</target>
<target name="compile-gwt-impl">
<path id="gwt.classpath.ref">
<fileset dir="${gwt.sdk}" includes="*.jar" />
<pathelement path="${project.dir}/src" />
<pathelement path="${build.dir}/classes" />
</path>
<property name="gwt.classpath" refid="gwt.classpath.ref" />
<echo message="gwt.classpath = ${gwt.classpath}" />
<java fork="yes" classname="com.google.gwt.dev.Compiler" failonerror="true">
<classpath refid="gwt.classpath.ref" />
<jvmarg value="-Xms512m" />
<jvmarg value="-Xmx1024m" />
<arg value="-style" />
<arg value="OBF" />
<arg value="-localWorkers" />
<arg value="3" />
<arg value="-war" />
<arg value="${build.dir}/war" />
<!--<arg line="${int.gwt-compile-report}" />-->
<!--<arg value="-compileReport"/>-->
<!--<arg value="-extra"/>-->
<!--<arg value="${root.dir}\web\tmp"/>-->
<!--<arg value="-XdisableCastChecking" />-->
<!--<arg value="-XdisableClassMetadata" />-->
<!--<arg value="-logLevel" />
<arg value="DEBUG" />-->
<!--<arg line="${int.gwt-draft-compile}" />-->
<arg value="${module.name}" />
</java>
</target>
<target name="clean-after-build">
<delete dir="${build.dir}/classes">
</delete>
<delete dir="${build.dir}/gwt-unitCache">
</delete>
</target>
<target name="deploy">
<sshexec host="${host}" username="${user}" password="${password}" trust="true" command="rm -fr ${remote.path}" />
<sshexec host="${host}" username="${user}" password="${password}" trust="true" command="mkdir ${remote.path}" />
<scp todir="${user}:${password}@${host}:${remote.path}" trust="true">
<fileset dir="${build.dir}" />
</scp>
<!--
TODO: ssh user can not bind to port 80
<sshexec host="${host}" username="${user}" password="${password}" trust="true" command="${ssgallery.script} restart" />
-->
</target>
</project>