inappropriate check for null decoder
[java-idp.git] / build.xml
1 <project name="Shibboleth Identity Provider" basedir="." default="package">
2
3         <tstamp>
4                 <format property="build-date" pattern="ddMMyyyy'T'kkmmss" timezone="GMT" />
5         </tstamp>
6
7         <!-- User based property file that overrides any property below -->
8         <property file="${user.name}-build.properties" />
9
10         <!-- Project based property file -->
11         <property file="build.properties" />
12
13         <!-- Installation specific property file -->
14         <property file="install.properties" />
15
16         <!-- Load ant-contrib tasks -->
17         <taskdef resource="net/sf/antcontrib/antlib.xml" />
18
19         <!-- Load Checkstyle tasks -->
20         <taskdef resource="checkstyletask.properties" />
21
22         <!-- Classpath for building core classes-->
23         <path id="build-path">
24                 <fileset dir="${build-lib.dir}" includes="**/*.jar" />
25                 <fileset dir="${lib.dir}" includes="**/*.jar" />
26         </path>
27
28         <!-- Classpath for testing classes-->
29         <path id="test-path">
30                 <path refid="build-path" />
31                 <pathelement location="${core-classes.dir}" />
32                 <pathelement location="${core-src.dir}" />
33                 <pathelement location="${test-classes.dir}" />
34                 <pathelement location="${test-classes.dir}/data" />
35                 <pathelement location="${test-classes.dir}/log4j.xml" />
36                 <pathelement location="${test-src.dir}" />
37                 <pathelement location="${classpathres.dir}" />
38         </path>
39
40         <!-- Prepare directory structure for build -->
41         <target name="build-init">
42                 <mkdir dir="${build.dir}" />
43         </target>
44
45         <!-- Compile core (non-test) classes -->
46         <target name="compile-core" depends="build-init, clean-compile">
47                 <mkdir dir="${core-classes.dir}" />
48
49                 <javac srcdir="${core-src.dir}" destdir="${core-classes.dir}" includes="**/*.java" debug="on" source="1.5">
50                         <classpath refid="build-path" />
51                 </javac>
52
53         </target>
54
55         <!-- Compile unit test classes -->
56         <target name="compile-test" depends="compile-core">
57                 <mkdir dir="${test-classes.dir}" />
58
59                 <javac srcdir="${test-src.dir}" destdir="${test-classes.dir}" includes="**/*.java" debug="on" source="1.5">
60                         <classpath refid="test-path" />
61                 </javac>
62
63         </target>
64
65         <!-- Compile and run unit tests -->
66         <target name="test" depends="compile-core, compile-test" description="Runs the unit tests for the project.">
67                 <mkdir dir="${test-results.dir}" />
68
69                 <echo message="Excuting unit tests using endorsed directory ${java.endorsed.dirs}" />
70                 <junit printsummary="off"
71                        fork="yes"
72                        forkmode="once"
73                        haltonerror="false"
74                        haltonfailure="false"
75                        dir="${basedir}"
76                        errorproperty="testFailed">
77                         <jvmarg value="-Djava.endorsed.dirs=${java.endorsed.dirs}" />
78                         <classpath refid="test-path" />
79                         <formatter type="xml" />
80                         <batchtest todir="${test-results.dir}">
81                                 <fileset dir="${test-classes.dir}">
82                                         <include name="**/*Test.class" />
83                                 </fileset>
84                         </batchtest>
85                 </junit>
86                 <junitreport todir="${test-results.dir}">
87                         <fileset dir="${test-results.dir}">
88                                 <include name="TEST-*.xml" />
89                         </fileset>
90                         <report format="frames" todir="${test-report.dir}" />
91                 </junitreport>
92
93                 <echo message="Test report available at ${test-report.dir}/index.html" />
94                 <fail if="testFailed" message="Test failure; see ${test-report.dir}/index.html for more information." />
95         </target>
96
97         <!-- Javadoc core (non-test) classes -->
98         <target name="javadoc" description="Creates the JavaDoc documentatin for the project.">
99                 <mkdir dir="${javadoc.dir}" />
100                 <javadoc packagenames="org.opensaml.*"
101                          sourcepath="${core-src.dir}"
102                          destdir="${javadoc.dir}"
103                          author="false"
104                          version="true"
105                          windowtitle="${ant.project.name} ${version} Java API"
106                          doctitle="${ant.project.name} ${version} Java API"
107                          bottom="${copyright}"
108                          overview="${core-src.dir}/overview.html">
109                         <classpath refid="build-path" />
110                 </javadoc>
111         </target>
112
113         <!-- Removes previously compiled files -->
114         <target name="clean-compile">
115                 <delete dir="${build.dir}" />
116                 <delete dir="${dist.dir}" />
117         </target>
118
119         <!-- Removes all build generated content -->
120         <target name="clean" depends="clean-compile" description="Removes any artifact produced by the build process.">
121                 <delete dir="${javadoc.dir}" />
122                 <delete dir="${reports.dir}" />
123                 <delete dir="${dist.dir}" />
124         </target>
125
126         <!-- Create JAR file -->
127         <target name="package" depends="compile-core" description="Creates the project library jar file.">
128                 <mkdir dir="${dist.dir}" />
129
130                 <if>
131                         <equals arg1="${jdk.target}" arg2="1.4" />
132                         <then>
133                                 <java classname="com.rc.retroweaver.Weaver">
134                                         <arg value="-source" />
135                                         <arg value="${core-classes.dir}" />
136                                         <classpath>
137                                                 <fileset dir="${thirdpaty-lib.dir}">
138                                                         <include name="**/*.jar" />
139                                                 </fileset>
140                                         </classpath>
141                                 </java>
142
143                                 <echo message="**************************************************************" />
144                                 <echo message="    Remember, you must include the retroweaver-rt jar" />
145                                 <echo message="    file, located in the thirdparty-lib directory, along with the" />
146                                 <echo message="    ${jar.name} on your" />
147                                 <echo message="    classpath in order to use this with JDK 1.4" />
148                                 <echo message="**************************************************************" />
149
150                         </then>
151                 </if>
152
153                 <jar destfile="${dist.dir}/${jar.name}" whenempty="fail">
154                         <fileset dir="${classpathres.dir}" />
155                         <zipfileset dir="${metainf.dir}" prefix="META-INF/" />
156                         <zipfileset dir="${core-classes.dir}" />
157                 </jar>
158
159         </target>
160
161         <target name="install" depends="package" description="Installs the identity provider software.">
162                 <mkdir dir="${idp.home}" />
163                 <mkdir dir="${idp.home}/lib" />
164                 <mkdir dir="${idp.home}/conf" />
165                 <mkdir dir="${idp.home}/logs" />
166                 <mkdir dir="${idp.home}/bin" />
167                 <mkdir dir="${idp.home}/war" />
168                 <mkdir dir="${idp.home}/temp/metadata" />
169
170                 <copy todir="${idp.home}/lib" preservelastmodified="true">
171                         <fileset dir="${lib.dir}" />
172                         <fileset file="${dist.dir}/${jar.name}" />
173                 </copy>
174
175                 <copy todir="${idp.home}/conf" preservelastmodified="true" overwrite="${idp.overwrite-config}">
176                         <fileset dir="${conf.dir}" />
177                         <filterset begintoken="$" endtoken="$">
178                                 <filter token="IDP_HOME" value="${idp.home}" />
179                                 <filter token="IDP_VERSION" value="${version}" />
180                         </filterset>
181                 </copy>
182
183                 <copy todir="${idp.home}/bin" preservelastmodified="true">
184                         <fileset dir="${tools.dir}" />
185                         <filterset begintoken="$" endtoken="$">
186                                 <filter token="IDP_HOME" value="${idp.home}" />
187                                 <filter token="IDP_VERSION" value="${version}" />
188                         </filterset>
189                 </copy>
190
191                 <symlink link="${idp.home}/bin/aacli.sh" resource="shib-tools.sh" overwrite="true" />
192                 <chmod file="${idp.home}/bin/*.sh" perm="+x" />
193
194                 <copy todir="${webinf-temp.dir}">
195                         <fileset dir="${webinf.dir}" />
196                         <filterset begintoken="$" endtoken="$">
197                                 <filter token="IDP_HOME" value="${idp.home}" />
198                                 <filter token="IDP_VERSION" value="${version}" />
199                         </filterset>
200                 </copy>
201                 <jar destfile="${idp.home}/war/${war.name}" whenempty="fail">
202                         <zipfileset dir="${webinf-temp.dir}" prefix="WEB-INF/" />
203                         <zipfileset dir="${webpages.dir}" prefix="" />
204                         <zipfileset dir="${lib.dir}" prefix="WEB-INF/lib/" excludes="**/log4j*.jar" />
205                         <zipfileset file="${dist.dir}/${jar.name}" prefix="WEB-INF/lib/" />
206                 </jar>
207
208         </target>
209
210         <!-- **************************************************************** -->
211         <!-- ***                                                          *** -->
212         <!-- ***                     Developer Tasks                      *** -->
213         <!-- ***                                                          *** -->
214         <!-- **************************************************************** -->
215
216         <!-- Checks code against style guidelines -->
217         <target name="checkstyle" description="Developer task: Produces coding standard compliance report.">
218                 <mkdir dir="${reports.dir}" />
219
220                 <checkstyle config="${basedir}/checkstyle.xml" failOnViolation="false" classpathref="build-path">
221                         <fileset dir="src" includes="**/*.java" />
222                         <formatter type="plain" toFile="${reports.dir}/checkstyle-report.txt" />
223                 </checkstyle>
224         </target>
225
226 </project>