| <!--/******************************************************************************* |
| * 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: |
| * tware - initial API and implementation |
| * egwin - update to adopt calling standards |
| #******************************************************************************/--> |
| <!-- This ant project includes the following tasks: |
| - build (default) : cleans, compiles, and packages all tests |
| - clean : cleans up all generated files and dirs |
| - compile : compiles all classes |
| - package : packages the oracle extensions OSGi bundle jar. |
| --> |
| <project name="org.eclipse.persistence.oracle" default="build" basedir="."> |
| <available file="../${ant.project.name}" type="dir" property="oracle.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="oracle.is.local"/> |
| |
| <dirname property="oracle.build.location_temp" file="${ant.file.org.eclipse.persistence.oracle}"/> |
| <pathconvert targetos="unix" property="oracle.build.location"> |
| <path> |
| <pathelement location="${oracle.build.location_temp}"/> |
| </path> |
| </pathconvert> |
| <condition property="oracle.2.base.dir" value="../.." else=".."> |
| <contains string="${oracle.build.location}" substring="foundation"/> |
| </condition> |
| <property name="oracle.2.common.plugins.dir" value="${oracle.2.base.dir}/plugins"/> |
| <property name="oracle.2.foundation.plugins.dir" value="../plugins"/> |
| <condition property="oracle.2.jpa.plugins.dir" value="${oracle.2.base.dir}/jpa/plugins" else="../plugins"> |
| <available file="${oracle.2.base.dir}/jpa/plugins" type="dir"/> |
| </condition> |
| <property name="oracle.2.buildsys.dir" value="${oracle.2.base.dir}/buildsystem"/> |
| |
| <!-- local property overrides --> |
| <condition property="custom.properties.message" value="Loading ${user.home}/build.properties..." |
| else="Custom properties file '${user.home}/build.properties' not found to load."> |
| <available file="${user.home}/build.properties"/> |
| </condition> |
| <echo message="${custom.properties.message}"/> |
| <property file="${user.home}/build.properties"/> |
| <!-- Sets default junit.lib and all extensions.depend dir locations to defaults based upon discovered dir heirarchy --> |
| <!-- Must be defined after ${user.home}/build.properties is included to allow redefinition --> |
| <condition property="oracle.extensions.depend.dir" value="../../../extension.oracle.lib.external" else="../../extension.oracle.lib.external"> |
| <contains string="${oracle.build.location}" substring="foundation"/> |
| </condition> |
| <property file="${oracle.build.location}/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} component"/> |
| <target name="jar" depends="package, repackage" description="package ${ant.project.name} component (** dev use only **)"/> |
| |
| <!-- clean --> |
| <target name="clean" description="Clean all generated content"> |
| <delete includeEmptyDirs="true" failonerror="false"> |
| <fileset dir="${classes.dir}"/> |
| <fileset dir="${oracle.2.common.plugins.dir}" includes="${ant.project.name}_*.jar*, ${ant.project.name}.source_*.jar*"/> |
| <fileset dir="${oracle.2.foundation.plugins.dir}" includes="${ant.project.name}_*.jar.*, ${ant.project.name}.source_*.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"> |
| <!-- versioning --> |
| <!-- These variables are set in autobuild.xml. A manual build gets defaults --> |
| <tstamp> |
| <format property="build.date" pattern="yyyyMMdd"/> |
| <format property="build.time" pattern="HHmm"/> |
| </tstamp> |
| <property name="build.type" value="SNAPSHOT"/> |
| <property name="svn.revision" value="NA"/> |
| <property name="version.qualifier" value="qualifier"/> |
| <property name="version.string" value="${release.version}.${version.qualifier}"/> |
| <property name="release.designation" value="EclipseLink ${release.version} Build"/> |
| <property name="specification.vendor" value="Eclipse.org - EclipseLink Project"/> |
| <property name="implementation.vendor" value="${specification.vendor}"/> |
| |
| <!-- Check for BND library --> |
| <property name="alt.manifest.dir" value="${oracle.build.location}/META-INF"/> |
| <condition property="bnd.lib" value="${extensions.depend.dir}/${bndtool.jar}"> |
| <available file="${extensions.depend.dir}/${bndtool.jar}"/> |
| </condition> |
| <condition property="bnd.lib" value="${oracle.2.buildsys.dir}/${bndtool.jar}"> |
| <available file="${oracle.2.buildsys.dir}/${bndtool.jar}"/> |
| </condition> |
| <echo message="bnd.lib = '${bnd.lib}'"/> |
| <condition property="bld"> |
| <or> |
| <isset property="bnd.lib"/> |
| <isset property="nobnd"/> |
| </or> |
| </condition> |
| </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-compile" depends="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="${oracle.2.base.dir}/../extension.lib.external" |
| else="${oracle.build.location}"> |
| <available file="${oracle.2.base.dir}/../extension.lib.external" type="dir"/> |
| </condition> |
| <echo message="extensions.depend.dir = '${extensions.depend.dir}'"/> |
| <echo message="oracle.extensions.depend.dir = '${oracle.extensions.depend.dir}'"/> |
| |
| <!-- dependency properties --> |
| <!-- Core has no jpa 2.0 specific compile dependency: use below instead to test assertion --> |
| <!-- property name="persistence.lib" value="${oracle.2.common.plugins.dir}/${persistence10.jar}"/ --> |
| <property name="persistence.lib" value="${oracle.2.jpa.plugins.dir}/${persistence20.jar}"/> |
| <property name="core.lib" value="${oracle.2.common.plugins.dir}/org.eclipse.persistence.core_${version.string}.jar"/> |
| |
| <!-- dependency tests --> |
| <available file="${persistence.lib}" property="persistence.bundle.exist"/> |
| <available file="${core.lib}" property="core.bundle.exist"/> |
| <available file="${oracle.extensions.depend.dir}" type="dir" property="oracle.depend.dir.exist"/> |
| |
| <fail message="Cannot find: '${persistence.lib}'" unless="persistence.bundle.exist"/> |
| <fail message="Cannot find: '${core.lib}'" unless="core.bundle.exist"/> |
| <!-- Set Compile Path--> |
| <!-- Need multiple extensions dir includes because different systems are defaulting to different locations --> |
| <path id="oracle.compile.path"> |
| <pathelement path="${core.lib}"/> |
| <pathelement path="${persistence.lib}"/> |
| <fileset |
| dir="${oracle.2.common.plugins.dir}" |
| includes="${eclipselink.core.depend}"/> |
| <fileset |
| dir="${oracle.extensions.depend.dir}" |
| includes="${oracle.extensions.depend.jars}"/> |
| <fileset |
| dir="${extensions.depend.dir}" |
| includes="${oracle.extensions.depend.jars}"/> |
| </path> |
| </target> |
| |
| <!-- initialize varables and paths needed for packaging - needs to be evaluated post-compile --> |
| <target name="init-package" depends="init"> |
| <!-- Test for recent compile --> |
| <available file="${classes.dir}" type="dir" property="classes.dir.exist"/> |
| |
| <!-- Check bnd settings --> |
| <condition property="bnd.bld"> |
| <and> |
| <isset property="bnd.lib"/> |
| <not> <isset property="nobnd"/> </not> |
| </and> |
| </condition> |
| |
| <!-- Check for Oracle compile dependencies --> |
| <condition property="package.ok"> |
| <and> |
| <isset property="oracle.depend.dir.exist"/> |
| <isset property="classes.dir.exist"/> |
| <isset property="nobnd"/> |
| </and> |
| </condition> |
| <condition property="bnd-package.ok"> |
| <and> |
| <isset property="oracle.depend.dir.exist"/> |
| <isset property="classes.dir.exist"/> |
| <isset property="bnd.bld"/> |
| </and> |
| </condition> |
| </target> |
| |
| <target name="fail-on-no-bnd" unless="bld"> |
| <echo message="BND tool (${bndtool.jar}) not found in either:"/> |
| <echo message=" the extensions.depend.dir: '${extensions.depend.dir}'"/> |
| <echo message=" or the buildsystem dir: '${oracle.2.buildsys.dir}'"/> |
| <echo message=""/> |
| <echo message="if you have a different version, you can define a different"/> |
| <echo message="jarname by adding 'bndtool.jar=bnd-{version}.jar to your'"/> |
| <echo message="${user.home}/build.properties file."/> |
| <echo message=""/> |
| <echo message="You can download BND from http://www.aqute.biz/Code/Download"/> |
| <echo message=""/> |
| <echo message="or if you really need to build NOW, you can use '-Dnobnd=true'"/> |
| <echo message="on the ant command-line. However, the manifests used will be those"/> |
| <echo message="checked-in for development, and will likely have errors."/> |
| <fail message="Missing BND library!"/> |
| </target> |
| |
| <!-- compile --> |
| <target name="compile" if="oracle.depend.dir.exist" depends="init-compile, fail-on-no-bnd" description="Compile bundle code"> |
| <mkdir dir="${classes.dir}"/> |
| <javac srcdir="${src.dir}" |
| destdir="${classes.dir}" |
| includes="org/eclipse/persistence/**/*.java" |
| debug="${javac.debug}" |
| debuglevel="${javac.debuglevel}" |
| optimize="${javac.optimize}" |
| source="${javac.version}" |
| target="${javac.version}" |
| deprecation="${javac.deprecation}" |
| failonerror="true" |
| memoryMaximumSize="512m" |
| fork="true" |
| classpathref="oracle.compile.path" |
| /> |
| </target> |
| |
| <!-- package --> |
| <target name="package" if="package.ok" depends="init-package, bnd-package" description="jar OSGI bundle"> |
| <delete file="${oracle.2.foundation.plugins.dir}/${ant.project.name}.jar*" quiet="true" failonerror="false"/> |
| <delete file="${oracle.2.foundation.plugins.dir}/${ant.project.name}.source.jar*" quiet="true" failonerror="false"/> |
| <jar jarfile="${oracle.2.foundation.plugins.dir}/${ant.project.name}.jar" manifest="${alt.manifest.dir}/MANIFEST.MF"> |
| <fileset dir="${oracle.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <fileset dir="${classes.dir}"> |
| <include name="org/eclipse/persistence/**/*.class"/> |
| </fileset> |
| </jar> |
| <jar jarfile="${oracle.2.foundation.plugins.dir}/${ant.project.name}.source.jar"> |
| <manifest> |
| <attribute name="Specification-Vendor" value="${specification.vendor}"/> |
| <attribute name="Specification-Version" value="${release.version}"/> |
| <attribute name="Implementation-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Implementation-Version" value="${version.string}"/> |
| <attribute name="Bundle-ManifestVersion" value="2"/> |
| <attribute name="Bundle-Name" value="EclipseLink Oracle Extensions Source"/> |
| <attribute name="Bundle-SymbolicName" value="${ant.project.name}.source"/> |
| <attribute name="Bundle-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Bundle-Version" value="${version.string}"/> |
| <attribute name="Eclipse-SourceBundle" value="${ant.project.name};version="${version.string}""/> |
| </manifest> |
| <fileset dir="${oracle.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <fileset dir="${src.dir}"> |
| <include name="org/eclipse/persistence/**/*.java"/> |
| </fileset> |
| </jar> |
| </target> |
| |
| <target name="repackage" if="nobnd" depends="init-package, bnd-repackage" description="take existing source and classes from checked in bundles, and repackage with new manifest"> |
| <delete file="${oracle.2.common.plugins.dir}/${ant.project.name}_${version.string}.jar*" quiet="true" failonerror="false"/> |
| <delete file="${oracle.2.common.plugins.dir}/${ant.project.name}.source_${version.string}.jar*" quiet="true" failonerror="false"/> |
| <jar jarfile="${oracle.2.common.plugins.dir}/${ant.project.name}_${version.string}.jar" manifest="${alt.manifest.dir}/MANIFEST.MF" duplicate="preserve"> |
| <fileset dir="${oracle.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <zipgroupfileset dir="${oracle.2.foundation.plugins.dir}"> |
| <include name="${ant.project.name}.jar"/> |
| </zipgroupfileset> |
| </jar> |
| <jar jarfile="${oracle.2.common.plugins.dir}/${ant.project.name}.source_${version.string}.jar" duplicate="preserve"> |
| <manifest> |
| <attribute name="Specification-Vendor" value="${specification.vendor}"/> |
| <attribute name="Specification-Version" value="${release.version}"/> |
| <attribute name="Implementation-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Implementation-Version" value="${version.string}"/> |
| <attribute name="Bundle-ManifestVersion" value="2"/> |
| <attribute name="Bundle-Name" value="EclipseLink Oracle Extensions Source"/> |
| <attribute name="Bundle-SymbolicName" value="${ant.project.name}.source"/> |
| <attribute name="Bundle-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Bundle-Version" value="${version.string}"/> |
| <attribute name="Eclipse-SourceBundle" value="${ant.project.name};version="${version.string}""/> |
| </manifest> |
| <fileset dir="${oracle.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <zipgroupfileset dir="${oracle.2.foundation.plugins.dir}"> |
| <include name="${ant.project.name}.source.jar"/> |
| </zipgroupfileset> |
| </jar> |
| </target> |
| |
| <target name="bnd-package" if="bnd-package.ok" depends="init-package"> |
| <delete file="${oracle.2.foundation.plugins.dir}/${ant.project.name}.jar*" quiet="true" failonerror="false"/> |
| <delete file="${oracle.2.foundation.plugins.dir}/${ant.project.name}.source.jar*" quiet="true" failonerror="false"/> |
| <taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${bnd.lib}"/> |
| <bnd |
| classpath="${classes.dir}" |
| eclipse="false" |
| sourcepath="${src.dir}" |
| failok="false" |
| exceptions="true" |
| files="./org.eclipse.persistence.oracle.bnd" |
| output="${oracle.2.foundation.plugins.dir}/${ant.project.name}.jar"/> |
| <jar jarfile="${oracle.2.foundation.plugins.dir}/${ant.project.name}.source.jar" duplicate="preserve"> |
| <manifest> |
| <attribute name="Specification-Vendor" value="${specification.vendor}"/> |
| <attribute name="Specification-Version" value="${release.version}"/> |
| <attribute name="Implementation-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Implementation-Version" value="${version.string}"/> |
| <attribute name="Bundle-ManifestVersion" value="2"/> |
| <attribute name="Bundle-Name" value="EclipseLink Oracle Extensions Source"/> |
| <attribute name="Bundle-SymbolicName" value="${ant.project.name}.source"/> |
| <attribute name="Bundle-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Bundle-Version" value="${version.string}"/> |
| <attribute name="Eclipse-SourceBundle" value="${ant.project.name};version="${version.string}""/> |
| </manifest> |
| <fileset dir="${oracle.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <fileset dir="${src.dir}"> |
| <include name="org/eclipse/persistence/**/*.java"/> |
| </fileset> |
| </jar> |
| </target> |
| |
| <target name="bnd-repackage" if="bnd.bld" depends="init-package" description="take existing source and classes from checked in bundles, and repackage with new manifest"> |
| <delete file="${oracle.2.common.plugins.dir}/${ant.project.name}_${version.string}.jar*" quiet="true" failonerror="false"/> |
| <delete file="${oracle.2.common.plugins.dir}/${ant.project.name}.source_${version.string}.jar*" quiet="true" failonerror="false"/> |
| <taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${bnd.lib}"/> |
| <bnd |
| classpath="${oracle.2.foundation.plugins.dir}/${ant.project.name}.jar" |
| eclipse="false" |
| sourcepath="${src.dir}" |
| failok="false" |
| exceptions="true" |
| files="./org.eclipse.persistence.oracle.bnd" |
| output="${oracle.2.common.plugins.dir}/${ant.project.name}_${version.string}.jar"/> |
| <jar jarfile="${oracle.2.common.plugins.dir}/${ant.project.name}.source_${version.string}.jar" duplicate="preserve"> |
| <manifest> |
| <attribute name="Specification-Vendor" value="${specification.vendor}"/> |
| <attribute name="Specification-Version" value="${release.version}"/> |
| <attribute name="Implementation-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Implementation-Version" value="${version.string}"/> |
| <attribute name="Bundle-ManifestVersion" value="2"/> |
| <attribute name="Bundle-Name" value="EclipseLink Oracle Extensions Source"/> |
| <attribute name="Bundle-SymbolicName" value="${ant.project.name}.source"/> |
| <attribute name="Bundle-Vendor" value="${implementation.vendor}"/> |
| <attribute name="Bundle-Version" value="${version.string}"/> |
| <attribute name="Eclipse-SourceBundle" value="${ant.project.name};version="${version.string}""/> |
| </manifest> |
| <fileset dir="${oracle.2.base.dir}"> |
| <include name="about.html"/> |
| <include name="readme.html"/> |
| <include name="license.*"/> |
| </fileset> |
| <zipgroupfileset dir="${oracle.2.foundation.plugins.dir}"> |
| <include name="${ant.project.name}.source.jar"/> |
| </zipgroupfileset> |
| </jar> |
| </target> |
| </project> |