Skip to main content

Source code file content

Revision: 57041

Fix copyright
» Project Revision History

» Checkout URL

svn / trunk / v2 / entity-persistence / build.xml

Size: 13814 bytes, 1 line
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
 Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
 The contents of this file are subject to the terms of either the GNU
 General Public License Version 2 only ("GPL") or the Common Development
 and Distribution License("CDDL") (collectively, the "License").  You
 may not use this file except in compliance with the License. You can obtain
 a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
 or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
 language governing permissions and limitations under the License.
 
 When distributing the software, include this License Header Notice in each
 file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
 Sun designates this particular file as subject to the "Classpath" exception
 as provided by Sun in the GPL Version 2 section of the License file that
 accompanied this code.  If applicable, add the following below the License
 Header, with the fields enclosed by brackets [] replaced by your own
 identifying information: "Portions Copyrighted [year]
 [name of copyright owner]"
 
 Contributor(s):
 
 If you wish your version of this file to be governed by only the CDDL or
 only the GPL Version 2, indicate your decision by adding "[Contributor]
 elects to include this software in this distribution under the [CDDL or GPL
 Version 2] license."  If you don't indicate a single choice of license, a
 recipient has the option to distribute your version of this file under
 either the CDDL, the GPL Version 2 or to extend the choice of license to
 its licensees as provided above.  However, if you add GPL Version 2 code
 and therefore, elected the GPL Version 2 license, then the option applies
 only if the new code is made subject to such option by the copyright
 holder.
-->
<!DOCTYPE project [
  <!ENTITY commonBuild SYSTEM "../bootstrap/ant-common.xml">
]>

<project name="TopLink Essentials" default="all" basedir=".">  

