build.xml   [plain text]


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project [
   <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
   <!ENTITY libraries SYSTEM "../tools/etc/buildmagic/libraries.ent">
   <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
]>

<!-- ====================================================================== -->
<!--                                                                        -->
<!--  JBoss, the OpenSource J2EE webOS                                      -->
<!--                                                                        -->
<!--  Distributable under LGPL license.                                     -->
<!--  See terms of license at http://www.gnu.org.                           -->
<!--                                                                        -->
<!-- ====================================================================== -->

<!-- $Id: build.xml,v 1.23.2.12 2003/11/10 06:45:55 starksm Exp $ -->

<project default="main" name="JBoss/System">

  <!-- ================================================================== -->
  <!-- Setup                                                              -->
  <!-- ================================================================== -->

  <!--
     | Include the common Buildmagic elements.
     |
     | This defines several different targets, properties and paths.
     | It also sets up the basic extention tasks amoung other things.
   -->

  &buildmagic;


  <!-- ================================================================== -->
  <!-- Initialization                                                     -->
  <!-- ================================================================== -->

  <!--
     | Initialize the build system.  Must depend on '_buildmagic:init'.  
     | Other targets should depend on 'init' or things will mysteriously fail.
   -->

  <target name="init" unless="init.disable" depends="_buildmagic:init">
  </target>


  <!-- ================================================================== -->
  <!-- Configuration                                                      -->
  <!-- ================================================================== -->

  <!--
     | Configure the build system.  
     |
     | This target is invoked by the Buildmagic initialization logic and 
     | should contain module specific configuration elements.
   -->

  <target name="configure" unless="configure.disable">

    <!-- =================== -->
    <!-- Basic Configuration -->
    <!-- =================== -->

    <!-- Module name(s) & version -->
    <property name="module.name" value="system"/>
    <property name="module.Name" value="JBoss System"/>
    <property name="module.version" value="DEV"/>

    <!-- ========= -->
    <!-- Libraries -->
    <!-- ========= -->
    &libraries;
    <!-- The combined library classpath -->
    <path id="library.classpath">
      <path refid="junit.junit.classpath"/>
      <path refid="gnu.getopt.classpath"/>
      <path refid="apache.xalan.classpath"/>
      <path refid="apache.log4j.classpath"/>
      <path refid="apache.commons.classpath"/>
      <path refid="oswego.concurrent.classpath"/>
    </path>

    <!-- ======= -->
    <!-- Modules -->
    <!-- ======= -->
    &modules;
    <!-- The combined dependant module classpath -->
    <path id="dependentmodule.classpath">
      <path refid="jboss.common.classpath"/>
      <path refid="jboss.jmx.classpath"/>
    </path>

    <!-- Where source files live -->
    <property name="source.java" value="${module.source}/main"/>
    <property name="source.etc" value="${module.source}/etc"/>
    <property name="source.bin" value="${module.source}/bin"/>
    <property name="source.resources" value="${module.source}/resources"/>

    <!-- Where build generated files will go -->
    <property name="build.reports" value="${module.output}/reports"/>
    <property name="build.classes" value="${module.output}/classes"/>
    <property name="build.lib" value="${module.output}/lib"/>
    <property name="build.api" value="${module.output}/api"/>
    <property name="build.etc" value="${module.output}/etc"/>
    <property name="build.bin" value="${module.output}/bin"/>
    <property name="build.gen" value="${module.output}/gen"/>
    <property name="build.gen-src" value="${module.output}/gen-src"/>
    <property name="build.resources" value="${module.output}/resources"/>
    <property name="build.todo" value="${module.output}/todo"/>

    <!-- Install/Release structure -->
    <property name="install.id" value="${module.name}-${module.version}"/>
    <property name="release.id" value="${install.id}"/>
    <property name="install.root" value="${module.output}/${install.id}"/>

    <!-- The combined thirdparty classpath -->
    <path id="thirdparty.classpath">
      <path refid="library.classpath"/>
      <path refid="dependentmodule.classpath"/>
    </path>

    <!-- This module is based on Java 1.2 -->
    <property name="javac.target" value="1.2"/>

    <!-- classpath and local.classpath must have a value using with a path -->
    <property name="classpath" value=""/>
    <property name="local.classpath" value=""/>

    <!-- The classpath required to build classes. -->
    <path id="javac.classpath">
      <pathelement path="${classpath}"/>
      <pathelement path="${local.classpath}"/>
      <path refid="thirdparty.classpath"/>
    </path>

    <!-- The classpath required to build javadocs. -->
    <path id="javadoc.classpath">
      <path refid="javac.classpath"/>
    </path>

    <!-- Packages to include when generating api documentation -->
    <property name="javadoc.packages" value="org.jboss.*"/>

  </target>


  <!-- ================================================================== -->
  <!-- Compile                                                            -->
  <!-- ================================================================== -->

  <!-- 
     | Compile everything.
     |
     | This target should depend on other compile-* targets for each 
     | different type of compile that needs to be performed, short of
     | documentation compiles.
   -->

  <target name="compile" 
	  description="Compile all source files."
	  depends="compile-classes,
                   compile-resources,
                   compile-etc,
                   compile-bin"/>

  <!-- Compile mbeans with XDoclet -->
  <target name="compile-mbean-sources" depends="init">
    <taskdef name="jmxdoclet" classname="xdoclet.modules.jmx.JMXDocletTask" classpathref="xdoclet.task.classpath"/>

    <mkdir dir="${build.gen-src}"/>
    <jmxdoclet 
	     destdir="${build.gen-src}"
	     excludedtags="@version,@author">
      <fileset dir="${source.java}">
        <include name="**/*.java"/>
      </fileset>
      <mbeaninterface mergedir="${project.tools}/etc/xdoclet/templates"/>
    </jmxdoclet>
  </target>

  <!-- Compile all class files -->
  <target name="compile-classes" depends="compile-mbean-sources">
    <mkdir dir="${build.classes}"/>
    <javac destdir="${build.classes}"
           optimize="${javac.optimize}"
	   target="${javac.target}"
           debug="${javac.debug}"
	   depend="${javac.depend}"
	   verbose="${javac.verbose}"
	   deprecation="${javac.deprecation}"
	   includeAntRuntime="${javac.include.ant.runtime}"
	   includeJavaRuntime="${javac.include.java.runtime}"
	   failonerror="${javac.fail.onerror}">
       <src path="${source.java}"/>
       <src path="${build.gen-src}"/>
       <classpath refid="javac.classpath"/>
       <include name="${javac.includes}"/>
       <exclude name="${javac.excludes}"/>
       <exclude name="org/jboss/system/JBossRMIClassLoader.java" unless="HAVE_JDK_1.4"/>
    </javac>
  </target>

  <!-- Compile resource files -->
  <target name="compile-resources" depends="init">
    <mkdir dir="${build.resources}"/>
    <copy todir="${build.resources}" filtering="yes">
      <fileset dir="${source.resources}">
         <include name="**/*"/>
      </fileset>
    </copy>
  </target>

  <!-- Compile etc files (manifests and such) -->
  <target name="compile-etc" depends="init">
    <mkdir dir="${build.etc}"/>
    <copy todir="${build.etc}" filtering="yes">
      <fileset dir="${source.etc}">
         <include name="**/*"/>
      </fileset>
    </copy>
  </target>

  <!-- Compile bin scripts -->
  <target name="compile-bin" depends="init">
    <mkdir dir="${build.bin}"/>
    <copy todir="${build.bin}" filtering="yes">
      <fileset dir="${source.bin}">
         <include name="**/*"/>
      </fileset>
    </copy>

    <fixcrlf srcdir="${build.bin}"
	     eol="lf" eof="remove"
	     includes="**/*.sh, **/*.conf"/>

    <fixcrlf srcdir="${build.bin}" 
	     eol="crlf" eof="remove"
	     includes="**/*.bat, **/*.cmd"/>

    <chmod perm="+x">
      <fileset dir="${build.bin}">
         <include name="**/*.sh"/>
      </fileset>
    </chmod>
  </target>


  <!-- ================================================================== -->
  <!-- Archives                                                           -->
  <!-- ================================================================== -->

  <!-- 
     | Build all jar files.
   -->
  <target name="jars" 
	  description="Builds all jar files."
     depends="_buildmagic:build-bypass-check"
	  unless="build-bypass.on">

    <call target="compile"/>

    <mkdir dir="${build.lib}"/>

    <!-- 
       | Build log4j-boot.jar This is a minimal subset of the log4j
       | classes that allow the boot process to use log4j but avoids
       | loading log4j classes that depend on other features like
       | JMS, JDBC, JavaMail, etc.
     -->
    <mkdir dir="${build.gen}/log4j"/>
    <unjar src="${apache.log4j.lib}/log4j.jar" dest="${build.gen}/log4j"/>
    <jar jarfile="${build.lib}/log4j-boot.jar">
      <fileset dir="${build.gen}/log4j">
        <include name="org/apache/log4j/*"/>
        <include name="org/apache/log4j/config/*"/>
        <include name="org/apache/log4j/helpers/*"/>
        <include name="org/apache/log4j/or/*"/>
        <include name="org/apache/log4j/spi/*"/>
      </fileset>
    </jar>

    <!-- Build jboss-boot.jar -->
    <jar jarfile="${build.lib}/jboss-boot.jar" manifest="${build.etc}/default.mf">
      <fileset dir="${build.classes}">
        <include name="org/jboss/system/server/NoAnnotationURLClassLoader.class"/>
        <include name="org/jboss/system/server/ServerLoader*.class"/>
        <include name="org/jboss/system/server/Server.class"/>
        <include name="org/jboss/system/server/ServerConfig.class"/>
      </fileset>
    </jar>

    <!-- Build jboss-system.jar -->
    <jar jarfile="${build.lib}/jboss-system.jar" manifest="${build.etc}/default.mf">
      <fileset dir="${build.classes}">
        <!-- Forget about these CLI classes -->
        <exclude name="org/jboss/Main*.class"/>

        <!-- Include everything else -->
        <include name="org/jboss/**"/>
      </fileset>
      <fileset dir="${build.resources}">
        <include name="org/jboss/version.properties"/>
        <include name="org/jboss/metadata/*"/>
      </fileset>
    </jar>

    <!-- Build jboss-system-client.jar -->
    <jar jarfile="${build.lib}/jboss-system-client.jar" manifest="${build.etc}/default.mf">
      <fileset dir="${build.classes}">
        <include name="org/jboss/deployment/DeploymentException*"/>
        <include name="org/jboss/deployment/IncompleteDeploymentException*"/>
        <include name="org/jboss/deployment/Deployer*"/>
        <include name="org/jboss/system/Service.class"/>
        <include name="org/jboss/system/server/ServerLoader*.class"/>
        <include name="org/jboss/system/server/Server.class"/>
        <include name="org/jboss/system/server/ServerConfig.class"/>
        <include name="**/*MBean.class"/>
      </fileset>
    </jar>

    <!-- Unjar getopt better packaging (but slower builds) -->
    <mkdir dir="${build.gen}/getopt"/>
    <unjar src="${gnu.getopt.lib}/getopt.jar" dest="${build.gen}/getopt"/>

    <!-- Build run.jar -->
    <jar jarfile="${build.lib}/run.jar" manifest="${build.etc}/run.mf">
      <fileset dir="${build.classes}">
        <include name="org/jboss/Version*.class"/>
        <include name="org/jboss/Main*.class"/>
        <include name="org/jboss/system/JBossRMIClassLoader.class"/>
        <include name="org/jboss/system/server/NoAnnotationURLClassLoader.class"/>
        <include name="org/jboss/system/server/ServerLoader*.class"/>
        <include name="org/jboss/system/server/Server.class"/>
        <include name="org/jboss/system/server/ServerConfig.class"/>
        <include name="org/jboss/system/ORBSingleton.class"/>
      </fileset>
      <fileset dir="${build.resources}">
        <include name="log4j*.properties"/>
        <include name="org/jboss/version.properties"/>
      </fileset>

      <!-- Include getopt -->
      <fileset dir="${build.gen}/getopt">
        <include name="**"/>
      </fileset>
    </jar>

    <!--
       | JBoss/Testsuite Support
     -->

    <!-- testsuite-support.jar -->
    <jar jarfile="${build.lib}/testsuite-support.jar" manifest="${build.etc}/default.mf">
      <fileset dir="${build.classes}">
         <include name="org/jboss/deployment/**"/>
         <include name="org/jboss/system/Service.class"/>
         <include name="org/jboss/system/ServiceMBean.class"/>
         <include name="org/jboss/system/*MBeanSupport.class"/>
         <include name="org/jboss/system/MBeanClassLoader*.class"/>
         <include name="org/jboss/system/UnifiedClassLoader*.class"/>
         <include name="org/jboss/system/ServiceLibraries*.class"/>
         <include name="org/jboss/system/server/*MBean.class"/>
         <include name="org/jboss/system/server/ServerConfigLocator.class"/>
         <include name="org/jboss/system/server/ServerConfig.class"/>
         <include name="org/jboss/system/server/Server.class"/>
      </fileset>
    </jar>

    <!-- Update the build marker to allow bypassing -->
    <touch file="${build-bypass.marker}"/>

  </target>

  <!-- ================================================================== -->
  <!-- Install & Release                                                  -->
  <!-- ================================================================== -->

  <target name="install" 
	  description="Install the structure for a release."
	  depends="all, _buildmagic:install:default"/>

  <target name="release" depends="install"/>

  <target name="release-zip" 
	  description="Builds a ZIP distribution."
	  depends="release, _buildmagic:release:zip"/>

  <target name="release-tar" 
	  description="Builds a TAR distribution."
	  depends="release, _buildmagic:release:tar"/>

  <target name="release-tgz" 
	  description="Builds a TAR-GZ distribution."
	  depends="release, _buildmagic:release:tgz"/>

  <target name="release-all"
	  description="Builds a distribution for each archive type."
	  depends="release-zip, release-tgz"/>


  <!-- ================================================================== -->
  <!-- Cleaning                                                           -->
  <!-- ================================================================== -->

  <!-- Clean up all build output -->
  <target name="clean" 
	  description="Cleans up most generated files."
	  depends="_buildmagic:clean">
  </target>

  <!-- Clean up all generated files -->
  <target name="clobber" 
	  description="Cleans up all generated files."
	  depends="_buildmagic:clobber, clean">
  </target>


  <!-- ================================================================== -->
  <!-- Misc.                                                              -->
  <!-- ================================================================== -->

  <target name="main"
	  description="Executes the default target (most)."
	  depends="most"/>
    
  <target name="all"
	  description="Builds everything."
	  depends="jars, docs"/>

  <target name="most" 
	  description="Builds almost everything."
	  depends="jars"/>

  <target name="help" 
          description="Show this help message."
	  depends="_buildmagic:help:standard"/>

</project>