| <?xml version="1.0"?> |
| <!--/******************************************************************************* |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 |
| * which accompanies this distribution. |
| * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html |
| * and the Eclipse Distribution License is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * Ant naming conventions: |
| * - regardless of the actual OS platform,'/' is the directory separator |
| * (Ant will convert as appropriate). |
| * - multi-word properties use periods '.' |
| * - properties ending in .jar define jarfile names only (no path) |
| * - properties ending in .lib are fully qualified jars (path and filename) |
| * - properties ending in .dir are directory paths |
| * - properties ending in .path are path refid names (classpath fragments) |
| * - multi-word targets use hyphens '-' |
| * - targets beginning with test- are reserved for high level test targets, |
| * and are used in test results parsing |
| * - targets typically use the form <action>-<object>-<type> (ie. package-bundle-zip) |
| * - multi-word macros use underscores '_' |
| * - multi-word macro attributes are concatinated |
| * e.g. 'runpathref' |
| * - multi-word tasks (taskdef) names are concatinated |
| * e.g. 'validateconnection' |
| * - OS environment variables are in ALLCAPS and have 'env' as a prefix |
| * e.g. ${env.XXX}. |
| * - Ant properties are lower case. |
| * |
| * Contributors: |
| * egwin - initial API and implementation |
| #******************************************************************************/--> |
| <project name="javax.persistence" default="build" basedir="."> |
| <available file="../${ant.project.name}" type="dir" property="jpaproto.is.local"/> |
| <!-- Test to make sure that the calling script doesn't inherit the variable --> |
| <!-- (should be set locally, and be destroyed upon return) --> |
| <fail message="Not running from '${ant.project.name}' directory" unless="jpaproto.is.local"/> |
| |
| <dirname property="jpaproto.build.location" file="${ant.file.javax.persistence}"/> |
| <condition property="jpaproto.2.base.dir" value="../../.." else=".."> |
| <contains string="${jpaproto.build.location}" substring="jpa"/> |
| </condition> |
| <property name="jpaproto.2.common.plugins.dir" value="${jpaproto.2.base.dir}/plugins"/> |
| <property name="jpaproto.2.buildsys.dir" value="${jpaproto.2.base.dir}/buildsystem"/> |
| |
| <!-- Properties usually defined in build.properties, set here to avoid easy redefinition. --> |
| <!-- Persistence Version properties --> |
| <tstamp> |
| <format property="jpaproto.build.date" pattern="yyyyMMdd"/> |
| <format property="jpaproto.build.time" pattern="HHmm"/> |
| </tstamp> |
| <property name="jpaproto.qualifier" value="v${jpaproto.build.date}${jpaproto.build.time}"/> |
| <property name="jpaproto.spec.vendor" value="Sun Microsystems Inc."/> |
| <property name="implementation.vendor" value="Eclipse.org - EclipseLink Project"/> |
| <property name="jpaproto.spec.version" value="2.0"/> |
| <property name="jpaproto.version" value="2.0.0"/> |
| <property name="jpaproto.bundle.name" value="Java Persistence API 2.0"/> |
| <!-- Project infrastructure properties --> |
| <property name="src.dir" value="src"/> |
| <property name="package.dir" value=".."/> |
| <property name="classes.dir" value="classes"/> |
| <property name="jpaproto.resource.dir" value="META-INF"/> |
| <property name="jpaproto.jar" value="${ant.project.name}_${jpaproto.version}.${jpaproto.qualifier}.jar"/> |
| <property name="jpaproto.src.jar" value="${ant.project.name}.source_${jpaproto.version}.${jpaproto.qualifier}.jar"/> |
| |
| <echo message="Loading ${user.home}/build.properties..."/> |
| <property file="${user.home}/build.properties"/> |
| |
| <!-- Defaults, set var in ${user.home}/build.properties if different version required --> |
| <property name="bndtool.jar" value="bnd-0.0.366.jar"/> |
| |
| <!-- Primary Targets --> |
| <target name="build" depends="clean, compile, jar" description="build ${ant.project.name}_${jpaproto.version} component"/> |
| <target name="jar" depends="generate-manifest, package, bnd-package" description="package ${ant.project.name}_${jpaproto.version} component"/> |
| |
| <!-- clean --> |
| <target name="clean" description="Clean all generated content"> |
| <delete dir="${classes.dir}" includeEmptyDirs="true" failonerror="false" quiet="true"/> |
| <!-- Remove Build artifacts, and potential "confict" files from check-out --> |
| <delete failonerror="false" quiet="true"> |
| <fileset dir="${package.dir}" includes="${jpaproto.jar}*"/> |
| </delete> |
| <delete failonerror="false" quiet="true"> |
| <fileset dir="${package.dir}" includes="${jpaproto.src.jar}*"/> |
| </delete> |
| </target> |
| |
| <!-- initialize varables and paths needed for compile --> |
| <!-- the number of properties needed now is too great for lazy loading without a target --> |
| <target name="init"> |
| <!-- This HAS to be defined after allowing user redefinitions (which will cause the condition not to set anything) --> |
| <!-- This tests to make sure the extensions dir exists, if not sets to a existant dummy location --> |
| <condition property="extensions.depend.dir" value="${jpaproto.2.base.dir}/../extension.lib.external" |
| else="${jpaproto.build.location}"> |
| <available file="${jpaproto.2.base.dir}/../extension.lib.external" type="dir"/> |
| </condition> |
| <echo message="extensions.depend.dir = '${extensions.depend.dir}'"/> |
| |
| <!-- Compiler flag properties --> |
| <property name="javac.debug" value="true"/> |
| <property name="javac.optimize" value="off"/> |
| <property name="javac.deprecation" value="off"/> |
| <property name="javac.version" value="1.5"/> |
| |
| <!-- Check for BND library --> |
| <condition property="bnd.lib" value="${extensions.depend.dir}/${bndtool.jar}"> |
| <available file="${extensions.depend.dir}/${bndtool.jar}"/> |
| </condition> |
| <condition property="bnd.lib" value="${jpaproto.2.buildsys.dir}/${bndtool.jar}"> |
| <available file="${jpaproto.2.buildsys.dir}/${bndtool.jar}"/> |
| </condition> |
| <echo message="bnd.lib = '${bnd.lib}'"/> |
| |
| <!-- Set Compile Path--> |
| <path id="jpaproto.compile.path"> |
| <pathelement path="${jpaproto.2.common.plugins.dir}/osgi.core.zip"/> |
| <pathelement path="${jpaproto.2.common.plugins.dir}/osgi.cmpn_4.1.0.jar"/> |
| </path> |
| </target> |
| |
| <!-- compile --> |
| <target name="compile" depends="init" description="Compile bundle code"> |
| <mkdir dir="${classes.dir}"/> |
| <javac srcdir="${src.dir}" |
| destdir="${classes.dir}" |
| includes="**" |
| debug="${javac.debug}" |
| debuglevel="${javac.debuglevel}" |
| optimize="${javac.optimize}" |
| source="${javac.version}" |
| target="${javac.version}" |
| deprecation="${javac.deprecation}" |
| failonerror="true" |
| memoryMaximumSize="512m" |
| fork="true"> |
| <classpath> |
| <path refid="jpaproto.compile.path"/> |
| </classpath> |
| </javac> |
| </target> |
| |
| <!-- package --> |
| <target name="package" unless="bnd.lib" depends="init" description="jar OSGI bundle"> |
| <jar jarfile="${package.dir}/${jpaproto.jar}" duplicate="preserve" manifest="${classes.dir}/MANIFEST.MF"> |
| <fileset dir="${jpaproto.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <fileset dir="." |
| includes="readme.txt" |
| /> |
| <fileset dir="${src.dir}" |
| includes="**/*.xsd" |
| /> |
| <fileset dir="${classes.dir}" |
| includes="**/*.class" |
| /> |
| </jar> |
| <jar jarfile="${package.dir}/${jpaproto.src.jar}" duplicate="preserve"> |
| <manifest> |
| <attribute name="Specification-Vendor" value="${jpaproto.spec.vendor}"/> |
| <attribute name="Specification-Version" value="${jpaproto.spec.version}"/> |
| <attribute name="Implementation-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Implementation-Version" value="${jpaproto.version}"/> |
| <attribute name="Bundle-ManifestVersion" value="2"/> |
| <attribute name="Bundle-Name" value="${jpaproto.bundle.name} Source"/> |
| <attribute name="Bundle-SymbolicName" value="${ant.project.name}.source"/> |
| <attribute name="Bundle-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Bundle-Version" value="${jpaproto.version}.${jpaproto.qualifier}"/> |
| <attribute name="Eclipse-SourceBundle" value="${ant.project.name};version="${jpaproto.version}.${jpaproto.qualifier}""/> |
| </manifest> |
| <fileset dir="${jpaproto.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <fileset dir="." |
| includes="readme.txt" |
| /> |
| <fileset dir="${src.dir}" |
| includes="**" |
| /> |
| </jar> |
| </target> |
| |
| <target name="generate-manifest" unless="bnd.lib" depends="init" description="Generate the OSGi bundle manifest before jarring"> |
| <echo message="Generate the OSGi bundle manifest before jarring..."/> |
| <delete file="${classes.dir}/MANIFEST.MF*" quiet="true"/> |
| <echo message="Manifest-Version: 1.0${line.separator}" file="${classes.dir}/MANIFEST.MF" append="false"/> |
| <echo message="Specification-Vendor: ${jpaproto.spec.vendor}${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Specification-Version: ${jpaproto.spec.version}${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Implementation-Vendor: ${implementation.vendor}${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Implementation-Version: ${jpaproto.version}${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Bundle-ManifestVersion: 2${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Bundle-Name: ${jpaproto.bundle.name}${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Bundle-SymbolicName: ${ant.project.name}${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Bundle-Vendor: ${implementation.vendor}${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Bundle-Version: ${jpaproto.version}.${jpaproto.qualifier}${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Bundle-RequiredExecutionEnvironment: J2SE-1.5${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Export-Package: javax.persistence;version="${jpaproto.version}.${jpaproto.qualifier}",${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message=" javax.persistence.criteria;version="${jpaproto.version}.${jpaproto.qualifier}",${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message=" javax.persistence.metamodel;version="${jpaproto.version}.${jpaproto.qualifier}",${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message=" javax.persistence.spi;version="${jpaproto.version}.${jpaproto.qualifier}"${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Bundle-Activator: org.eclipse.persistence.javax.persistence.osgi.Activator${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Bundle-ClassPath: .${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message="Import-Package: org.osgi.framework;resolution:=optional,${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| <echo message=" org.osgi.util.tracker;resolution:=optional${line.separator}" file="${classes.dir}/MANIFEST.MF" append="true"/> |
| </target> |
| |
| <target name="bnd-package" if="bnd.lib" depends="init" > |
| <taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${bnd.lib}"/> |
| <bnd |
| classpath="${classes.dir}" |
| eclipse="false" |
| sourcepath="${src.dir}" |
| failok="false" |
| exceptions="true" |
| files="./javax.persistence.bnd" |
| output="${package.dir}/${jpaproto.jar}"/> |
| <jar jarfile="${package.dir}/${jpaproto.src.jar}" duplicate="preserve"> |
| <manifest> |
| <attribute name="Specification-Vendor" value="${jpaproto.spec.vendor}"/> |
| <attribute name="Specification-Version" value="${jpaproto.spec.version}"/> |
| <attribute name="Implementation-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Implementation-Version" value="${jpaproto.version}"/> |
| <attribute name="Bundle-ManifestVersion" value="2"/> |
| <attribute name="Bundle-Name" value="${jpaproto.bundle.name} Source"/> |
| <attribute name="Bundle-SymbolicName" value="${ant.project.name}.source"/> |
| <attribute name="Bundle-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Bundle-Version" value="${jpaproto.version}.${jpaproto.qualifier}"/> |
| <attribute name="Eclipse-SourceBundle" value="${ant.project.name};version="${jpaproto.version}.${jpaproto.qualifier}""/> |
| </manifest> |
| <fileset dir="${jpaproto.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <fileset dir="." |
| includes="readme.txt" |
| /> |
| <fileset dir="${src.dir}" |
| includes="**" |
| /> |
| </jar> |
| </target> |
| </project> |