forked from iwayvietnam/zm-sso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
239 lines (220 loc) · 10.4 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!--
* ***** BEGIN LICENSE BLOCK *****
* Zm SSO is the Zimbra Collaboration Open Source Edition extension for single sign-on authentication to the Zimbra Web Client.
* Copyright (C) 2020-present iWay Vietnam and/or its affiliates. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* ***** END LICENSE BLOCK *****
*
* Zimbra Single Sign On
*
* Written by Nguyen Van Nguyen <nguyennv1981@gmail.com>
-->
<project name="zm-sso" default="jar" basedir=".">
<description>
Build file for the Zm SSO.
</description>
<property name="version" value="1.0.0"/>
<property name="release" value="1"/>
<property name="lib" value="lib/"/>
<property name="deps" value="deps/"/>
<property name="build" value="build/"/>
<property name="dist" value="dist/"/>
<property name="src" value="src/"/>
<property name="resources" value="src/main/resources"/>
<property name="jar" value="zm-sso-${version}-${release}.jar"/>
<property name="javac.source" value="1.8"/>
<property name="javac.target" value="1.8"/>
<path id="libraries">
<fileset dir="${lib}" >
<include name="*.jar"/>
</fileset>
<fileset dir="${deps}" >
<include name="*.jar"/>
</fileset>
</path>
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="check-servlet-api">
<condition property="available-servlet-api">
<available file="${deps}/javax.servlet-api-3.1.0.jar" />
</condition>
</target>
<target name="download-servlet-api" depends="check-servlet-api" unless="available-servlet-api">
<get src="https://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"
dest="${deps}/javax.servlet-api-3.1.0.jar" usetimestamp="true"/>
</target>
<target name="check-pac4j-core">
<condition property="available-pac4j-core">
<available file="${deps}/pac4j-core-4.4.0.jar" />
</condition>
</target>
<target name="download-pac4j-core" depends="check-pac4j-core" unless="available-pac4j-core">
<get src="https://repo1.maven.org/maven2/org/pac4j/pac4j-core/4.4.0/pac4j-core-4.4.0.jar"
dest="${deps}/pac4j-core-4.4.0.jar" usetimestamp="true"/>
</target>
<target name="check-pac4j-cas">
<condition property="available-pac4j-cas">
<available file="${deps}/pac4j-cas-4.4.0.jar" />
</condition>
</target>
<target name="download-pac4j-cas" depends="check-pac4j-cas" unless="available-pac4j-cas">
<get src="https://repo1.maven.org/maven2/org/pac4j/pac4j-cas/4.4.0/pac4j-cas-4.4.0.jar"
dest="${deps}/pac4j-cas-4.4.0.jar" usetimestamp="true"/>
</target>
<target name="check-pac4j-oidc">
<condition property="available-pac4j-oidc">
<available file="${deps}/pac4j-oidc-4.4.0.jar" />
</condition>
</target>
<target name="download-pac4j-oidc" depends="check-pac4j-oidc" unless="available-pac4j-oidc">
<get src="https://repo1.maven.org/maven2/org/pac4j/pac4j-oidc/4.4.0/pac4j-oidc-4.4.0.jar"
dest="${deps}/pac4j-oidc-4.4.0.jar" usetimestamp="true"/>
</target>
<target name="check-pac4j-opensamlv3">
<condition property="available-pac4j-opensamlv3">
<available file="${deps}/pac4j-saml-opensamlv3-4.4.0.jar" />
</condition>
</target>
<target name="download-pac4j-opensamlv3" depends="check-pac4j-opensamlv3" unless="available-pac4j-opensamlv3">
<get src="https://repo1.maven.org/maven2/org/pac4j/pac4j-saml-opensamlv3/4.4.0/pac4j-saml-opensamlv3-4.4.0.jar"
dest="${deps}/pac4j-saml-opensamlv3-4.4.0.jar" usetimestamp="true"/>
</target>
<target name="check-pac4j-config">
<condition property="available-pac4j-config">
<available file="${deps}/pac4j-config-4.4.0.jar" />
</condition>
</target>
<target name="download-pac4j-config" depends="check-pac4j-config" unless="available-pac4j-config">
<get src="https://repo1.maven.org/maven2/org/pac4j/pac4j-config/4.4.0/pac4j-config-4.4.0.jar"
dest="${deps}/pac4j-config-4.4.0.jar" usetimestamp="true"/>
</target>
<target name="check-commons-io">
<condition property="available-commons-io">
<available file="${deps}/commons-io-2.8.0.jar" />
</condition>
</target>
<target name="download-commons-io" depends="check-commons-io" unless="available-commons-io">
<get src="https://repo1.maven.org/maven2/commons-io/commons-io/2.8.0/commons-io-2.8.0.jar"
dest="${deps}/commons-io-2.8.0.jar" usetimestamp="true"/>
</target>
<target name="check-opensaml-core">
<condition property="available-opensaml-core">
<available file="${deps}/opensaml-core-3.4.6.jar" />
</condition>
</target>
<target name="download-opensaml-core" depends="check-opensaml-core" unless="available-opensaml-core">
<get src="https://repo1.maven.org/maven2/org/opensaml/opensaml-core/3.4.6/opensaml-core-3.4.6.jar"
dest="${deps}/opensaml-core-3.4.6.jar" usetimestamp="true"/>
</target>
<target name="check-opensaml-xmlsec-api">
<condition property="available-opensaml-xmlsec-api">
<available file="${deps}/opensaml-xmlsec-api-3.4.6.jar" />
</condition>
</target>
<target name="download-opensaml-xmlsec-api" depends="check-opensaml-xmlsec-api" unless="available-opensaml-xmlsec-api">
<get src="https://repo1.maven.org/maven2/org/opensaml/opensaml-xmlsec-api/3.4.6/opensaml-xmlsec-api-3.4.6.jar"
dest="${deps}/opensaml-xmlsec-api-3.4.6.jar" usetimestamp="true"/>
</target>
<target name="check-shibboleth-java-support">
<condition property="available-shibboleth-java-support">
<available file="${deps}/java-support-7.5.2.jar" />
</condition>
</target>
<target name="download-shibboleth-java-support" depends="check-shibboleth-java-support" unless="available-shibboleth-java-support">
<get src="https://repo1.maven.org/maven2/net/shibboleth/utilities/java-support/7.5.2/java-support-7.5.2.jar"
dest="${deps}/java-support-7.5.2.jar" usetimestamp="true"/>
</target>
<target name="check-apache-httpclient">
<condition property="available-apache-httpclient">
<available file="${deps}/httpclient-4.5.9.jar" />
</condition>
</target>
<target name="download-apache-httpclient" depends="check-apache-httpclient" unless="available-apache-httpclient">
<get src="https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.5.9/httpclient-4.5.9.jar"
dest="${deps}/httpclient-4.5.9.jar" usetimestamp="true"/>
</target>
<target name="create-deps">
<mkdir dir="${deps}"/>
</target>
<target name="download-dependencies"
depends="create-deps,
download-servlet-api,
download-apache-httpclient,
download-commons-io,
download-shibboleth-java-support,
download-opensaml-core,
download-opensaml-xmlsec-api,
download-pac4j-core,
download-pac4j-cas,
download-pac4j-oidc,
download-pac4j-opensamlv3,
download-pac4j-config"
description="download dependencies">
</target>
<target name="generate-buildinfo">
<mkdir dir="${build}/buildinfo/com/iwayvietnam/buildinfo"/>
<echo file="${build}/buildinfo/com/iwayvietnam/buildinfo/Version.java">
package com.iwayvietnam.buildinfo;
class Version {
public static void main(String[] args) {
Package p = Version.class.getPackage();
System.out.println("Implementation-Title: " + p.getImplementationTitle() +
"\nImplementation-Version: " + p.getImplementationVersion() +
"\nImplementation-Vendor: " + p.getImplementationVendor() + "\n");
}
}
</echo>
<javac srcdir="${build}/buildinfo"
destdir="${build}"
includeantruntime="false"
debug="true"
target="${javac.target}" />
</target>
<target name="compile" depends="clean,download-dependencies,generate-buildinfo">
<mkdir dir="${build}"/>
<javac srcdir="${src}"
destdir="${build}"
includeantruntime="false"
debug="true"
debuglevel="lines,vars,source"
target="${javac.target}"
source="${javac.source}">
<classpath>
<path refid="libraries" />
</classpath>
</javac>
</target>
<target name="jar" depends="compile">
<delete dir="${build}/buildinfo"/>
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/${jar}"
compress="true"
basedir="${build}"
duplicate="preserve">
<manifest>
<attribute name="Main-Class" value="com.iwayvietnam.buildinfo.Version" />
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="iWay Vietnam"/>
<attribute name="Implementation-Title" value="Single Sign On for Zimbra (Zm SSO)"/>
<attribute name="Zimbra-Extension-Name" value="com_iwayvietnam_zmsso" />
<attribute name="Zimbra-Extension-Class" value="com.iwayvietnam.zmsso.ZmSsoExtension" />
<attribute name="Created-By" value="iWay Vietnam" />
</manifest>
<fileset dir="${build}" />
<fileset dir="${resources}" />
</jar>
</target>
</project>