| <?xml version="1.0"?> |
| <!-- |
| /* |
| * Copyright 2005-2008 Les Hazlewood, Jeremy Haile |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| JSecurity root build file. If you want to understand how the JSecurity build environment |
| works (useful if you want to build from scratch or join the project as a developer), |
| Read this article: |
| |
| An Ant Modular Build Environment for Enterprise Applications: |
| http://www.onjava.com/pub/a/onjava/2005/06/22/modularant.html |
| |
| Reading this will instantly make you familiar with our build. |
| --> |
| <project name="jsecurity" default="all"> |
| |
| <!-- Static property definitions. These will remain the same for any module or submodule. --> |
| <property name="project.name" value="jsecurity"/> |
| |
| <property name="root.base.dir" value="${basedir}"/> |
| |
| <!-- Allow override of default build properties from properties file. --> |
| <property file="build.properties"/> |
| |
| <!-- Environment variables (e.g. to pickup CATALINA_HOME for test deployment) --> |
| <property environment="env"/> |
| |
| <!-- version of the product, see http://apr.apache.org/versioning.html |
| for details on this convention --> |
| <property name="major.version" value="0"/> |
| <property name="minor.version" value="9"/> |
| <property name="patch.version" value="0-alpha"/> |
| <property name="version" value="${major.version}.${minor.version}.${patch.version}"/> |
| |
| <!-- application-wide config files: (all other config files should be in a respective |
| module or submodule) --> |
| <property name="root.etc.dir" value="${root.base.dir}/etc"/> |
| <property name="root.dist.dir" value="${root.base.dir}/build/${project.name}-${version}"/> |
| |
| <!-- All 3rd party libraries are in here: --> |
| <property name="lib.dir" value="${root.base.dir}/lib"/> |
| |
| <!-- *RELATIVE* definitions. These properties will reflect a directory structure |
| relative to where the build is being executed --> |
| <property name="base.dir" value="."/> |
| <property name="etc.dir" value="${base.dir}/etc"/> |
| <property name="src.dir" value="${base.dir}/src"/> |
| <property name="test.dir" value="${base.dir}/test"/> |
| <property name="build.dir" value="${base.dir}/build"/> |
| <property name="classes.dir" value="${build.dir}/classes"/> |
| <property name="test.classes.dir" value="${build.dir}/test-classes"/> |
| <!-- <property name="dist.dir" value="${build.dir}/dist"/> --> |
| <property name="docs.dir" value="${root.dist.dir}/docs"/> |
| <property name="api.dir" value="${docs.dir}/api"/> |
| <property name="test.docs.dir" value="${docs.dir}/test-reports"/> |
| |
| <!-- compile flags, can be overridden on the command line using the -D flag --> |
| <property name="compile.debug" value="true"/> |
| <property name="compile.deprecation" value="false"/> |
| <property name="compile.optimize" value="false"/> |
| |
| <property name="dist.jarName" value="${project.name}.jar"/> |
| <property name="dist.jar" value="${root.dist.dir}/${dist.jarName}"/> |
| |
| <path id="all.libs"> |
| <fileset dir="${lib.dir}"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </path> |
| |
| <taskdef name="retroweaver" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask" > |
| <classpath> |
| <fileset dir="${lib.dir}/retroweaver" includes="*.jar"/> |
| </classpath> |
| </taskdef> |
| |
| <!-- =================================================================== |
| - Clean all local and children build files |
| - =================================================================== --> |
| <target name="clean"> |
| <delete dir="${build.dir}"/> |
| <ant dir="samples/spring" target="clean"/> |
| </target> |
| |
| <target name="compile.core"> |
| <mkdir dir="${classes.dir}"/> |
| <mkdir dir="${classes.dir}/META-INF"/> |
| |
| <javac destdir="${classes.dir}" |
| debug="${compile.debug}" |
| deprecation="${compile.deprecation}" |
| optimize="${compile.optimize}" |
| failonerror="true" |
| classpathref="all.libs"> |
| <src path="${src.dir}"/> |
| </javac> |
| |
| <copy todir="${classes.dir}" preservelastmodified="true"> |
| <fileset dir="${src.dir}"> |
| <include name="**/*.properties"/> |
| <include name="**/*.xml"/> |
| <include name="**/*.dtd"/> |
| <include name="**/*.xsd"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${classes.dir}/META-INF" preservelastmodified="true"> |
| <fileset dir="${src.dir}"> |
| <include name="**/*.tld"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| |
| <target name="compile.spring" depends="compile.core" description="Build 3rd party Spring Framework support"> |
| <javac destdir="${classes.dir}" |
| debug="${compile.debug}" |
| deprecation="${compile.deprecation}" |
| optimize="${compile.optimize}" |
| failonerror="true"> |
| <classpath refid="all.libs"/> |
| <classpath location="${classes.dir}"/> |
| <src path="${root.base.dir}/support/spring/src"/> |
| </javac> |
| |
| <copy todir="${classes.dir}" preservelastmodified="true"> |
| <fileset dir="${root.base.dir}/support/spring/src"> |
| <include name="**/*.properties"/> |
| <include name="**/*.xml"/> |
| <include name="**/*.dtd"/> |
| <include name="**/*.xsd"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${classes.dir}/META-INF" preservelastmodified="true"> |
| <fileset dir="${root.base.dir}/support/spring/src"> |
| <include name="**/*.tld"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| <target name="compile.jboss" depends="compile.core" description="Build 3rd party JBoss support"> |
| <javac destdir="${classes.dir}" |
| debug="${compile.debug}" |
| deprecation="${compile.deprecation}" |
| optimize="${compile.optimize}" |
| failonerror="true"> |
| <classpath refid="all.libs"/> |
| <classpath location="${classes.dir}"/> |
| <src path="${root.base.dir}/support/jboss/src"/> |
| </javac> |
| |
| <copy todir="${classes.dir}" preservelastmodified="true"> |
| <fileset dir="${root.base.dir}/support/jboss/src"> |
| <include name="**/*.properties"/> |
| <include name="**/*.xml"/> |
| <include name="**/*.dtd"/> |
| <include name="**/*.xsd"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${classes.dir}/META-INF" preservelastmodified="true"> |
| <fileset dir="${root.base.dir}/support/jboss/src"> |
| <include name="**/*.tld"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| <target name="compile" depends="compile.core, compile.spring, compile.jboss"/> |
| |
| <target name="jar" depends="compile" description="Create full JAR file with all JSecurity classes"> |
| |
| <mkdir dir="${root.dist.dir}"/> |
| |
| <delete file="${dist.jar}"/> |
| |
| <jar jarfile="${dist.jar}"> |
| <fileset dir="${classes.dir}"> |
| <include name="org/jsecurity/**"/> |
| </fileset> |
| <metainf dir="${classes.dir}/META-INF"> |
| <include name="**"/> |
| </metainf> |
| <manifest> |
| <attribute name="Implementation-Title" value="${project.name}"/> |
| <attribute name="Implementation-Version" value="${version}"/> |
| <attribute name="${project.name}-Version" value="${version}"/> |
| <!-- Allow use of this JAR as a Java agent --> |
| <!-- <attribute name="Premain-Class" value="org.jsecurity.instrument.InstrumentationSavingAgent" /> --> |
| </manifest> |
| </jar> |
| |
| <retroweaver target="1.3" inputjar="${dist.jar}" outputjar="${root.dist.dir}/${project.name}-jdk13.jar"/> |
| <retroweaver target="1.4" inputjar="${dist.jar}" outputjar="${root.dist.dir}/${project.name}-jdk14.jar"/> |
| |
| </target> |
| |
| <target name="samples.quickstart" depends="jar"> |
| <ant dir="samples/quickstart"/> |
| </target> |
| |
| <target name="samples.spring" depends="compile.spring"> |
| <ant dir="samples/spring"/> |
| </target> |
| |
| <target name="samples" depends="samples.quickstart,samples.spring"/> |
| |
| <target name="samples.quickstart.deploy" depends="samples.quickstart"> |
| <ant dir="samples/quickstart" target="deploy"/> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Javadoc all main sources --> |
| <!-- =================================================================== --> |
| <target name="javadoc" description="Generate Javadocs"> |
| |
| <path id="javadocSrcPath"> |
| <pathelement location="${src.dir}"/> |
| <pathelement location="${root.base.dir}/support/jboss/src"/> |
| <pathelement location="${root.base.dir}/support/spring/src"/> |
| </path> |
| |
| <echo message="Generating JavaDoc API..."/> |
| <delete dir="${api.dir}" failonerror="false"/> |
| <mkdir dir="${api.dir}"/> |
| |
| <javadoc destdir="${api.dir}" windowtitle="JSecurity API ${version}" |
| source="1.5" access="package" author="true" version="true" use="true" |
| defaultexcludes="true" |
| header='<a href=\"http://www.jsecurity.org/\" target=\"_top\">JSecurity</a>'> |
| <sourcepath refid="javadocSrcPath"/> |
| <arg value="-breakiterator"/> |
| <arg value="-J-Xmx128m"/> |
| <arg value="-J-XX:MaxPermSize=128m"/> |
| <!-- <arg value="-J-Dhttp.proxyHost=${javadoc.proxyhost}"/> |
| <arg value="-J-Dhttp.proxyPort=${javadoc.proxyport}"/> --> |
| <doctitle><![CDATA[<h1>JSecurity API ${version}</h1>]]></doctitle> |
| <bottom><![CDATA[<i>Copyright © 2004-2008 <a href="http://www.jsecurity.org/" target="_top">JSecurity</a>.</i> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-3614410-1"); pageTracker._initData(); pageTracker._trackPageview(); </script>]]></bottom> |
| <classpath refid="all.libs"/> |
| <packageset dir="${src.dir}"> |
| <include name="org/jsecurity/**"/> |
| </packageset> |
| <packageset dir="${root.base.dir}/support/jboss/src"> |
| <include name="org/jsecurity/**"/> |
| </packageset> |
| <packageset dir="${root.base.dir}/support/spring/src"> |
| <include name="org/jsecurity/**"/> |
| </packageset> |
| <link href="http://java.sun.com/j2se/1.5/docs/api"/> |
| <link href="http://java.sun.com/j2ee/1.4/docs/api"/> |
| <!-- Jakarta Commons --> |
| <link href="http://jakarta.apache.org/commons/collections/apidocs/"/> |
| <link href="http://jakarta.apache.org/commons/logging/apidocs/"/> |
| <link href="http://jakarta.apache.org/commons/codec/apidocs/"/> |
| <link href="http://quartz.sourceforge.net/javadoc/"/> |
| <link href="http://static.springframework.org/spring/docs/2.0.x/api/"/> |
| <link href="http://ehcache.sourceforge.net/javadoc/"/> |
| </javadoc> |
| |
| </target> |
| |
| <!-- <name name="junit.check.warning" if="tests.failed"> |
| <echo> |
| *********************************************************** |
| * One or more unit tests failed! |
| * Check the reports located in ${test.docs.dir} |
| * for details... |
| *********************************************************** |
| </echo> |
| </name> |
| |
| <!- - =================================================================== |
| - quick-test-report - quickly generates test report documentation based |
| - on the xml test reports previously created during a junit task |
| - execution. (this does not run the task). |
| - =================================================================== - -> |
| <name name="test.report"> |
| <echo message="Generating test reports..."/> |
| |
| <junitreport todir="${test.docs.dir}"> |
| <fileset dir="."> |
| <include name="**/TEST-*"/> |
| </fileset> |
| <report todir="${test.docs.dir}"/> |
| </junitreport> |
| </name> |
| |
| <name name="unit.tests" depends="compile"> |
| <echo message="Executing unit tests..."/> |
| |
| <!- - Any properties files needed by test cases and/or Spring test case |
| configuration must be under the base root dir hierarchy so relative |
| file references may work properly. - -> |
| <copy toDir="${classes.dir}" preservelastmodified="true" file="${root.base.dir}/etc/log4j.properties"/> |
| <copy toDir="${classes.dir}" preservelastmodified="true" file="${root.base.dir}/db/build/gen/jdbc.properties"/> |
| |
| <junit printsummary="withOutAndErr" |
| showoutput="true" |
| haltonfailure="no" |
| failureproperty="tests.failed" |
| errorproperty="tests.failed" |
| timeout="60000" |
| fork="yes"> |
| <classpath refid="test.path"/> |
| |
| <formatter type="brief" usefile="false"/> |
| <formatter type="xml"/> |
| <!- - allows us to generate web reports - -> |
| |
| <batchtest fork="true" todir="${gen.dir}"> |
| <fileset dir="${test.classes.dir}"> |
| |
| <include name="**/*Test.class"/> |
| |
| <exclude name="**/*IntegrationTest.class"/> |
| <exclude name="**/*SystemTest.class"/> |
| <exclude name="**/*StressTest.class"/> |
| |
| </fileset> |
| </batchtest> |
| |
| </junit> |
| |
| </name> |
| |
| <name name="test" depends="dist"> |
| <antcall name="template"> |
| <param name="name" value="test"/> |
| </antcall> |
| </name> --> |
| |
| |
| <target name="src.zip" description="Create source ZIP (containing Java sources)"> |
| <mkdir dir="${root.dist.dir}"/> |
| <delete file="${root.dist.dir}/${project.name}.src.zip"/> |
| <zip destfile="${root.dist.dir}/${project.name}.src.zip"> |
| <fileset dir="${src.dir}"> |
| <include name="org/jsecurity/**"/> |
| </fileset> |
| <fileset dir="${root.base.dir}/support/spring/src"> |
| <include name="org/jsecurity/**"/> |
| </fileset> |
| <fileset dir="${root.base.dir}/support/jboss/src"> |
| <include name="org/jsecurity/**"/> |
| </fileset> |
| </zip> |
| </target> |
| |
| <target name="release" depends="jar,samples,src.zip,javadoc"> |
| <property name="release.dir.name" value="${project.name}-${version}"/> |
| <property name="release.zip.name" value="${release.dir.name}-with-dependencies.zip"/> |
| <copy todir="${root.dist.dir}"> |
| <fileset dir="${root.base.dir}"> |
| <type type="file"/> |
| <exclude name="build/**"/> |
| <exclude name="**/.svn/**"/> |
| <exclude name="${release.dir.name}"/> |
| </fileset> |
| </copy> |
| <zip destfile="${build.dir}/${release.zip.name}" |
| basedir="${build.dir}" |
| includes="${release.dir.name}/**" |
| excludes="**/${release.zip.name}"/> |
| </target> |
| |
| <!-- =================================================================== |
| - all - everything |
| - =================================================================== --> |
| <target name="all" depends="release"/> |
| |
| </project> |
| |