Skip to main content

Source code file content

Revision: 57041

Fix copyright
» Project Revision History

» Checkout URL

svn / tags / source-build-3.1.2 / scripts / eclipselink.xml

Size: 14000 bytes, 1 line
<?xml version="1.0" encoding="iso-8859-1"?>

<project name="build-from-source" basedir=".." default="build">

    <!-- import build.xml for init target and inherited properties -->
    <import file="${basedir}/build.xml"/>
    
    <property name="osgi.cmpn.jar.name" value="osgi.cmpn_4.1.0.jar"/>
    <property name="osgi.core.jar.name" value="osgi.core.zip"/>

    <property name="eclipselink.dir" value ="${glassfish.external.dir}/eclipselink"/>
    <property name="eclipselink.plugins.dir" value ="${eclipselink.dir}/plugins"/>

    <property file="${eclipselink.dir}/build.properties"/>
    <property name="javax.jms.jar.name" value = "${jms.jar}"/>
    <property name="javax.resource.jar.name" value="${resource.jar}"/>
    <property name="javax.mail.jar.name" value="${mail.jar}"/>
    <property name="javax.transaction.jar.name" value="${transaction.jar}"/>

    <property name="implementation.vendor" value="Glassfish Project"/>
    <property name="version.qualifier" value="${eclipselink.version.qualifier}"/>
    <property name="version.string" value="${release.version}.${version.qualifier}"/>

    <target name="checkout" depends="init,check.svn" unless="skipCheckout">
        <svn.checkout repo="${eclipselink.svn.url}" dest="eclipselink"/>
    </target>
    
    <target name="build" depends = "build-eclipselink, upload-maven-all"/>

    <macrodef name="eclipselink.dependency">
        <attribute name="groupId" default="org.eclipse.persistence"/>
        <attribute name="artifactId"/>
        <attribute name="version" default="${maven.version}"/>
        <attribute name="type" default="jar"/>
        <attribute name="scope" default="compile"/>
        <attribute name="optional" default="false"/>
        <attribute name="prop"/>
        <sequential>
            <xml.dependency groupId="@{groupId}" artifactId="@{artifactId}"
                version="@{version}" type="@{type}" scope="@{scope}"
                optional="@{optional}" prop="@{prop}"/>
        </sequential>
    </macrodef>

    <target name="init-eclipselink" unless="eclipselinkInitialized">
        <!--
            build.type is used to determine maven version.
            It is expected to be RELEASE for final release
            and name of the milestone for milestone releases

            set build.type to eclipselink.version.qualifier
            if it is  defined in build.properties else to RELEASE
        -->
        <condition property="build.type"
            value="RELEASE" else="${version.qualifier}">
            <length string="${eclipselink.version.qualifier}" trim="true" length="0" />
        </condition>

        <!--
            Set maven.version appropriately depending upon ${build.type}.
            variable should only be used for maven version element in POM.
        -->
        <condition property="maven.version" value="${release.version}-${build.type}">
            <equals arg1="${build.type}" arg2="SNAPSHOT"/>
        </condition>
        <condition property="maven.version" value="${release.version}">
            <equals arg1="${build.type}" arg2="RELEASE"/>
        </condition>
        <property name="maven.version" value="${release.version}-${build.type}"/>

        <tstamp>
            <format property="build.date" pattern="yyyyMMdd"/>
            <format property="build.time" pattern="HHmm"/>
        </tstamp>

        <echo message="release.version: ${release.version}"/>
        <echo message="build.date:      ${build.date}"/>
        <echo message="build.type:      ${build.type}"/>
        <echo message="maven.version:   ${maven.version}"/>

        <!--
            These use above, in order,
            to define a single library for an artifact dependency
        -->
        <eclipselink.dependency prop="dep.antlr"
            artifactId="org.eclipse.persistence.antlr" />
        <eclipselink.dependency prop="dep.asm"
            artifactId="org.eclipse.persistence.asm" />
        <eclipselink.dependency prop="dep.core"
            artifactId="org.eclipse.persistence.core" />
        <eclipselink.dependency prop="dep.oracle"
            artifactId="org.eclipse.persistence.oracle" />
        <eclipselink.dependency prop="dep.jpa"
            artifactId="org.eclipse.persistence.jpa" />
        <eclipselink.dependency prop="dep.jpa.modelgen"
            artifactId="org.eclipse.persistence.jpa.modelgen" />
        <eclipselink.dependency prop="dep.jpa.processor"
            artifactId="org.eclipse.persistence.jpa.modelgen.processor" scope="runtime" />
        <eclipselink.dependency prop="dep.persistence2"
            artifactId="javax.persistence" version="2.0.0.v200911271158"/>

        <!--
            * JPA does have a dependency upon javax.persistence, but it is left
            unstated because while 2.0 functionality depends upon
            javax.persistence_2.0.0 jpa 1.0 functionality can run with just
            javax.persistence_1.0

            * The modelgen processor is a jar containing a single data resource
            used by the compiler to establish a canonical modelgen processor
            during compilation. It has no real dependencies, nor is anything
            really dependant upon it, but it is needed for this compiler
            functionality to work. (think of it as a compiler add-on).
            It will need to be downloaded independently for this
            feature (modelgen) to work.
        -->
        <xml.elt name="dependencies" prop="core.dependencies"
            value="${dep.asm}${dep.antlr}" />
        <xml.elt name="dependencies" prop="oracle.dependencies"
            value="${dep.asm}${dep.core}" />
        <xml.elt name="dependencies" prop="jpa.dependencies"
            value="${dep.asm}${dep.core}" />
        <xml.elt name="dependencies" prop="modelgen.dependencies"
            value="${dep.core}${dep.jpa}${dep.jpa.processor}" />

        <property name="eclipselinkInitialized" value="true"/>
    </target>
	
    <target name="build-eclipselink" depends="init-eclipselink">
        <!--
            ** Delete sources not used by GFv3 **
            They are checked into source build repo just in case they are needed later on
        -->
        <delete dir="${eclipselink.dir}/dbws"/>
        <delete dir="${eclipselink.dir}/documentation"/>
        <delete dir="${eclipselink.dir}/project-admin"/>
        <delete dir="${eclipselink.dir}/examples"/>
        <delete dir="${eclipselink.dir}/moxy"/>
        <delete dir="${eclipselink.dir}/sdo"/>
        <delete dir="${eclipselink.dir}/utils"/>

        <!--**- Delete binaries not used by GFv3 **-->
        <delete includeemptydirs = "true">
            <fileset dir="${eclipselink.plugins.dir}"
                excludes="org.eclipse.persistence.antlr/**/*, org.eclipse.persistence.asm/**/*"/>
        </delete>

	<!--
            ** Copy binaries built from source build to EclipseLink workspace to compile against **

            It would have been nice to pass reference to these binaries to EclipseLink.
            Unfortunately EclipseLink build scripts have the names hard coded
	    for example see eclipselink/build.properties#eclipselink.core.depend
        -->
	<copy file="${maven.repo.local}/${jms-api.mvn.path}"
                tofile="${eclipselink.plugins.dir}/${javax.jms.jar.name}" />
	<copy file="${maven.repo.local}/${mail.mvn.path}"
                tofile="${eclipselink.plugins.dir}/${javax.mail.jar.name}" />
	<copy file="${maven.repo.local}/${connector-api.mvn.path}"
                tofile="${eclipselink.plugins.dir}/${javax.resource.jar.name}" />
	<copy file="${maven.repo.local}/${transaction-api.mvn.path}"
                tofile="${eclipselink.plugins.dir}/${javax.transaction.jar.name}" />
	<copy file="${maven.repo.local}/${felix.mvn.path}"
                tofile="${eclipselink.plugins.dir}/${osgi.core.jar.name}" />
	<copy file="${maven.repo.local}/${osgi-cmpn.mvn.path}"
                tofile="${eclipselink.plugins.dir}/${osgi.cmpn.jar.name}" />

