osworkflow / build.xml

<project default="jar" basedir=".">

  <property file="build.properties"/>
  <path id="cp">
    <fileset dir="lib">
      <include name="**/*.jar"/>
      <exclude name="**/jalopy/**" />
    </fileset>
  </path>

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

  <path id="client.classpath">
    <fileset dir="lib/designer">
      <include name="*.jar"/>
    </fileset>
    <pathelement path="dist/${name}-${version}.jar"/>
    <pathelement path="lib/core/commons-logging.jar"/>
  </path>

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

  <taskdef name="ejbdoclet" classname="xdoclet.modules.ejb.EjbDocletTask" classpathref="cp"/>

  <target name="init">
    <tstamp/>
    <property name="lib" location="lib"/>
    <property name="lib.core" value="${lib}/core"/>
    <property name="lib.designer" value="${lib}/designer"/>
    <property name="lib.build" value="${lib}/build"/>
    <property name="lib.optional" value="${lib}/optional"/>

    <property name="src" location="src"/>
    <property name="src.java" value="${src}/java"/>
    <property name="src.test" value="${src}/test"/>
    <property name="src.client" value="${src}/designer"/>
    <property name="src.etc" value="${src}/etc"/>
    <property name="src.webapp" value="${src}/webapp"/>
    <property name="propertyset.jar" value="propertyset-1.3-30Dec03.jar"/>
    <property name="oscore.jar" value="oscore-2.2.1.jar"/>
    <property name="build" location="build"/>
    <property name="build.test" value="${build}/test"/>
    <property name="build.java" value="${build}/java"/>
    <property name="build.client" value="${build}/designer"/>

    <property name="dist" location="dist"/>
    <property name="dist.client" value="${dist}/designer"/>
    <property name="www" location="www"/>
    <property name="dist.docs" value="${dist}/docs"/>

    <property name="docs" location="docs"/>

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

    <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>

  <target name="clean" depends="init" description="Remove all compiled files and generated sources">
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
    <delete>
      <fileset dir="${src.java}/com/opensymphony/workflow/spi/ejb">
        <exclude name="*EJB*.java"/>
        <exclude name="Abstract*.java"/>
        <exclude name="StepComparator.java"/>
      </fileset>
      <fileset dir="${src.java}/com/opensymphony/workflow/ejb">
        <exclude name="*EJB*.java"/>
      </fileset>
    </delete>
    <delete dir="clover-db" />
  </target>

  <target name="ejbdoclet" depends="init">
    <ejbdoclet ejbspec="2.0" verbose="false" destdir="${src.java}">
      <fileset dir="${src.java}">
        <include name="**/ejb/**/*EJB.java"/>
      </fileset>
      <remoteinterface pattern="{0}Remote"/>
      <localinterface/>
      <homeinterface/>
      <localhomeinterface/>
      <!--<valueobject/>-->
      <entitypk/>
      <entitycmp/>
      <session/>
      <utilobject pattern="{0}HomeFactory" cacheHomes="true"/>
      <deploymentdescriptor destdir="${build.java}/META-INF" validatexml="true" description="OpenSymphony Workflow Module" displayname="OSWorkflow 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="java" depends="ejbdoclet,format" description="Compile all java sources">
    <mkdir dir="${build.java}"/>
    <copy filtering="no" todir="${build.java}">
      <fileset dir="${src.java}">
        <exclude name="**/*.java"/>
        <exclude name="**/package.html"/>
      </fileset>
    </copy>

    <javac srcdir="${src.java}" destdir="${build.java}" classpathref="cp" debug="on"/>
  </target>

  <target name="test" depends="clover-check,init-clover,junit-check,ejbdoclet" description="Run all unit tests">
    <jalopy fileformat="unix" convention="${src}/etc/jalopy.xml" history="file" historymethod="adler32" loglevel="error" threads="2" classpathref="cp">
      <fileset dir="${src.test}">
        <include name="**/*.java"/>
      </fileset>
    </jalopy>
    <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>

    <mkdir dir="${build.test}/META-INF"/>
    <copy todir="${build.test}/META-INF/">
      <fileset dir="${docs}">
        <include name="*.dtd" />
      </fileset>
    </copy>
    <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" />
        <include name="**/*.properties"/>
        <include name="**/*.sql"/>
      </fileset>
    </copy>
    <copy todir="${build.test}">
      <fileset dir="${src.java}">
        <include name="**/*.xml"/>
        <include name="**/*.properties"/>
      </fileset>
    </copy>
    <mkdir dir="${dist.docs}/junit"/>
    <junit printsummary="withOutAndErr" haltonfailure="no" haltonerror="no" showoutput="true" fork="true">
      <classpath>
        <pathelement location="${build.test}"/>
        <path refid="cp"/>
      </classpath>

      <formatter type="xml"/>

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

  <target name="format" depends="init">
    <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>

  <target name="init-clover" depends="init">
    <taskdef resource="clovertasks"/>
    <typedef resource="clovertypes"/>
    <mkdir dir="clover-db" />
    <clover-setup initstring="clover-db/coverage.db" />
  </target>

  <target name="jar" depends="java" description="Build osworkflow dist jar file">
    <mkdir dir="${dist}"/>
    <copy todir="${build.java}/META-INF">
      <fileset dir="${docs}">
        <include name="*.dtd"/>
      </fileset>
    </copy>
    <jar basedir="${build.java}" jarfile="${dist}/${name}-${version}.jar" manifest="${src.etc}/deployment/ejb/manifest.txt"/>
  </target>

  <target name="example-war" depends="jar" description="Build example war web application">
    <war warfile="${dist}/${name}-${version}-example.war" webxml="${src.etc}/example/web.xml">
      <fileset dir="${src.webapp}"/>
      <lib dir="${lib.core}"/>
      <lib file="${dist}/${name}-${version}.jar"/>
      <lib file="${lib.optional}/osuser-1.0-dev-3Dec03.jar"/>
      <lib file="${lib.optional}/mail.jar"/>
      <lib file="${lib.optional}/activation.jar"/>
      <lib file="${lib.optional}/quartz.jar"/>
      <lib file="${lib.optional}/bsh-1.2b7.jar"/>
      <classes dir="${src.etc}/example">
        <exclude name="web.xml"/>
      </classes>
    </war>
  </target>

  <target name="example-ear" depends="jar" description="Build ear application using the EJB store">
    <mkdir dir="${build}/tmp/lib"/>
    <war warfile="${build}/tmp/${name}-${version}-example.war" webxml="${src.etc}/example/web.xml">
      <fileset dir="${src.webapp}"/>
    </war>
    <copy file="${dist}/${name}-${version}.jar" tofile="${build}/tmp/${name}-${version}-example.jar"/>
    <!-- note that we add these files to the jarfile for ease of deployment. In a real environment, the config files
    would be in a separate dir and added appropriately to the classpath -->
    <copy file="${src.etc}/example/osworkflow-ejb.xml" tofile="${build}/tmp/osworkflow.xml"/>
    <copy file="${src.etc}/example/workflows.xml" todir="${build}/tmp"/>
    <copy file="${src.etc}/example/example.xml" todir="${build}/tmp"/>
    <touch file="${build}/tmp/${name}-${version}-example.jar" millis="500"/>
    <jar file="${build}/tmp/${name}-${version}-example.jar" update="true" basedir="${build}/tmp">
      <include name="*.xml"/>
    </jar>
    <copy file="${lib.core}/${oscore.jar}" todir="${build}/tmp"/>
    <copy file="${lib.core}/${propertyset.jar}" todir="${build}/tmp"/>
    <copy file="${lib.core}/commons-logging.jar" todir="${build}/tmp/lib"/>
    <copy file="${lib.optional}/osuser-1.0-dev-3Dec03.jar" todir="${build}/tmp/lib"/>
    <copy file="${lib.optional}/quartz.jar" todir="${build}/tmp/lib"/>
    <copy file="${lib.optional}/bsh-1.2b7.jar" todir="${build}/tmp/lib"/>
    <!-- update the manifests of the other ejb modules -->
    <touch file="${build}/tmp/${oscore.jar}" millis="500"/>
    <touch file="${build}/tmp/${propertyset.jar}" millis="500"/>
    <jar jarfile="${build}/tmp/${oscore.jar}" update="true" manifest="${src.etc}/deployment/ejb/manifest.txt"/>
    <jar jarfile="${build}/tmp/${propertyset.jar}" update="true" manifest="${src.etc}/deployment/ejb/manifest.txt"/>
    <ear appxml="${src.etc}/example/application.xml" earfile="${dist}/${name}-${version}-example.ear" basedir="${build}/tmp">
    </ear>
  </target>

  <target name="client" depends="jar" description="Build the designer client sources">
    <mkdir dir="${build.client}"/>
    <javac classpathref="client.classpath" srcdir="${src.client}" destdir="${build.client}"/>
    <copy todir="${build.client}">
      <fileset dir="${src.client}">
        <exclude name="**/*.java"/>
      </fileset>
    </copy>
  </target>

  <target name="client-jar" depends="client" description="Build the designer jar file">
    <jar basedir="${build.client}" jarfile="${dist}/designer.jar" manifest="${build.client}/META-INF/MANIFEST.MF"/>
  </target>

  <target name="webstart" depends="client-jar" description="Build webstart files">
    <mkdir dir="${dist.docs}/designer" />
    <signjar signedjar="${dist.docs}/designer/designer.jar" alias="opensymphony" jar="${dist}/designer.jar" storepass="123456" keystore="${lib.build}/OSKeystore" />
    <signjar signedjar="${dist.docs}/designer/looks.jar" alias="opensymphony" jar="${lib.designer}/looks.jar" storepass="123456" keystore="${lib.build}/OSKeystore" />
    <signjar signedjar="${dist.docs}/designer/jgraph.jar" alias="opensymphony" jar="${lib.designer}/jgraph.jar" storepass="123456" keystore="${lib.build}/OSKeystore" />
    <signjar signedjar="${dist.docs}/designer/foxtrot.jar" alias="opensymphony" jar="${lib.designer}/foxtrot.jar" storepass="123456" keystore="${lib.build}/OSKeystore"/>
    <signjar signedjar="${dist.docs}/designer/forms.jar" alias="opensymphony" jar="${lib.designer}/forms.jar" storepass="123456" keystore="${lib.build}/OSKeystore" />
    <signjar signedjar="${dist.docs}/designer/osworkflow.jar" alias="opensymphony" jar="${dist}/${name}-${version}.jar" storepass="123456" keystore="${lib.build}/OSKeystore" />
    <signjar signedjar="${dist.docs}/designer/commons-logging.jar" alias="opensymphony" jar="${lib.core}/commons-logging.jar" storepass="123456" keystore="${lib.build}/OSKeystore" />
  </target>

  <target name="javadocs" depends="init" description="Build javadocs">
    <mkdir dir="${dist.docs}/api"/>
    <javadoc sourcepath="${src.java}" stylesheetfile="${docs}/api.css" 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" description="Generate clover coverage reports">
    <clover-report>
      <current title="OSWorkflow Coverage Report" outfile="${dist.docs}/clover">
        <format type="html" />
      </current>
    </clover-report>
  </target>

  <target name="junit.report" depends="test" description="Generate junit test results reports">
    <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, webstart, reports" description="Build all documentation">
    <copy todir="${dist.docs}">
      <fileset dir="${docs}"/>
    </copy>
  </target>

  <target name="reports" depends="clover.report, junit.report" description="Generate junit and clover reports"/>

  <target name="dist" depends="client-jar, example-war, docs" description="Build distribution zipfile">
    <mkdir dir="${dist}/zip"/>
    <mkdir dir="${dist}/zip/docs"/>
    <mkdir dir="${dist}/zip/src"/>
    <mkdir dir="${dist}/zip/lib/core"/>
    <mkdir dir="${dist}/zip/lib/designer"/>

    <copy todir="${dist}/zip/docs">
      <fileset dir="${dist.docs}"/>
    </copy>

    <copy todir="${dist}/zip/src">
      <fileset dir="src"/>
    </copy>

    <copy todir="${dist}/zip/lib/core">
      <fileset dir="${lib.core}"/>
    </copy>

    <copy todir="${dist}/zip/lib/designer">
      <fileset dir="${lib.designer}"/>
    </copy>

    <copy file="${dist}/${name}-${version}.jar" todir="${dist}/zip"/>
    <copy file="${dist}/designer.jar" todir="${dist}/zip"/>
    <copy file="${dist}/${name}-${version}-example.war" todir="${dist}/zip"/>

    <zip zipfile="${dist}/${name}-${version}.zip" basedir="${dist}/zip"/>
<!--    <delete dir="${dist}/zip"/>-->
  </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.