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