-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
183 lines (155 loc) · 8.04 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
<project basedir="." default="dist-amp" name="Unzip Share action Build Script">
<!-- Allow override properties -->
<property file="module.properties" />
<property file="build.properties" />
<property file="${user.home}/build.properties" />
<property name="jar.file.name" value="${jar.name}-${module.version}.jar" />
<property name="amp.alfresco.file.name" value="${amp.alfresco.name}-v${module.version}.amp" />
<property name="amp.share.file.name" value="${amp.share.name}-v${module.version}.amp" />
<property name="config.includes" value="**/*.*" />
<property name="config.excludes" value="" />
<property name="build.res.includes" value="**/*.*" />
<property name="build.res.excludes" value="**/*.db,**/*.bak" />
<property name="yuicompress.warn" value="false" />
<!-- Additional property values. Generally should not be overridden -->
<property name="config.dir" value="${basedir}/config" />
<property name="web.dir" value="${basedir}/source/web" />
<property name="build.dir" value="${basedir}/build" />
<property name="build.jar.dir" value="${build.dir}/jar" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="build.compile.dir" value="${build.dir}/classes" />
<property name="java.src.dir" value="${basedir}/source/java" />
<property name="javac.debug" value="off" />
<path id="yuicompressor.classpath">
<fileset dir="lib">
<include name="yuicompressor-2.4.2.jar"/>
<include name="yui-compressor-ant-task-0.5.jar"/>
</fileset>
</path>
<taskdef name="yuicompress" classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask">
<classpath>
<path refid="yuicompressor.classpath" />
</classpath>
</taskdef>
<!-- Clean out the build and distribution directories -->
<target name="clean" description="Clean out all build directories">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="clean.js.minify">
<delete includeemptydirs="true">
<fileset dir="${web.dir}" includes="**/*-min.js" />
</delete>
</target>
<!-- Create required prerequisite directory structure -->
<target name="prepare" description="Create initial build structures">
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.compile.dir}" />
</target>
<!-- Compile Java source code -->
<path id="compile.classpath">
<fileset dir="${alfresco.sdk.dir}">
<include name="lib/server/dependencies/**/*.jar" />
<include name="lib/server/*.jar" />
</fileset>
</path>
<available file="${java.src.dir}" type="dir" property="lib.java.src.exists" />
<target name="compile" description="Compile Java source code" if="lib.java.src.exists">
<javac srcdir="${java.src.dir}" destdir="${build.compile.dir}" debug="${javac.debug}">
<classpath>
<path refid="compile.classpath" />
</classpath>
</javac>
</target>
<!-- -->
<!-- Assemble configuration and resource files in a JAR file structure -->
<!-- -->
<target name="build-jar" description="Assemble configuration and resource files in a JAR file structure" depends="compile">
<mkdir dir="${build.jar.dir}" />
<!-- Copy configuration files, web scripts, etc. directly into the JAR so they appear on the
classpath. -->
<copy todir="${build.jar.dir}" includeEmptyDirs="false">
<fileset dir="${config.dir}" includes="${config.includes}">
<!-- Spring config -->
<exclude name="web-application-config.xml" />
<exclude name="surf-config.xml" />
<exclude name="alfresco/slingshot-application-context.xml" />
<exclude name="alfresco/web-extension/custom-slingshot-application-context.xml" />
<!-- Surf config -->
<exclude name="alfresco/share*-config.xml" />
<exclude name="alfresco/web-extension/share-config-custom.xml" />
<!-- Global excludes -->
<exclude name="${config.excludes}" />
</fileset>
</copy>
<copy todir="${build.jar.dir}" includeEmptyDirs="false">
<fileset dir="${build.compile.dir}" includes="**/*.class">
</fileset>
</copy>
<!-- Copy web-tier resources into the JAR. These can then be loaded by browsers via Share's resources
servlet by prefixing their path with '/res' -->
<mkdir dir="${build.jar.dir}/META-INF" />
<copy todir="${build.jar.dir}/META-INF" includeEmptyDirs="false">
<fileset dir="${web.dir}" includes="${build.res.includes}" excludes="${build.res.excludes}" />
</copy>
<!-- Map alfresco/web-extension/share-config-custom.xml to META-INF/share-config-custom.xml in the JAR -->
<copy todir="${build.jar.dir}/META-INF" includeEmptyDirs="false">
<fileset dir="${config.dir}">
<filename name="alfresco/web-extension/share-config-custom.xml" />
</fileset>
<globmapper from="alfresco/web-extension/*.xml" to="*.xml" handledirsep="true" />
</copy>
<!-- Minify JS -->
<yuicompress fromdir="${web.dir}" todir="${build.jar.dir}/META-INF" excludes="**/*-min.js" warn="${yuicompress.warn}">
<include name="**/*.js" />
</yuicompress>
</target>
<!-- -->
<!-- Build a JAR file containing configuration and resource files -->
<!-- -->
<target name="dist-jar" depends="clean, prepare, build-jar"
description="Build a JAR file containing configuration and resource files">
<jar destfile="${dist.dir}/${jar.file.name}">
<fileset dir="${build.jar.dir}" />
</jar>
</target>
<!-- -->
<!-- Assemble configuration and resource files in AMP files -->
<!-- -->
<!-- Package Alfresco JAR file -->
<target name="package-alfresco-jar" depends="compile">
<jar destfile="${build.dir}/${jar.file.name}">
<fileset dir="${build.dir}/classes" excludes="**/*Test*" includes="**/*.class" />
</jar>
</target>
<target name="build-amp" description="Assemble the configuration and resource files in an AMP file structure" depends="package-alfresco-jar">
<!-- Alfresco module -->
<zip destfile="${dist.dir}/${amp.alfresco.file.name}" update="true">
<zipfileset file="${basedir}/module.properties" />
<zipfileset dir="${config.dir}/alfresco/extension" prefix="config/alfresco/module/${module.id}" />
<zipfileset dir="${config.dir}/alfresco/templates" prefix="config/alfresco/extension/templates" />
<zipfileset file="${build.dir}/${jar.file.name}" prefix="lib" />
</zip>
<!-- Share module -->
<zip destfile="${dist.dir}/${amp.share.file.name}" update="true">
<fileset dir="${basedir}/" includes="*.properties" excludes="build.properties" />
<zipfileset dir="${config.dir}/alfresco" prefix="WEB-INF/classes/alfresco" excludes="extension/**,templates/**" />
</zip>
<!-- Minify JS -->
<yuicompress fromdir="${web.dir}" todir="${web.dir}" excludes="**/*-min.js" warn="yuicompress.warn">
<include name="**/*.js" />
</yuicompress>
<zip destfile="${dist.dir}/${amp.share.file.name}" update="true">
<zipfileset dir="${web.dir}" prefix="web" />
</zip>
<!-- Clean -->
<antcall target="clean.js.minify" />
</target>
<!-- -->
<!-- Build AMP files containing configuration and resource files -->
<!-- -->
<target name="dist-amp" depends="clean, prepare, build-amp">
<delete dir="${build.dir}" />
</target>
</project>