-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
211 lines (182 loc) · 6.69 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
202
203
204
205
206
207
208
209
210
211
<project name="zoho" default="package">
<property name="alf.src.dir" location="../alf-src" />
<property name="work.dir" value="work" />
<property name="bin.dir" location="${work.dir}/bin" />
<property name="lib.dir" location="lib" />
<property name="dist.dir" location="dist" />
<property name="alf.lib.dir" location="${alf.src.dir}/projects/web-client/build/assemble/WEB-INF/lib/" />
<property name="yui-compressor" location="${alf.src.dir}/projects/3rd-party/lib/devenv/yuicompressor-2.4.2.jar" />
<property name="explorer.src.dir" location="src-explorer"/>
<property name="explorer.jar.filename" value="explorer-zoho.jar" />
<property name="explorer.config.dir" value="config-explorer" />
<property name="explorer.amp.dir" location="amp-explorer" />
<property name="explorer.amp.filename" value="explorer-zoho.amp" />
<property name="share.src.dir" location="src-share"/>
<property name="share.jar.filename" value="share-zoho.jar" />
<property name="share.config.dir" value="config-share" />
<property name="share.amp.dir" location="amp-share" />
<property name="share.amp.filename" value="share-zoho.amp" />
<property name="ZiaAlfresco.dir" location="../ZiaAlfresco"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/antlib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<buildnumber file="${basedir}/ant.build" />
<target name="setup">
<delete dir="${bin.dir}" />
<delete dir="${work.dir}" />
<mkdir dir="${bin.dir}" />
<mkdir dir="${lib.dir}" />
<mkdir dir="${work.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<target name="clean">
<delete dir="${bin.dir}" />
<delete dir="${work.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="build-explorer-dependencies" depends="setup">
<ant antfile="${ZiaAlfresco.dir}/build.xml" dir="${ZiaAlfresco.dir}" target="compile" inheritall="false">
<property name="alf.lib.dir" value="${alf.lib.dir}" />
</ant>
</target>
<target name="compile-explorer" depends="setup,build-explorer-dependencies">
<javac srcdir="${explorer.src.dir}" destdir="${bin.dir}" debug="on">
<classpath>
<fileset dir="${alf.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<pathelement path="${ZiaAlfresco.dir}/build/classes"/>
</classpath>
</javac>
</target>
<target name="compile-share" depends="setup">
<javac srcdir="${basedir}/src-share" destdir="${bin.dir}" debug="on">
<classpath>
<fileset dir="${alf.lib.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="package" description="Package both AMPS, tag the repository">
<antcall target="package-share" />
<delete dir="${work.dir}" />
<antcall target="package-explorer" />
<delete dir="${work.dir}" />
<antcall target="tag-git" />
</target>
<target name="package-explorer" depends="compile-explorer">
<package-amp-impl amp-name="${explorer.amp.filename}" config-directory="${explorer.config.dir}"
jar-name="${explorer.jar.filename}" module-properties="${explorer.amp.dir}/module.properties"
lib-directory="${lib.dir}" web-directory="web-explorer" />
</target>
<target name="package-share" depends="compile-share">
<package-amp-impl amp-name="${share.amp.filename}" config-directory="${share.config.dir}"
jar-name="${share.jar.filename}" module-properties="${share.amp.dir}/module.properties"
lib-directory="${lib.dir}" web-directory="web-share" />
</target>
<target name="compress-js" description="Compress the javascript">
<echo>Compressing Javascript</echo>
<apply executable="java" parallel="false" dest="${work.dir}/web/">
<fileset dir="${work.dir}/web/">
<include name="**/*.js" />
</fileset>
<arg line="-jar" />
<arg path="${yui-compressor}" />
<arg line="-o" />
<targetfile />
<srcfile />
<mapper type="glob" from="*.js" to="*-min.js" />
</apply>
</target>
<target name="tag-git">
<echo message="Tagging as v${build.number}"/>
<exec executable="git" dir="${basedir}">
<arg value="tag" />
<arg value="-a" />
<arg value="-m "Tagging build with v.${build.number}"" />
<arg value="v${build.number}" />
</exec>
<exec executable="git" dir="${basedir}">
<arg value="push"/>
<arg value="--tags"/>
</exec>
</target>
<macrodef name="package-amp-impl">
<attribute name="module-properties" />
<attribute name="config-directory" />
<attribute name="web-directory" default="" />
<attribute name="jar-name" />
<attribute name="amp-name" />
<attribute name="lib-directory" default=""/>
<sequential>
<!-- Make AMP Structure -->
<mkdir dir="${work.dir}/config" />
<mkdir dir="${work.dir}/lib" />
<mkdir dir="${work.dir}/web" />
<!-- Copy in files -->
<!-- config dir -->
<copy todir="${work.dir}/config/">
<fileset dir="${basedir}/@{config-directory}">
<exclude name="**/*~" />
<exclude name="**/.gitignore"/>
<!--
Amps should not include the global.properties which is machine specific. This is only for development.
-->
<exclude name="**/alfresco-global.properties"/>
<exclude name="**/log4j.properties"/>
<exclude name="**/extension/license/"/>
<exclude name="**/extension/templates/alf_data/"/>
</fileset>
</copy>
<!-- lib dir -->
<if>
<not>
<equals arg1="@{lib-directory}" arg2=""/>
</not>
<then>
<copy todir="${work.dir}/lib/" failonerror="false">
<fileset dir="@{lib-directory}">
<exclude name="**/*~" />
<exclude name="**/.gitignore"/>
<exclude name="**/*-src.zip"/>
<exclude name="**/*-javadoc.jar"/>
</fileset>
</copy>
</then>
</if>
<!-- web dir -->
<if>
<not>
<equals arg1="@{web-directory}" arg2=""/>
</not>
<then>
<copy todir="${work.dir}/web/" failonerror="false">
<fileset dir="${basedir}/@{web-directory}">
<exclude name="**/*~" />
<exclude name="**/.gitignore"/>
</fileset>
</copy>
</then>
</if>
<antcall target="compress-js"/>
<!-- copy over the java code -->
<jar destfile="${work.dir}/lib/@{jar-name}">
<fileset dir="${bin.dir}" includes="com/**" />
</jar>
<delete dir="${bin.dir}" />
<!-- copy the properties file -->
<copy file="@{module-properties}" tofile="${work.dir}/module.properties" />
<!-- Replace special token in module.properties -->
<replace casesensitive="true" file="${work.dir}/module.properties" token="VERSION_STRING" value="${build.number}" />
<!-- make the amp -->
<zip destfile="${dist.dir}/@{amp-name}" basedir="${work.dir}" />
<echo message="Created amp @{amp-name}" />
</sequential>
</macrodef>
</project>