osuser / build.xml

<?xml version="1.0"?>

<!-- OSUser build file - http://www.opensymphony.com/osuser -->

<project name="osuser" default="jar" basedir=".">
  <property file="build.properties"/>
  <path id="cp">
    <fileset dir="${basedir}/lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <path id="jalopy.classpath">
    <fileset dir="${basedir}/lib/build/jalopy">
      <include name="*.jar"/>
    </fileset>
  </path>

  <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
    <classpath refid="jalopy.classpath"/>
  </taskdef>

  <!-- Setup details -->
  <target name="init">
    <tstamp>
      <format property="release" pattern="-dMMMyy" locale="en" timezone="GMT"/>
    </tstamp>
    <property name="lib" value="${basedir}/lib"/>
    <property name="lib.core" value="${lib}/core"/>
    <property name="lib.build" value="${lib}/build"/>
    <property name="lib.optional" value="${lib}/optional"/>

    <property name="src" value="${basedir}/src"/>
    <property name="src.java" value="${src}/java"/>
    <property name="src.test" value="${src}/test"/>
    <property name="src.etc" value="${src}/etc"/>

    <property name="propertyset.jar" value="propertyset-1.3-25Dec03.jar"/>
    <property name="oscore.jar" value="oscore-2.2.2-18Dec03.jar"/>

    <property name="build" value="build"/>
    <property name="build.test" value="${build}/test"/>
    <property name="build.java" value="${build}/java"/>
    <property name="generated.src.java" value="${build}/gen/java"/>

    <property name="tmp" value="${basedir}/tmp" />
    <property name="dist" value="${basedir}/dist"/>
    <property name="deployment" value="${basedir}/deployment"/>
    <property name="docs" value="${basedir}/docs"/>

    <property name="clover.initstring" location="testcoverage.db"/>

    <property name="packages" value="com.opensymphony..user.*"/>

    <available property="junit.available" classname="junit.framework.TestCase"/>
    <available property="clover.available" classname="org.apache.tools.ant.taskdefs.CloverCompilerAdapter"/>
  </target>

  <target name="junit-check" depends="init" unless="junit.available">
    <fail message="Cannot run test cases. Please copy lib/build/junit-3.8.1.jar to ${ant.home}/lib"/>
  </target>

  <target name="clover-check" depends="init" unless="clover.available">
    <fail message="Cannot run coverage tests. Please copy lib/build/clover-1.2.3.jar to ${ant.home}/lib"/>
  </target>

  <!-- Remove all built files -->
  <target name="clean" depends="init">
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
    <delete dir="${tmp}"/>
    <delete>
      <fileset dir="." includes="testcoverage.db*"/>
    </delete>
  </target>

  <!-- Compile Java -->
  <target name="java" depends="init,ejbdoclet">
    <mkdir dir="${build.java}/META-INF"/>
    <javac destdir="${build.java}" classpathref="cp" debug="on">
      <src path="${src.java}"/>
      <src path="${generated.src.java}"/>
    </javac>
    <copy todir="${build.java}">
    <!-- is this just for hibernate mappings? -->
      <fileset dir="${src.java}">
        <exclude name="**/*.java"/>
        <exclude name="**/package.html"/>
      </fileset>
    </copy>
    <copy todir="${build.java}/META-INF">
      <fileset dir="${src.etc}/castor" />
    </copy>
  </target>

  <target name="ejbdoclet" depends="init">
    <taskdef name="ejbdoclet" classname="xdoclet.modules.ejb.EjbDocletTask" classpathref="cp"/>
      <mkdir dir="${generated.src.java}"/>

    <ejbdoclet ejbspec="2.0" verbose="false" destdir="${generated.src.java}">
      <fileset dir="src/java">
        <include name="**/*EJB.java"/>
      </fileset>
      <remoteinterface/>
      <localinterface/>
      <homeinterface/>
      <localhomeinterface/>
      <!--<valueobject/>-->
      <!--<entitypk/>-->
      <entitycmp/>
      <session/>
      <utilobject pattern="{0}HomeFactory" cacheHomes="true" />
      <deploymentdescriptor destdir="${build}/java/META-INF" validatexml="true" description="OpenSymphony OSUser" displayname="Sequence Module"/>
      <jboss version="3.0" destdir="${build}/java/META-INF"/>
      <weblogic version="7.0" destdir="${build}/java/META-INF" datasource="defaultDS" createtables="true"/>
      <jrun version="4.0" destdir="${build}/java/META-INF"/>
      <orion version="2.0" destdir="${build}/java/META-INF"/>
    </ejbdoclet>
  </target>


  <target name="test" depends="clover-check,junit-check">
    <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>

    <mkdir dir="${build.test}/META-INF"/>
    <javac destdir="${build.test}" debug="on" classpathref="cp" compiler="org.apache.tools.ant.taskdefs.CloverCompilerAdapter" >
      <src path="${src.java}"/>
      <src path="${generated.src.java}"/>
    </javac>
    <javac srcdir="${src.test}" destdir="${build.test}" classpathref="cp" debug="on"/>
    <copy todir="${build.test}">
      <fileset dir="${src.test}">
        <include name="**/*.xml" />
        <include name="**/*.properties"/>
        <include name="**/*.sql"/>
      </fileset>
    </copy>
    <mkdir dir="${dist}/docs/junit"/>
    <junit printsummary="withOutAndErr" haltonfailure="no" haltonerror="no" showoutput="yes">
      <classpath>
        <pathelement location="${build.test}"/>
        <path refid="cp"/>
      </classpath>

      <formatter type="xml"/>

      <batchtest todir="${dist}/docs/junit">
        <fileset dir="${src.test}">
          <include name="**/*Test.java"/>
          <exclude name="**/Base*Test.java"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="format" depends="java">
    <jalopy fileformat="unix" convention="${src.etc}/jalopy.xml" history="file" historymethod="adler32" loglevel="error" threads="2" classpathref="cp">
      <fileset dir="${src.java}">
        <include name="**/*.java"/>
      </fileset>
      <!-- <fileset dir="${src.test}">
          <include name="**/*.java" />

      </fileset>
      -->
    </jalopy>
  </target>

  <!-- Build jar archive -->
  <target name="jar" depends="format">
    <mkdir dir="${dist}"/>
    <jar basedir="${build.java}" jarfile="${dist}/${name}-${version}${release}.jar"/>
  </target>

  <target name="example" depends="jar">
    <mkdir dir="${tmp}/example/lib"/>
    <!-- copies the osuser jar without the version info attached to the jar
         file name, as that is how its referenced in the
         example/META-INF/application.xml file -->
    <copy tofile="${tmp}/example/${name}.jar">
      <fileset dir="${dist}">
        <include name="${name}*.jar"/>
      </fileset>
    </copy>
    <copy todir="${tmp}/example">
      <fileset dir="${lib}/build/">
        <include name="castor-0.9.3.9.jar"/>
      </fileset>
      <fileset dir="${lib}/core">
        <include name="oscore**"/>
        <include name="prop**"/>
      </fileset>
    </copy>
    <touch file="${tmp}/example/${oscore.jar}" millis="500"/>
    <touch file="${tmp}/example/${propertyset.jar}" millis="500"/>
    <jar jarfile="${tmp}/example/${oscore.jar}" update="true" manifest="${src.etc}/ejb/manifest.txt"/>
    <jar jarfile="${tmp}/example/${propertyset.jar}" update="true" manifest="${src.etc}/ejb/manifest.txt"/>

    <copy todir="${tmp}/example">
      <fileset dir="example">
        <include name="META-INF/**"/>
        <include name="manager/**"/>
      </fileset>
      <fileset dir="${lib}/build/">
        <include name="log4j.jar"/>
      </fileset>
    </copy>
	  <copy todir="${tmp}/example/lib">
      <fileset dir="${lib}/build/">
        <include name="log4j.jar"/>
      </fileset>
      <fileset dir="${lib}/core">
        <include name="commons-logging.jar"/>
      </fileset>
      <fileset dir="example/manager/WEB-INF/classes">
        <include name="osuser.xml"/>
      </fileset>
	  </copy>
    <copy todir="${tmp}/example/manager/WEB-INF/lib">
      <fileset dir="${lib}/optional/">
        <include name="*.jar"/>
      </fileset>
    </copy>
    <jar basedir="example/testclient" jarfile="${tmp}/example/testclient.jar" manifest="example/testclient/META-INF/MANIFEST.MF"/>
    <jar basedir="${tmp}/example/manager" jarfile="${tmp}/example/manager.war"/>
    <jar basedir="${tmp}/example" jarfile="${dist}/osuser_example.ear"/>

  </target>

  <target name="javadocs" depends="ejbdoclet">
    <mkdir dir="${dist}/docs/api"/>
    <javadoc sourcepath="${src.java}" destdir="${dist}/docs/api"
      packagenames="${packages}" classpathref="cp" author="true"
      version="true" windowTitle="${name} ${version} API" doctitle="${name}"
      footer="See &lt;a href=&quot;http://www.opensymphony.com&quot;&gt;www.opensymphony.com&lt;/a&gt; for more information."
      use="true" verbose="false" stylesheetfile="${docs}/api.css" />
  </target>

  <target name="clover.report" depends="test">
    <java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter" fork="true">
      <arg line="--outputdir ${dist}/docs/clover --showSrc --initstring ${clover.initstring} --title '${name}'"/>
      <classpath refid="cp"/>
    </java>
  </target>

  <target name="junit.report" depends="test">
    <junitreport todir="${dist}/docs/junit">
      <fileset dir="${dist}/docs/junit">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${dist}/docs/junit"/>
    </junitreport>
  </target>

  <target name="docs" depends="javadocs, clover.report, junit.report">
    <mkdir dir="${docs}"/>
    <copy todir="${dist}/docs">
      <fileset dir="${docs}"/>
    </copy>
  </target>

</project>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.