| <!-- |
| Copyright (C) Janne Jalkanen 2001. |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation; either version 2 of the License, or |
| (at your option) 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 General Public License for more details. |
| |
| You should have received a copy of the GNU General Public License |
| along with this program; if not, write to the Free Software |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| --> |
| |
| <!-- |
| This is the Ant build file for the JSPWiki project. |
| |
| The verbosity in this file is intentional - it is also |
| an example for those who don't know Ant yet that well |
| and would like to learn it. |
| |
| The build file assumes the following directory structure: |
| |
| JSPWiki |
| |___build.xml |
| | |
| |___etc |
| | |___[jspwiki.properties and web.xml] |
| | |
| |___src |
| | |___webdocs |
| | | |___[all .jsp files] |
| | | |
| | |___com |
| | |___[...and the rest of the source code files] |
| | |
| |___docs |
| | |
| |___lib |
| | |
| |___tests |
| |___com |
| |___[...and the rest of the test source code] |
| |
| $Id: build.xml,v 1.25.2.3 2002-12-15 23:23:43 ebu Exp $ |
| --> |
| |
| <!-- |
| First, we define the project. We assign it a name, |
| and the default action if no action is specified on the |
| command line. Also, all relative directory references |
| in the rest of the project file should be calculated from |
| the current directory. |
| --> |
| <project name="JSPWiki" default="compile" basedir="."> |
| |
| <!-- This denotes the directory where the source code lies. --> |
| <property name="code.src" value="src" /> |
| |
| <!-- The class files are actually put in this directory. It is |
| a good habit to keep .class -files separate from the .java -files. --> |
| <property name="code.build" value ="build" /> |
| |
| <!-- Define a temporary directory, based on the system temporary directory, |
| the user name, and the project name (defined above) --> |
| <property name="tmpdir" value="${java.io.tmpdir}/${user.name}/${ant.project.name}" /> |
| |
| <!-- The following three properties define the location of the |
| test sources, the location of the test .class files and the |
| directory where the test results are written in. --> |
| |
| <property name="tests.src" value="tests" /> |
| <property name="tests.build" value="tests/build" /> |
| <property name="tests.reports" value="tests/reports" /> |
| |
| <!-- The place where the javadocs are created --> |
| |
| <property name="docs.javadoc" value="doc/javadoc" /> |
| |
| <!-- The temporary installation directory where all war-files |
| are collected, for example --> |
| <property name="install.fulldir" value="${tmpdir}/install" /> |
| |
| <!-- The directory where the CVS sources are checked out. --> |
| <property name="install.src" value="${tmpdir}/cvssrc" /> |
| |
| <!-- Define the CVS properties. These are used when building the |
| source distribution. Normally, you shouldn't have to care about these. |
| --> |
| <property name="cvs.root" value=":ext:grey.ecyrd.com:/p/cvs" /> |
| <property name="cvs.module" value="JSPWiki" /> |
| <property name="cvs.tag" value="HEAD" /> |
| |
| <!-- And finally, the directory where the final .zip-file is put --> |
| <property name="release.dir" value="releases" /> |
| |
| <!-- PATH DEFINITIONS --> |
| |
| <!-- The base path for compilation. We include, of course, the |
| already built files in the build-directory, and then we |
| add all the jar files in the "lib" -directory. --> |
| <path id="path.base"> |
| <pathelement path="${code.build}" /> |
| <fileset dir="lib"> |
| <include name="*.jar" /> |
| </fileset> |
| </path> |
| |
| <!-- The path used for running tests. We add the tests/etc directory |
| to the base path defined above, since we put all the relevant |
| .properties-files in tests/etc. --> |
| <path id="path.tests"> |
| <pathelement path="${tests.src}/etc" /> |
| <path refid="path.base" /> |
| </path> |
| |
| <!-- ============================================================== --> |
| |
| <!-- Initialising, cleaning, etc. --> |
| |
| <target name="init" |
| description="Initializes everything, creates directories, etc."> |
| <mkdir dir="${code.build}" /> |
| <mkdir dir="${tests.build}" /> |
| <mkdir dir="${tests.reports}" /> |
| <mkdir dir="${java.io.tmpdir}/testrepository" /> |
| </target> |
| |
| <!-- Removes the build directory and the tests build directory --> |
| <target name="clean" |
| description="Cleans away all generated files."> |
| <delete dir="${tests.build}" /> |
| <delete dir="${code.build}" /> |
| <delete> |
| <fileset dir="." includes="**/*~" defaultexcludes="no"/> |
| <fileset dir="." includes="**/#*#" defaultexcludes="no"/> |
| </delete> |
| </target> |
| |
| <!-- ============================================================== --> |
| |
| <!-- Compilation targets --> |
| |
| <!-- In English this means that the "init" -target must be executed |
| first. After this, the java compiler is invoked with options |
| that compile every .java file in ${code.src} into .class files |
| in directory ${code.build}. The is no debugging information |
| and the compiler is instructed to optimize the resulting code. |
| |
| For the classpath we use the previously defined path called |
| "path.base" --> |
| |
| <target name="compile" depends="init" |
| description="Builds the source code."> |
| <javac srcdir="${code.src}" |
| destdir="${code.build}" |
| debug="on" |
| optimize="off"> |
| <classpath refid="path.base" /> |
| </javac> |
| </target> |
| |
| <target name="compile-optimized" depends="clean,init" |
| description="Builds the source code for distribution."> |
| <javac srcdir="${code.src}" |
| destdir="${code.build}" |
| debug="off" |
| optimize="on"> |
| <classpath refid="path.base" /> |
| </javac> |
| </target> |
| |
| |
| <!-- This is similar to above. We use this to compile the |
| tests. --> |
| <target name="compiletests" depends="init" |
| description="Builds the test code."> |
| <javac srcdir="${tests.src}" |
| destdir="${tests.build}" |
| debug="on"> |
| <classpath refid="path.base" /> |
| </javac> |
| </target> |
| |
| <!-- Creates javadocs --> |
| |
| <!-- FIXME: Must not use constant package name! --> |
| <target name="javadoc" |
| description="Compiles the javadocs."> |
| |
| <mkdir dir="${docs.javadoc}" /> |
| |
| <javadoc sourcepath="${code.src}" |
| destdir="${docs.javadoc}" |
| packagenames="com.ecyrd.jspwiki,com.ecyrd.jspwiki.plugin,com.ecyrd.jspwiki.rss,com.ecyrd.jspwiki.xmlrpc,com.ecyrd.jspwiki.tags,com.ecyrd.jspwiki.providers,com.ecyrd.jspwiki.attachment"> |
| <classpath refid="path.base" /> |
| </javadoc> |
| |
| </target> |
| |
| <!-- ============================================================== --> |
| |
| <!-- Installation targets --> |
| |
| <!-- This target makes sure all the necessary directories exist |
| for building the installation package. --> |
| <target name="installinit"> |
| <mkdir dir="${install.fulldir}" /> |
| <delete dir="${install.src}" /> |
| <mkdir dir="${install.src}" /> |
| <delete dir="${release.dir}" /> |
| <mkdir dir="${release.dir}" /> |
| </target> |
| |
| <!-- Builds the jar of all compiled class files --> |
| |
| <target name="jar" depends="compile,installinit"> |
| <property name="jarfile" value="${code.build}/${ant.project.name}.jar" /> |
| |
| <jar jarfile="${jarfile}"> |
| <fileset dir="${code.build}" includes="**/*.class" /> |
| </jar> |
| |
| </target> |
| |
| <target name="jar-optimized" depends="compile-optimized,installinit"> |
| <property name="jarfile" value="${code.build}/${ant.project.name}.jar" /> |
| |
| <jar jarfile="${jarfile}"> |
| <fileset dir="${code.build}" includes="**/*.class" /> |
| </jar> |
| |
| </target> |
| |
| <!-- Builds a Web Archive - basically a JAR file which |
| also contains all of the JSP pages and can be deployed |
| as-is. |
| |
| The archive gets put in the ${install.fulldir}. The |
| reason for this is that this is just a temporary |
| step when building the entire distribution archive. |
| |
| We include the following things: |
| |
| 1) All .jar -files in the lib-directory (except servlet.jar, since |
| it's gonna be provided by the servlet container anyway.) |
| 2) All .class-files from the build-directory |
| 3) Everything from the src/webdocs -directory |
| 4) Everything from the etc-directory go to the WEB-INF -directory |
| of the WAR-file. |
| --> |
| |
| <target name="war" depends="installinit,jar" |
| description="Builds the WAR file for installation."> |
| |
| <property name="warfile" value="${install.fulldir}/${ant.project.name}.war" /> |
| |
| <delete file="${warfile}" /> |
| |
| <war warfile="${install.fulldir}/${ant.project.name}.war" |
| webxml="etc/web.xml"> |
| <lib dir="lib" includes="*.jar" excludes="servlet.jar,junit.jar"/> |
| <lib dir="${code.build}" includes="*.jar" /> |
| <fileset dir="${code.src}/webdocs" includes="**" excludes="images/godiagram/**" /> |
| <webinf dir="etc" includes="**" /> |
| </war> |
| |
| </target> |
| |
| |
| <target name="opened-war" depends="war" |
| description="Creates an opened JSPWiki war hierarhcy into the build dir."> |
| |
| <mkdir dir="${code.build}/${ant.project.name}" /> |
| <unzip src="${install.fulldir}/${ant.project.name}.war" |
| dest="${code.build}/${ant.project.name}" /> |
| |
| </target> |
| |
| |
| <!-- |
| Here goes some nice Ant magic... We build the source |
| code archive by directly exporting all code from the CVS |
| repository, and then zipping it to the temporary installation |
| directory. |
| |
| Note that you must have your CVS set up so that it does |
| not ask for a password when you're checking it out. |
| |
| If you don't have CVS access, you can't build a source |
| zip with this. Sorry. |
| --> |
| <target name="srczip" depends="installinit" |
| description="Builds source zip."> |
| |
| <cvs cvsRoot="${cvs.root}" |
| dest="${install.src}" |
| package="${cvs.module}" |
| command="export" |
| tag="${cvs.tag}" /> |
| |
| <zip zipfile="${release.dir}/${ant.project.name}-src.zip"> |
| <zipfileset dir="${install.src}" /> |
| </zip> |
| |
| <zip zipfile="${install.fulldir}/${ant.project.name}-samplepages.zip"> |
| <zipfileset dir="${install.src}/${ant.project.name}/src/wikipages" /> |
| </zip> |
| |
| </target> |
| |
| <!-- Builds the entire distribution set. |
| |
| We build both the WAR-file and the source zip, then |
| copy in some useful files and zip the whole thing |
| into the release directory. |
| |
| Note that if you don't have CVS access set up, you |
| probably can't run this. |
| --> |
| <target name="dist" depends="installinit,srczip,war" |
| description="Builds the entire distribution archive."> |
| <copy file="README" todir="${install.fulldir}" /> |
| <copy file="ChangeLog" todir="${install.fulldir}" /> |
| <copy file="ReleaseNotes" todir="${install.fulldir}" /> |
| <copy file="doc/LICENSE" todir="${install.fulldir}" /> |
| |
| <zip zipfile="${release.dir}/${ant.project.name}-bin.zip"> |
| <zipfileset dir="${install.fulldir}" prefix="${ant.project.name}" /> |
| </zip> |
| |
| </target> |
| |
| <!-- ============================================================== --> |
| |
| <!-- Running tests --> |
| |
| <!-- This target runs the JUnit tests that are available |
| under tests/. It generates the test result files |
| into the ${tests.reports} -directory, one file per |
| each tested class. The tests are generated in |
| plain text, but you can easily get XML format results |
| as well, just by setting the formatter, below. |
| |
| Only tests that end with "*Test.java" are included. |
| This is because then you can also use a manual |
| "AllTests.java" in each directory, as per the JUnit |
| Cookbook. |
| |
| This runs the tests in text mode. If you want the |
| pretty GUI you probably want to write a new target. |
| --> |
| <target name="tests" depends="compile,compiletests" |
| description="Runs the JUnit tests."> |
| |
| <junit printsummary="yes" haltonfailure="no" fork="no"> |
| <classpath> |
| <path refid="path.tests" /> |
| <pathelement path="${tests.build}" /> |
| <pathelement path="${java.class.path}" /> |
| </classpath> |
| |
| <formatter type="plain" /> |
| |
| <batchtest todir="${tests.reports}"> |
| <fileset dir="${tests.src}"> |
| <include name="**/*Test.java" /> |
| <exclude name="**/AllTest*java" /> |
| </fileset> |
| </batchtest> |
| </junit> |
| |
| </target> |
| |
| <target name="stresstests" depends="compile,compiletests" |
| description="Runs the complete stress testing framework."> |
| |
| <junit printsummary="yes" haltonfailure="no" fork="no"> |
| <classpath> |
| <path refid="path.tests" /> |
| <pathelement path="${tests.build}" /> |
| <pathelement path="${java.class.path}" /> |
| </classpath> |
| |
| <formatter type="plain" /> |
| |
| <batchtest todir="${tests.reports}"> |
| <fileset dir="${tests.src}"> |
| <include name="**/StressTest*.java" /> |
| </fileset> |
| </batchtest> |
| </junit> |
| |
| </target> |
| |
| <!-- Commented out since this kills some compiles on grey. |
| <target name="report" depends="compile, compiletests"> |
| |
| <mkdir dir="${tests.reports}/html" /> |
| <junit printsummary="yes" haltonfailure="no" fork="no"> |
| <classpath> |
| <path refid="path.tests" /> |
| <pathelement path="${tests.build}" /> |
| <pathelement path="${java.class.path}" /> |
| </classpath> |
| |
| <formatter type="xml" /> |
| |
| <batchtest todir="${tests.reports}"> |
| <fileset dir="${tests.src}"> |
| <include name="**/*Test.java" /> |
| <exclude name="**/AllTest*java" /> |
| </fileset> |
| </batchtest> |
| </junit> |
| |
| <junitreport todir="${tests.reports}/html"> |
| <fileset dir="${tests.reports}"> |
| <include name="TEST-*.xml"/> |
| </fileset> |
| <report format="frames" todir="${tests.reports}/html"/> |
| </junitreport> |
| |
| </target> |
| --> |
| |
| <target name="guitests" depends="compile,compiletests" |
| description="Runs the tests in a pretty window."> |
| |
| <java classname="junit.swingui.TestRunner" |
| fork="true"> |
| <classpath> |
| <path refid="path.tests" /> |
| <pathelement path="${tests.build}" /> |
| <pathelement path="${java.class.path}" /> |
| </classpath> |
| |
| <arg value="com.ecyrd.jspwiki.AllTests" /> |
| </java> |
| |
| |
| </target> |
| |
| </project> |