<!-- ========== Initialize Properties =================================== -->

    <!--
        component.name: required property.  the value should be the
                        name of the component directory
    -->
    <property name="component.name" value="toplink-persistence"/>

    <property file="./build.properties"/>

	<property file="${user.home}/build.properties"/>
    <property file="${basedir}/../bootstrap/project.properties"/>

    <property name="query.antlr.dir"
              location="src/java/oracle/toplink/essentials/internal/parsing/ejbql/antlr273"/>

    <property name="platform.mapping.file"
              value="oracle/toplink/essentials/internal/helper/VendorNameToPlatformMapping.properties"/>

    <property name="metainf.services.dir" value="META-INF/services"/>

    &commonBuild;

    <!-- versioning -->
    <!-- ${build_id} will be given by the build system. Manual build is SNAPSHOT. --> 
    <tstamp>
       <format property="build_date" pattern="MM/dd/yyyy"/>
    </tstamp>
    <condition property="build_number" value="${build_id}">
        <not>
            <or>
                <equals arg1="${build_id}" arg2="" trim="true"/>
                <equals arg1="${build_id}" arg2="local" trim="true"/>
            </or>
        </not>
    </condition>
    <property name="build_number" value="SNAPSHOT"/>
    <property name="build_number_string" value="${build_number} (${build_date})"/>
    <property name="full_version" value="${release.version}-${build_number}"/>
    <property name="full_version_string" value="${full_version} (${build_date})"/>

    <!-- all -->
    <target name="all" depends="compile, assemble"
            description="Build entire component">
    </target>

    <!-- build -->
    <target name="build" depends="compile, assemble"
            description="Build entire component">
    </target>

    <!-- dist -->
    <target name="dist" depends="init, package, package-src" 
            description="Build and make distribution bundles">
    </target>

    <!-- init. Initialization involves creating publishing directories and
         OS specific targets. --> 
    <target name="init" description="${component.name} initialization">
        <tstamp>
            <format property="start.time" pattern="MM/dd/yyyy hh:mm aa"/>
        </tstamp>    
        <echo message="Building component ${component.name}"/>
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${component.classes.dir}"/>
        <mkdir dir="${release.dir}"/>
    </target>

    <!-- compile --> 
    <target name="compile" depends="init, antlr-generate"
            description="Compile TopLink Essentials sources">  
        <copy file="${src.dir}/oracle/toplink/essentials/Version.java" 
              tofile="${component.classes.dir}/oracle/toplink/essentials/Version.java"/>
        <replace file="${component.classes.dir}/oracle/toplink/essentials/Version.java">
            <replacefilter token="@VERSION@" value="${release.version}"/>
            <replacefilter token="@BUILD_NUMBER@" value="${build_number_string}"/>
        </replace>
        <javac srcdir="${component.classes.dir}" 
               destdir="${component.classes.dir}"
               includes="oracle/toplink/essentials/Version.java"
               debug="${javac.debug}" 
               optimize="${javac.optimize}"
               source="${javac.source}" 
               deprecation="${javac.deprecation}"
               failonerror="true">
        </javac>
        <javac srcdir="${src.dir}" 
               destdir="${component.classes.dir}"
               includes="oracle/toplink/essentials/**"
               excludes="oracle/toplink/essentials/Version.java"
               debug="${javac.debug}" 
               optimize="${javac.optimize}"
               source="${javac.source}" 
               deprecation="${javac.deprecation}"
               failonerror="true">
            <classpath>
                <pathelement location="${javaee.jar}"/>
            </classpath>
        </javac>
        <delete file="${component.classes.dir}/oracle/toplink/essentials/Version.java"/>
        <copy file="${src.dir}/${platform.mapping.file}" 
              tofile="${component.classes.dir}/${platform.mapping.file}"/>
        <mkdir dir="${component.classes.dir}/${metainf.services.dir}"/>
        <copy file="./resources/${metainf.services.dir}/javax.persistence.spi.PersistenceProvider"
              todir="${component.classes.dir}/${metainf.services.dir}"/>
    </target>
    
    <!-- compile --> 
    <target name="compile.persistence.antlr" depends="init"
            description="Compile TopLink Essentials sources">  
     
        <javac srcdir="${src.dir}" 
               destdir="${component.classes.dir}"
               debug="${javac.debug}" 
               optimize="${javac.optimize}"
               source="${javac.source}" 
               deprecation="${javac.deprecation}"
               failonerror="true">
            <include name="persistence/antlr/**"/>          
        </javac>
    </target>

    <!-- assemble -->
    <target name="assemble" depends="init, package"
            description="Create TopLink Essentials jar files">

        <!-- Update GlassFish images -->
        <copy file="${release.toplink-essentials.jar}" tofile="${entity-persistence.jar}"/>
        <copy file="${release.toplink-essentials-agent.jar}" tofile="${entity-persistence-agent.jar}"/>
    </target>

    <target name="copy-persistence-api" depends="init">
        <unjar src="${javaee.jar}" dest="${component.classes.dir}" overwrite="true">
            <patternset>
                <include name="javax/persistence/**/*.class"/>
            </patternset>
        </unjar>

        <copy todir="${component.classes.dir}">
            <fileset dir="${glassfish.schemas.home}">
                <include name="orm*.xsd"/>
                <include name="persistence*.xsd"/>
            </fileset>
        </copy>
    </target>

    <target name="clean" depends="antlr-clean" description="Clean the build">
        <delete includeEmptyDirs="true" failonerror="false">
            <fileset dir="${component.classes.dir}"/>
            <fileset dir="${release.dir}"/>
            <fileset dir="${build.dir}"/>
        </delete>
    </target>

  
    <!-- javadocs -->
    <target name="docs" depends="init">
        <mkdir dir="${release.javadocs.dir}"/>
