jEdit Community home jEdit Community Wiki > Plugins > SampleBuildFiles jEdit Community Wiki webs:
Main | Plugins | Know | TWiki | Sandbox
Plugins . { Changes | Index | Search | Go }

Sample build files

Typical plugin build file


<project name="DBTerminal" default="dist" basedir=".">

  <property name="jedit.install.dir"  value="../.." />
  <property name="jedit.user.home" value="${user.home}/.jedit" />
  <property name="jar.name"  value="${ant.project.name}"/>

  <property name="install.dir"  value=".." />

  <property name="src.dir" value="." />
  <property name="src.classes" value="${src.dir}" />

  <property name="build.dir" value="build" />
  <property name="build.classes" value="${build.dir}/classes" />

  <property name="reports.dir" value="reports" />
  <property name="reports.classes" value="${reports.dir}/classes" />

  <path id="project.class.path">
   <pathelement location="${jedit.install.dir}/jedit.jar"/>
   <pathelement location="${jedit.install.dir}/jars/CommonControls.jar"/>
   <pathelement location="${jedit.user.home}/jars/CommonControls.jar"/>
   <pathelement location="."/>
  </path>

  <target name="clean" description="Deletes all regeneratable files">
   <delete dir="${build.dir}"/>
   <delete dir="${reports.dir}"/>
  </target>

  <target name="compile">
   <mkdir dir="${build.dir}" />
   <mkdir dir="${build.classes}" />
   <javac
     srcdir="${src.classes}"
     destdir="${build.classes}"
     deprecation="on"
     includeJavaRuntime="yes"
   >
     <classpath refid="project.class.path"/>
   </javac>
  </target>

  <target name="dist" depends="compile">
   <mkdir dir="${install.dir}"/>
   <jar jarfile="${install.dir}/${jar.name}.jar">
     <fileset dir=".">
      <include name="**/*.props" />
      <include name="**/*.html" />
      <include name="**/*.gif" />
      <include name="docs/**" />
      <include name="icons/*" />
      <include name="*.xml" />
                <exclude name="build.xml" />
     </fileset>
     <fileset dir="${build.classes}">
      <include name="**/*.class" />
     </fileset>
   </jar>
  </target>

  <target name="dist-src" depends="compile">
   <jar jarfile="${jar.name}-src.jar">
     <fileset dir=".">
      <include name="**/*.props"/>
      <include name="**/*.gif"/>
      <include name="docs/**" />
      <include name="icons/*" />
      <include name="*.xml"/>
     </fileset>
     <fileset dir="${src.dir}">
      <include name="**/*.java" />
     </fileset>
   </jar>
  </target>

</project>

Build file with JUnit tests

<project name="JCounter" default="dist" basedir=".">

   <property name="jar.name"  value="${ant.project.name}"/>
   <property name="jedit.install.dir"  value="../.." />
   <property name="jedit.install.jars" value="${jedit.install.dir}/.jedit" />
   <property name="jedit.user.jars" value="${user.home}/.jedit/jars" />

   <property name="install.dir"  value=".." />

   <property name="src.dir" value="src" />
   <property name="src.classes" value="${src.dir}/main" />
   <property name="src.tests" value="${src.dir}/tests" />

   <property name="build.dir" value="build" />
   <property name="build.classes" value="${build.dir}/classes" />
   <property name="build.tests" value="${build.dir}/tests" />

   <property name="reports.dir" value="reports" />
   <property name="reports.classes" value="${reports.dir}/classes" />
   <property name="reports.tests" value="${reports.dir}/tests" />


   <path id="project.class.path">
      <pathelement location="${jedit.install.dir}/jedit.jar"/>
      <pathelement location="${jedit.install.dir}/jars/CommonControls.jar"/>
      <pathelement location="${jedit.user.home}/jars/CommonControls.jar"/>
      <pathelement location="."/>
   </path>

   <target name="clean" description="Deletes all regeneratable files">
      <delete dir="${build.dir}"/>
      <delete dir="${reports.dir}"/>
   </target>

   <target name="compile">
      <mkdir dir="${build.dir}" />
      <mkdir dir="${build.classes}" />
      <javac
         srcdir="${src.classes}"
         destdir="${build.classes}"
         deprecation="on"
         includeJavaRuntime="yes"
      >
         <classpath refid="project.class.path"/>
      </javac>
   </target>

   <target name="compileTests" depends="compile"
      description="Compiles all tests">
      <!-- Compile the java test code from ${tests.dir} into ${build.tests} -->
      <mkdir dir="${build.tests}"/>
      <javac srcdir="${src.tests}" destdir="${build.tests}"
          deprecation="yes" classpathref="tests.class.path"/>
   </target>

   <target name="runTests" depends="compileTests"
      description="Runs all JUnit tests">
      <mkdir dir="${build.tests}"/>
      <mkdir dir="${reports.tests}"/>

      <!-- Run the JUnit tests in ${tests.dir} -->
      <junit printsummary="yes" haltonfailure="yes" fork="yes">
         <classpath>
            <path refid="tests.class.path"/>
         </classpath>
         <formatter type="plain"/>
         <batchtest fork="yes" todir="${reports.tests}">
            <fileset dir="${build.tests}">
               <include name="**/*Test*"/>
            </fileset>
         </batchtest>
      </junit>
   </target>

   <target name="dist" depends="compile">
      <mkdir dir="${install.dir}"/>
      <jar jarfile="${install.dir}/${jar.name}.jar">
         <fileset dir=".">
            <include name="**/*.props"/>
            <include name="**/*.html"/>
            <include name="**/*.gif"/>
            <include name="docs/**" />
            <include name="icons/*" />
            <include name="*.xml"/>
            <exclude name="build.xml" />
         </fileset>
         <fileset dir="${build.classes}">
            <include name="**/*.class" />
         </fileset>
      </jar>
   </target>

   <target name="dist-src" depends="compile">
      <jar jarfile="${jar.name}-src.jar">
         <fileset dir=".">
            <include name="**/*.props"/>
            <include name="**/*.gif"/>
            <include name="docs/**" />
            <include name="icons/*" />
            <include name="*.xml"/>
         </fileset>
         <fileset dir="${src.dir}">
            <include name="**/*.java" />
         </fileset>
      </jar>
   </target>

</project>
<!-- :tabSize=2:indentSize=2: -->

Additional targets

Check completeness of API Documentation with Doc Check

  <target name="doc-check"
      description="Generate sample documents to be sure the doclet runs">
      <!-- Don't put sampleOut in build dir, as links from DocCheck.html would be broken -->
      <mkdir  dir = "reports/doc-check" />
      <javadoc
            docletpath = "../doccheck.jar"
          doclet          = "com.sun.tools.doclets.doccheck.DocCheck"
          defaultexcludes = "yes"
          sourcepath      = "${src.classes}"
               classpathref = "project.class.path"
          destdir         = "reports/doc-check"
               source = "${jdk.source}"
          additionalparam = "-docletID
                             -title '${ant.project.name}' "
      >
            <packageset dir="${src.classes}" />
         </javadoc>
  </target>

Topic SampleBuildFiles . { Edit | Attach | Ref-By | Printable | Diffs | r1.3 | > | r1.2 | > | r1.1 | More }
Revision r1.3 - 26 Feb 2004 - 01:17 GMT - Brad Mace Copyright © 1999-2011 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding jEdit Community Wiki? Send feedback.
Get jEdit at !SourceForge.net. Fast, secure and Free Open Source software downloads