<!--
        <mvn.get repourl="${bnd.repository}"
            artifact="${bnd.groupid}:${bnd.artifactid}:${bnd.version}" />
            
        <property name="bndtool.lib" value="${maven.repo.local}/${bnd.mvn.path}"/>
-->
        <!--
            ** Disabling bnd, it's not working for org.eclipse.persistence.asm
               because of the version in the MANIFEST.
        -->
        <property name="nobnd" value="true"/>

        <ant dir="${eclipselink.dir}/${jpa.prototype}" target="build"/>
        <ant dir="${eclipselink.dir}/${eclipselink.asm}" target="build"/>
        <ant dir="${eclipselink.dir}/${eclipselink.antlr}" target="build"/>
        <ant dir="${eclipselink.dir}/${eclipselink.core}" target="build"/>
        <ant dir="${eclipselink.dir}/${eclipselink.extension.oracle}" target="repackage"/>
        <ant dir="${eclipselink.dir}/${eclipselink.jpa}" target="build"/>
        <ant dir="${eclipselink.dir}/${eclipselink.modelgen}" target="build"/>
    </target>

    <!-- Uploads a single artifact & source to maven repository -->
    <macrodef name="eclipselink.upload-artifact">
        <attribute name="groupId" default="org.eclipse.persistence"/>
        <attribute name="artifactId"/>
        <attribute name="artifactVersion" default="${maven.version}"/>
        <attribute name="jar"/>
        <attribute name="artifactSrc"/>
        <attribute name="artifactName"/>
        <attribute name="dependencies" default=""/>
        <sequential>
            <!-- Copy pom.template to pom.xml filtering various properties -->
            <copy file="${eclipselink.dir}/pom.xml.template" 
                  tofile="${basedir}/pom.xml" overwrite="true">
              <filterset>
                <filter token="groupId"      value="@{groupId}"/>
                <filter token="version"      value="@{artifactVersion}"/>
                <filter token="svn.revision" value="${svn.revision}"/>
                <filter token="artifactId"   value="@{artifactId}"/>
                <filter token="artifactName" value="@{artifactName}"/>
                <filter token="dependencies" value="@{dependencies}"/>
               </filterset>
            </copy>

            <!-- deploy jar artifact -->
            <mvn.publish.local.pom
                file="${eclipselink.dir}/@{jar}"
                pom="${basedir}/pom.xml"/>

            <!-- deploy source artifact -->
            <mvn.publish.local.pom
                file="${eclipselink.dir}/@{artifactSrc}"
                pom="${basedir}/pom.xml"
                classifier="sources"/>
                
            <!-- cleanup -->
            <delete file="${basedir}/pom.xml"/>
        </sequential>
    </macrodef>

    <target name = "upload-maven-all" depends="init-eclipselink">
        <!-- build persistence20.source.jar property -->
        <stringReplaceRegexp result="persistence20.source.jar"
            str="${persistence20.jar}"
            match="javax.persistence_(.*).v(.*).jar"
            replace="javax.persistence.source_\1.v\2.jar" />

        <!-- build persistence20.version property -->
        <stringReplaceRegexp result="persistence20.version"
            str="${persistence20.jar}"
            match="javax.persistence_(.*).v(.*).jar"
            replace="\1" />

        <!-- call upload for each artifact we want to upload -->
        <eclipselink.upload-artifact
            artifactId="javax.persistence"
            artifactVersion="${persistence20.version}"
            jar="${eclipselink.jpa.base}/${plugins.dir}/${persistence20.jar}"
            artifactSrc="${eclipselink.jpa.base}/${plugins.dir}/${persistence20.source.jar}"
            artifactName="Javax Persistence API 2.0" />
        <eclipselink.upload-artifact
            artifactId="org.eclipse.persistence.antlr"
            jar="${eclipselink.plugins}/${eclipselink.antlr.bndl.prefix}_${version.string}.jar"
            artifactSrc="${eclipselink.plugins}/${eclipselink.antlr.bndl.prefix}.source_${version.string}.jar"
            artifactName="EclipseLink ANTLR" />
        <eclipselink.upload-artifact
            artifactId="org.eclipse.persistence.asm"
            jar="${eclipselink.plugins}/${eclipselink.asm.bndl.prefix}_${version.string}.jar"
            artifactSrc="${eclipselink.plugins}/${eclipselink.asm.bndl.prefix}.source_${version.string}.jar"
            artifactName="EclipseLink ASM" />
        <eclipselink.upload-artifact
            artifactId="org.eclipse.persistence.core"
            jar="${eclipselink.plugins}/${eclipselink.core.bndl.prefix}_${version.string}.jar"
            artifactSrc="${eclipselink.plugins}/${eclipselink.core.bndl.prefix}.source_${version.string}.jar"
            artifactName="EclipseLink Core"
            dependencies="${core.dependencies}" />
        <eclipselink.upload-artifact
            artifactId="org.eclipse.persistence.oracle"
            jar="${eclipselink.plugins}/${eclipselink.oracle.bndl.prefix}_${version.string}.jar"
            artifactSrc="${eclipselink.plugins}/${eclipselink.oracle.bndl.prefix}.source_${version.string}.jar"
            artifactName="EclipseLink Oracle Extensions"
            dependencies="${oracle.dependencies}" />
        <eclipselink.upload-artifact
            artifactId="org.eclipse.persistence.jpa"
            jar="${eclipselink.plugins}/${eclipselink.jpa.bndl.prefix}_${version.string}.jar"
            artifactSrc="${eclipselink.plugins}/${eclipselink.jpa.bndl.prefix}.source_${version.string}.jar"
            artifactName="EclipseLink JPA"
            dependencies="${jpa.dependencies}" />
        <eclipselink.upload-artifact
            artifactId="org.eclipse.persistence.jpa.modelgen"
            jar="${eclipselink.plugins}/${eclipselink.modelgen.bndl.prefix}_${version.string}.jar"
            artifactSrc="${eclipselink.plugins}/${eclipselink.modelgen.bndl.prefix}.source_${version.string}.jar"
            artifactName="EclipseLink JPA Modelgen (non-OSGi)"
            dependencies="${modelgen.dependencies}"/>
    </target>

</project>

 
 
Close
loading
Please Confirm
Close