Javac include and exclude : Compile « Ant « Java






Javac include and exclude

 

<!--
  About this file (build.xml):

  Last modified 2001-11-30
  Author        Matthias Beil
  Contributor   Guillaume Desnoix
  License       GNU General Public License 2 (GPL2)
                Copyright (c) 2001 Matthias Beil
                All rights reserved.
-->

<!--  -->

<project name="alma" default="main" basedir="." >


<!--  -->
<!-- Set up application values -->

<property name="app.name"    value="alma" />
<property name="app.package" value="com/memoire" />
<property name="app.version" value="0.36" />
<property name="app.year"    value="2001" />


<!--  -->
<!-- directory locations -->

<property name="dir.classes"        location="classes" />
<property name="dir.dist"           location="dist" />

<property name="dir.javadocs"       location="docs" />
<property name="dir.project"        location="." />
<property name="dir.src"            location="." />

<property name="dir.package" value="com/memoire" />

<!-- debug setting -->
<property name="debug" value="on"/>

<!-- javadoc package -->
<property name="packages" value="com.memoire.*"/>


<!--  -->
<!-- Show System JVM -->

<target name="showsystem" >
   <!-- might not work!? -->
   <showsystem />
</target>


<!--  -->
<!-- Create necessary directories -->

<target name="prepare">
   <tstamp />

   <mkdir dir="${dir.classes}" />
   <mkdir dir="${dir.dist}" />

</target>


<!--  -->
<!-- Compiles the java source files -->

<target name="compile" depends="prepare">

   <javac
      srcdir="${dir.src}"
      destdir="${dir.classes}"
      classpath="${dir.src}"
      debug="${debug}"
      failonerror="no" >

      <include name="com/memoire/acme/Acme*.java"/>
      <include name="com/memoire/re/RE*.java"/>
      <include name="com/memoire/mst/Mst*.java"/>
      <include name="com/memoire/pbc/Pbc*.java"/>
      <include name="com/memoire/fu/Fu*.java"/>
      <include name="com/memoire/dnd/Dnd*.java"/>
      <include name="com/memoire/xml/Xml*.java"/>
      <include name="com/memoire/yapod/Yapod*.java"/>
      <include name="com/memoire/bu/Bu*.java"/>
      <include name="com/memoire/dja/Dja*.java"/>
      <include name="com/memoire/agl/Agl*.java"/>
      <include name="com/memoire/alma/Alma*.java"/>
      <include name="com/memoire/jedit/JEdit*.java"/>
      <include name="com/memoire/editor/Editor*.java"/>
      <include name="com/memoire/foo/Foo*.java"/>
      <include name="com/memoire/silk/Silk*.java"/>
      <include name="com/memoire/script/Script*.java"/>

      <exclude name="com/memoire/ant/*.java"/>
      <exclude name="com/memoire/editor/EditorJext.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterBeanshell.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterDawn.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterFiji.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterFoo.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterPnuts.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterPython.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterRhino.java"/>
      <exclude name="com/memoire/script/ScriptInterpreterRuby.java"/>

   </javac>

</target>


<!--  -->
<!-- Creates the jar file for distribution -->

<target name="dist" depends="compile">

   <jar jarfile="${dir.dist}/${app.name}.jar"
        manifest="manifest-alma.txt" >
      <fileset dir="${dir.classes}" >
         <patternset>
            <exclude name="**/dependency cache"/>
         </patternset>
      </fileset>
      <fileset dir="${dir.src}" >
         <patternset>
            <include name="**/*.dja"/>
            <include name="**/*.foo"/>
            <include name="**/*.gif"/>
            <include name="**/*.txt"/>
         </patternset>
      </fileset>

   </jar>

</target>


<!--  -->
<!-- Compile and build a distribution -->

<target name="main" depends="compile, dist" >

   <echo>Alma application package created</echo>

</target>


<!--  -->
<!-- Create the API documentation -->

<target name="javadocs" depends="prepare">
   <mkdir dir="${dir.javadocs}"/>

   <javadoc packagenames="${packages}"
            sourcepath="${dir.src}"
            destdir="${dir.javadocs}"
            classpath="${dir.src}"
            author="true"
            version="true"
            use="true"
            windowtitle="${app.name} API"
            doctitle="&lt;h1&gt;${app.name}&lt;/h1&gt;"
   />

</target>


<!--  -->
<!-- Deletes the build and dist directories -->

<target name="clean" >

   <delete dir="${dir.dist}" />
   <delete dir="${dir.classes}" />

</target>


<!--  -->

<target name="all" depends="clean,main,javadocs" >

   <echo>Alma application package cleaned and created</echo>

</target>


<!--  -->
<!-- run application -->

<target name="app-run" depends="main" >
   <java classname="com.memoire.alma.Alma"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>

<target name="run-alma" depends="main" >
   <java classname="com.memoire.alma.Alma"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>

<target name="run-dja" depends="main" >
   <java classname="com.memoire.dja.Dja"
      classpath="${dir.dist}/${app.name}.jar"
      fork="yes">
   </java>
</target>

<target name="run-agl" depends="main" >
   <java classname="com.memoire.agl.Agl"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>

<target name="run-foo" depends="main" >
   <java classname="com.memoire.foo.Foo"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>

<target name="run-reformatage" depends="main" >
   <java classname="com.memoire.agl.AglOutilReformatage"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>

<target name="run-coloration" depends="main" >
   <java classname="com.memoire.agl.AglOutilColoration"
      classpath="${dir.dist}/${app.name}.jar"
      fork="no">
   </java>
</target>


</project>

   
  








Related examples in the same category

1.Compile the web application
2.Ant target:compile
3.Compile the stand-alone application
4.Use a precompiler with Java
5.Indicate the init and max memory when compiling
6.Ant Javac setting
7.Ant javac includes
8.Javac with classpath
9.Javac with encoding
10.Javac with optimize
11.Set debug and optimize for javac
12.Set failonerror for javac
13.Set debuglevel for javac
14.Set link for Javac
15.Set source version in javac
16.Set target for javac
17.Ant compile from src folder to build folder, set the class path and java files include