Hook in SAML 1 goodness
[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                 <copy todir="${webinf-temp.dir}">
160                         <fileset dir="${webinf.dir}" />
161                         <filterset begintoken="$" endtoken="$">
162                                 <filter token="IDP_HOME" value="${idp.home}" />
163                                 <filter token="IDP_VERSION" value="${version}" />
164                         </filterset>
165                 </copy>
166
167                 <jar destfile="${dist.dir}/${war.name}" whenempty="fail">
168                         <zipfileset dir="${webinf-temp.dir}" prefix="WEB-INF/" />
169                         <zipfileset dir="${webpages.dir}" prefix="" />
170                         <zipfileset dir="${lib.dir}" prefix="WEB-INF/lib/" excludes="**/log4j*.jar"/>
171                         <zipfileset file="${dist.dir}/${jar.name}" prefix="WEB-INF/lib/" />
172                 </jar>
173
174         </target>
175
176         <target name="install" depends="package" description="Installs the identity provider software.">
177                 <mkdir dir="${idp.home}" />
178                 <mkdir dir="${idp.home}/lib" />
179                 <mkdir dir="${idp.home}/conf" />
180                 <mkdir dir="${idp.home}/logs" />
181                 <mkdir dir="${idp.home}/bin" />
182                 <mkdir dir="${idp.home}/war" />
183                 <mkdir dir="${idp.home}/temp/metadata" />
184
185                 <copy todir="${idp.home}/lib" preservelastmodified="true">
186                         <fileset dir="${lib.dir}" />
187                         <fileset file="${dist.dir}/${jar.name}" />
188                 </copy>
189
190                 <copy todir="${idp.home}/conf" preservelastmodified="true">
191                         <fileset dir="${conf.dir}" />
192                         <filterset begintoken="$" endtoken="$">
193                                 <filter token="IDP_HOME" value="${idp.home}" />
194                                 <filter token="IDP_VERSION" value="${version}" />
195                         </filterset>
196                 </copy>
197
198                 <copy todir="${idp.home}/bin" preservelastmodified="true">
199                         <fileset dir="${tools.dir}" />
200                         <filterset begintoken="$" endtoken="$">
201                                 <filter token="IDP_HOME" value="${idp.home}" />
202                                 <filter token="IDP_VERSION" value="${version}" />
203                         </filterset>
204                 </copy>
205
206                 <symlink link="${idp.home}/bin/aacli.sh" resource="shib-tools.sh" overwrite="true"/>
207                 <chmod file="${idp.home}/bin/*.sh" perm="+x" />
208
209                 <copy todir="${idp.home}/war" file="${dist.dir}/${war.name}" preservelastmodified="true" />
210
211         </target>
212
213         <!-- **************************************************************** -->
214         <!-- ***                                                          *** -->
215         <!-- ***                     Developer Tasks                      *** -->
216         <!-- ***                                                          *** -->
217         <!-- **************************************************************** -->
218
219         <!-- Checks code against style guidelines -->
220         <target name="checkstyle" description="Developer task: Produces coding standard compliance report.">
221                 <mkdir dir="${reports.dir}" />
222
223                 <checkstyle config="${basedir}/checkstyle.xml" failOnViolation="false" classpathref="build-path">
224                         <fileset dir="src" includes="**/*.java" />
225                         <formatter type="plain" toFile="${reports.dir}/checkstyle-report.txt" />
226                 </checkstyle>
227         </target>
228
229 </project>