forked from samizzo/monbulk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
201 lines (187 loc) · 9.16 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<project name="Monbulk" default="deploy-localhost" basedir=".">
<!--Read properties from file-->
<property file="build.properties" />
<!--Set default locations-->
<property name="src" location="./src" />
<property name="pkg" location="./pkg" />
<property name="lib" location="./lib" />
<property name="build" location="${build.base}/${app.name}" />
<property name="dist" location="${dist.base}/${app.name}" />
<property name="pkg.file" value="mfpkg-${app.name}-${app.version}-mf${mf.server.version}.zip" />
<path id="project.class.path">
<pathelement location="${lib}/gwt-user.jar" />
<pathelement location="${lib}/gwt-dev.jar" />
<pathelement location="${lib}/gwt-dnd.jar" />
<pathelement location="${lib}/Daris-1.0" />
<pathelement location="${lib}/gwt-servlet.jar" />
<pathelement location="${lib}/gwt-servlet-deps.jar" />
<pathelement location="${lib}/validation-api-1.0.0.GA.jar" />
<pathelement location="${lib}/validation-api-1.0.0.GA-sources.jar" />
<pathelement location="${lib}/mfclientgwt.jar" />
<pathelement location="${lib}/mfclientguigwt.jar" />
<pathelement location="${lib}/adesktopplugingwt.jar" />
<pathelement location="${lib}/totoe-0.4.jar" />
<pathelement location="${lib}/validation-api-1.0.0.GA.jar" />
<pathelement location="${build}" />
</path>
<macrodef name="mfcommand">
<attribute name="command" />
<attribute name="host" />
<attribute name="port" />
<attribute name="transport" />
<attribute name="domain" />
<attribute name="user" />
<attribute name="password" />
<sequential>
<java classname="arc.mf.command.Execute" fork="true" failonerror="false" maxmemory="128m" outputproperty="mf.sid" resultproperty="mf.exit.code">
<jvmarg value="-Djava.net.preferIPv4Stack=true" />
<jvmarg value="-Dmf.host=@{host}" />
<jvmarg value="-Dmf.port=@{port}" />
<jvmarg value="-Dmf.transport=@{transport}" />
<arg line="logon @{domain} @{user} @{password}" />
<classpath>
<pathelement location="${lib}/aterm.jar" />
</classpath>
</java>
<fail message="Failed to log on to Mediaflux server '@{host}:@{port}'. ExitCode=${mf.exit.code}">
<condition>
<not>
<equals arg1="${mf.exit.code}" arg2="0" />
</not>
</condition>
</fail>
<java classname="arc.mf.command.Execute" fork="true" failonerror="true" maxmemory="128m">
<jvmarg value="-Djava.net.preferIPv4Stack=true" />
<jvmarg value="-Dmf.host=@{host}" />
<jvmarg value="-Dmf.port=@{port}" />
<jvmarg value="-Dmf.transport=@{transport}" />
<jvmarg value="-Dmf.sid=${mf.sid}" />
<arg line="@{command}" />
<classpath>
<pathelement location="${lib}/aterm.jar" />
</classpath>
</java>
<java classname="arc.mf.command.Execute" fork="true" failonerror="true" maxmemory="128m">
<jvmarg value="-Djava.net.preferIPv4Stack=true" />
<jvmarg value="-Dmf.host=@{host}" />
<jvmarg value="-Dmf.port=@{port}" />
<jvmarg value="-Dmf.transport=@{transport}" />
<jvmarg value="-Dmf.sid=${mf.sid}" />
<arg line="logoff" />
<classpath>
<pathelement location="${lib}/aterm.jar" />
</classpath>
</java>
</sequential>
</macrodef>
<target name="clean" description="clean up everything.">
<delete dir="${build}" failonerror="false" />
<delete dir="${dist}" failonerror="false" />
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="war/monbulk" failonerror="false" />
<mkdir dir="${build}" />
<mkdir dir="${dist}" />
<mkdir dir="war/WEB-INF/classes" />
<mkdir dir="war/monbulk" />
</target>
<target name="javac" depends="clean" description="compile the java source.">
<replace file="${src}/monbulk/client/Version.java" token="@version@" value="${app.version}" />
<javac srcdir="${src}" includes="**" encoding="utf-8" destdir="war/WEB-INF/classes" source="1.5" target="1.5" nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path" />
</javac>
<copy todir="war/WEB-INF/classes">
<fileset dir="src" excludes="**/*.java" />
</copy>
</target>
<target name="gwtc" depends="javac" description="GWT compile to Javascript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="${src}" />
<path refid="project.class.path" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx512M" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}" />
<arg value="monbulk.Monbulk" />
</java>
<replace file="${src}/monbulk/client/Version.java" token="${app.version}" value="@version@" />
</target>
<target name="devmode" depends="javac" description="Run development mode">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="${src}" />
<path refid="project.class.path" />
</classpath>
<jvmarg value="-Xmx256M" />
<arg value="-noserver" />
<arg value="-startupUrl" />
<arg value="${mf.transport}://${mf.host}:${mf.port}/monbulk/Monbulk.html" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}" />
<arg value="Monbulk" />
</java>
</target>
<target name="package" depends="gwtc" description="build Mediaflux package.">
<!-- zip the www contents to www.zip -->
<zip basedir="war" includes="**/*" excludes="**/WEB-INF/** **/testdata/** **/*.log **/images/*.psd" destfile="${build}/www.zip" />
<!-- prepare the MFLUX package contents -->
<delete file="${build}/__manifest.xml" />
<tstamp>
<format property="build_time" pattern="dd-MMM-yyyy kk:mm:ss z" />
</tstamp>
<copy file="${pkg}/__manifest.xml" tofile="${build}/__manifest.xml" />
<replace file="${build}/__manifest.xml" token="@version@" value="${app.version}" />
<replace file="${build}/__manifest.xml" token="@build-time@" value="${build_time}" />
<copy file="${pkg}/requireServerVersion.tcl" tofile="${build}/requireServerVersion.tcl" overwrite="true" />
<replace file="${build}/requireServerVersion.tcl" token="@requiredVersion@" value="${mf.server.version}"/>
<!-- zip the MFLUX package -->
<zip filesonly="true" destfile="${dist}/${pkg.file}">
<fileset file="${build}/www.zip" />
<fileset file="${pkg}/__install.tcl" />
<fileset file="${pkg}/dictionary.tcl" />
<fileset file="${pkg}/roles.tcl" />
<fileset file="${pkg}/metadata.tcl" />
<fileset file="${pkg}/monbulk-config.tcl" />
<fileset file="${pkg}/__uninstall.tcl" />
<fileset file="${build}/requireServerVersion.tcl" />
<fileset file="${build}/__manifest.xml" />
</zip>
<delete file="${build}/__manifest.xml" />
<delete file="${build}/www.zip" />
</target>
<target name="deploy-localhost" depends="package" description="install the monbulk package.">
<mfcommand host="${localhost.host}" port="${localhost.port}" transport="${localhost.transport}" domain="${localhost.domain}" user="${localhost.user}" password="${localhost.password}" command="package.install :in file:${dist}/${pkg.file}" />
</target>
<target name="deploy-medimage" description="install the monbulk package.">
<mfcommand host="${medimage.host}" port="${medimage.port}" transport="${medimage.transport}" domain="${medimage.domain}" user="${medimage.user}" password="${medimage.password}" command="package.install :in file:${dist}/${pkg.file}" />
</target>
<macrodef name="promptAndValidate">
<attribute name="message" />
<attribute name="property" />
<attribute name="errorMessage" />
<attribute name="defaultValue" />
<sequential>
<input message="@{message}" addproperty="@{property}" defaultvalue="@{defaultValue}" />
<fail message="@{errorMessage}">
<condition>
<equals arg1="${@{property}}" arg2="" trim="true" />
</condition>
</fail>
</sequential>
</macrodef>
<target name="deploy" depends="package" description="install the monbulk package.">
<echo message="Monbulk package installer" />
<echo message="-------------------------" />
<echo message="" />
<echo message="Please answer the following questions to deploy Monbulk." />
<promptAndValidate message="Hostname to deploy to?" property="host" defaultValue="" errorMessage="No hostname specified!" />
<promptAndValidate message="Port?" property="port" defaultValue="443" errorMessage="No port specified!" />
<promptAndValidate message="Transport?" property="transport" defaultValue="http" errorMessage="No transport specified!" />
<promptAndValidate message="Domain?" property="domain" defaultValue="" errorMessage="No domain specified!" />
<promptAndValidate message="User?" property="user" defaultValue="" errorMessage="No user specified!" />
<promptAndValidate message="Password?" property="password" defaultValue="" errorMessage="No password specified!" />
<echo message="Deploying to MediaFlux instance on ${host}:${port}.." />
<mfcommand host="${host}" port="${port}" transport="${transport}" domain="${domain}" user="${user}" password="${password}" command="package.install :in file:${dist}/${pkg.file}" />
</target>
</project>