<!-- TODO - create javadoc target -->
    </target>

    <!-- Run ANTLR. -->
    <target name="antlr-generate" depends="compile.persistence.antlr">
	    <java classname="persistence.antlr.Tool" fork="true" dir="${query.antlr.dir}">
         <arg value="EJBQLParser.g"/>
         <classpath>
           <pathelement location="${component.classes.dir}"/>
         </classpath>
       </java>
    </target>

    <!-- Delete the files generated by ANTLR. -->
    <target name="antlr-clean">
        <delete>
            <fileset dir="${query.antlr.dir}">
                <!-- antlr-generated sources -->
                <include name="EJBQLLexer.java"/>
                <include name="EJBQLParser.java"/>
                <include name="*TokenTypes.java"/>
                <include name="*TokenTypes.txt"/>
            </fileset>
        </delete>
    </target>

    <!-- prepare manifest files for jars -->
    <target name="cook-manifest" depends="init"
            description="Generate MANIFEST.MF files">
        <mkdir dir="${build.dir}/manifest"/>
        <copy todir="${build.dir}/manifest">
            <fileset dir="." includes="*.mf" />
            <filterset>
                <filter token="VERSION" value="${full_version_string}"/>
            </filterset>
        </copy>
    </target>

    <!-- Assemble toplink-essentials.jar without updating glassfish/image/lib/ -->
    <target name="package" depends="init, compile, cook-manifest, copy-persistence-api" 
            description="Package binary bundle">
      <copy file="${glassfish.maven}/legal/CDDLv1.0.txt" tofile="${release.dir}/META-INF/LICENSE.txt"/>
      <copy file="${glassfish.maven}/legal/3RD-PARTY-LICENSE-persistence.txt" tofile="${release.dir}/META-INF/3RD-PARTY-LICENSE.txt"/>

      <jar jarfile="${release.toplink-essentials.jar}"
              manifest="${build.dir}/manifest/toplink-essentials.mf">
             <metainf dir="${release.dir}/META-INF" includes="LICENSE.txt"/>
             <metainf dir="${release.dir}/META-INF" includes="3RD-PARTY-LICENSE.txt"/>
             <fileset dir="${component.classes.dir}">
                <include name="oracle/toplink/essentials/**/*.class"/>
                <include name="oracle/toplink/libraries/**/*.class"/>
                <include name="persistence/antlr/**/*.class"/>
                <include name="javax/persistence/**/*.class"/>
                <include name="orm*.xsd"/>
                <include name="persistence*.xsd"/>
            </fileset>
            <fileset dir="${component.classes.dir}">
                <include name="${platform.mapping.file}"/>
            </fileset>
            <fileset dir="${component.classes.dir}">
                <include name="${metainf.services.dir}/javax.persistence.spi.PersistenceProvider"/>
            </fileset>
      </jar>

      <!-- The agent jar is deprecated, but is generated for existing users. 
           ${entity-persistence.jar} now has the agent facility. --> 
      <jar jarfile="${release.toplink-essentials-agent.jar}"
              manifest="${build.dir}/manifest/toplink-essentials-agent.mf">
             <metainf dir="${release.dir}/META-INF" includes="LICENSE.txt"/>
             <metainf dir="${release.dir}/META-INF" includes="3RD-PARTY-LICENSE.txt"/>
             <fileset dir="${component.classes.dir}">
                <include name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.class"/>
            </fileset>
      </jar>

    </target>

    <target name="package-src" depends="init" description="Package source bundle">
        <zip file="${release.toplink-essentials.src.zip}">
            <fileset dir="${src.dir}">
                <include name="oracle/toplink/essentials/**/*.java"/>
                <include name="oracle/toplink/libraries/**/*.java"/>
                <include name="persistence/antlr/**/*.java"/>
            </fileset>
            <fileset dir="${basedir}/../persistence-api/src/java">
                <include name="javax/persistence/**/*.java"/>
            </fileset>
            <fileset dir="${basedir}/../persistence-api/schemas">
                <include name="orm*.xsd"/>
                <include name="persistence*.xsd"/>
            </fileset>
        </zip>

        <zip file="${release.toplink-essentials-agent.src.zip}">
            <fileset dir="${src.dir}">
                <include name="oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializerAgent.java"/>
            </fileset>
        </zip>
    </target>

    <target name="push-to-maven-prepare" depends="-push-to-maven-init, dist"
        description="creates an image for the 'push-to-maven' goal">
        <delete dir="build/maven-repo" /><!-- clean it -->
        <maven-repository-importer destdir="build/maven-repo" version="${full_version}">
            <artifact jar="${release.toplink-essentials.jar}" pom="toplink-essentials.pom" srczip="${release.toplink-essentials.src.zip}" />
            <artifact jar="${release.toplink-essentials-agent.jar}" pom="toplink-essentials-agent.pom" srczip="${release.toplink-essentials-agent.src.zip}" />
        </maven-repository-importer>
    </target>

    <target name="push-to-maven" depends="push-to-maven-prepare"
        description="pushes jars to the java.net maven repository">
        <cvs-import src="build/maven-repo" dest="glassfish/repo" />
    </target>

</project>
 
 
Close
loading
Please Confirm
Close