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="lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <path id="jalopy.classpath">
    <fileset dir="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/>
    <property name="lib" value="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="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-dev.jar"/>
    <property name="oscore.jar" value="oscore-2.2.1.jar"/>
    <property name="build" value="build"/>
    <property name="build.test" value="${build}/test"/>
    <property name="build.java" value="${build}/java"/>

    <property name="dist" value="dist"/>
    <property name="deployment" value="deployment"/>
    <property name="docs" value="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.jar to ${ant.home}/lib"/>
  </target>

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

  <!-- Compile Java -->
  <target name="java" depends="init">
    <mkdir dir="${build.java}/META-INF"/>
    <javac destdir="${build.java}" classpathref="cp" debug="on">
      <src path="${src.java}"/>
    </javac>
    <copy todir="${build.java}">
      <fileset dir="${src.java}">
        <exclude name="**/*.java"/>
        <exclude name="**/package.html"/>
      </fileset>
    </copy>
    <copy file="${src.etc}/ejb/ejb-jar.xml" todir="${build.java}/META-INF"/>
    <copy file="${src.etc}/orion/orion-ejb-jar.xml" todir="${build.java}/META-INF"/>
    <copy file="${src.etc}/jrun/jrun-ejb-jar.xml" todir="${build.java}/META-INF"/>
    <copy todir="${build.java}">
      <fileset dir="${src.etc}/pramati" />
    </copy>
    <copy todir="${build.java}/META-INF">
      <fileset dir="${src.etc}/castor" />
    </copy>
    <copy todir="${build.java}/META-INF">
      <fileset dir="${src.etc}/jboss" />
    </copy>
    <copy todir="${build.java}/META-INF">
      <fileset dir="${src.etc}/weblogic" />
    </copy>
  </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 srcdir="${src.java}" destdir="${build.test}" debug="on" classpathref="cp" compiler="org.apache.tools.ant.taskdefs.CloverCompilerAdapter" />
    <javac srcdir="${src.test}" destdir="${build.test}" classpathref="cp" debug="on"/>
    <copy todir="${build.test}">
      <fileset dir="${src.test}">
        <include name="**/*.xml" />
      </fileset>
    </copy>
    <mkdir dir="${dist}/docs/junit"/>
    <junit printsummary="withOutAndErr" haltonfailure="no" haltonerror="yes" 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"/>
        </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}.jar"/>
  </target>

  <target name="example" depends="jar">
    <mkdir dir="${tmp}"/>
    <!-- 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}/lib">
        <include name="oscore**"/>
        <include name="prop**"/>
      </fileset>
    </copy>
    <copy todir="${tmp}/example">
      <fileset dir="example">
        <include name="META-INF/**"/>
        <include name="manager/**"/>
      </fileset>
    </copy>
    <mkdir dir="${tmp}/example/lib"/>
    <copy todir="${tmp}/example/lib">
      <fileset dir="${lib}/build/">
        <include name="log4j.jar"/>
      </fileset>
      <fileset dir="${lib}/optional/">
        <include name="*.jar"/>
      </fileset>
      <fileset dir="${lib}/lib">
        <include name="common**"/>
      </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"/>
    <copy file="${deployment}/pramati/pramati-j2ee-server.xml" todir="${tmp}/example/"/>
    <copy file="${deployment}/pramati/pramati-or-map.xml" todir="${tmp}/example/"/>
    <copy file="${deployment}/pramati/queries.props" todir="${tmp}/example/"/>
    <jar basedir="${tmp}/example" jarfile="${dist}/osuser_example.ear"/>

  </target>

  <target name="javadocs" depends="init">
    <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"/>
  </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">
    <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.