blob: b8059495f1e6e1d7096a173048950d57b49ab622 [file] [log] [blame]
<?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 concatenated
* e.g. 'runpathref'
* - multi-word tasks (taskdef) names are concatenated
* 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="org.eclipse.persistence.asm" default="build">
<available file="../${ant.project.name}" type="dir" property="asm.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="asm.is.local"/>
<!-- Primary Targets -->
<target name="build" depends="clean, package" description="package ${ant.project.name}"/>
<target name="bld" depends="clean, compile, package" description="build ${ant.project.name} component"/>
<!-- clean -->
<target name="clean" depends="init" description="Clean the build">
<!-- remove stored manifest for regen -->
<delete dir="${asm.classes.dir}/META-INF" includeEmptyDirs="true" failonerror="false" quiet="true"/>
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${asm.2.common.plugins.dir}" includes="${ant.project.name}_*.jar, ${ant.project.name}.source_*.jar"/>
</delete>
</target>
<!-- initialize varables and paths needed for other targets -->
<!-- the number of properties needed now is too great for lazy loading without a target -->
<target name="init">
<dirname property="asm.build.location_temp" file="${ant.file.org.eclipse.persistence.asm}"/>
<pathconvert targetos="unix" property="asm.build.location">
<path>
<pathelement location="${asm.build.location_temp}"/>
</path>
</pathconvert>
<property name="asm.2.base.dir" value="../.."/>
<property name="asm.2.common.plugins.dir" value=".."/>
<!-- Properties usually defined in build.properties, set here to avoid easy redefinition. -->
<!-- Version properties -->
<property name="release.version" value="6.0.0"/>
<condition property="javac.debug" value="false"
else="true">
<equals arg1="${build.type}" arg2="RELEASE"/>
</condition>
<property name="javac.debuglevel" value="lines,vars,source"/>
<property name="javac.version" value="1.7"/>
<property name="javac.optimize" value="false"/>
<property name="javac.deprecation" value="false"/>
<property name="src.dir" value="src"/>
<property name="classes.dir" value="bin"/>
<property name="asm.classes.dir" value="${asm.build.location}/${classes.dir}"/>
<!-- 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"/>
</target>
<!-- initialize varables and paths needed for compile -->
<target name="compile-init" 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="${asm.2.base.dir}/../extension.lib.external"
else="${asm.build.location}">
<available file="${asm.2.base.dir}/../extension.lib.external" type="dir"/>
</condition>
<echo message="extensions.depend.dir = '${extensions.depend.dir}'"/>
</target>
<target name="package-init" depends="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"/>
<condition property="version.qualifier" value="v${build.date}${build.time}"
else="qualifier">
<equals arg1="${build.type}" arg2="RELEASE"/>
</condition>
<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}"/>
</target>
<!-- compile -->
<target name="compile" depends="compile-init" description="Compile bundle code">
<!-- remove stored classes for recompile -->
<delete dir="${asm.classes.dir}/org" includeEmptyDirs="true" failonerror="false" quiet="true"/>
<mkdir dir="${asm.classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${asm.classes.dir}"
includes="org/eclipse/persistence/**/*.java"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
encoding="UTF-8"
optimize="${javac.optimize}"
source="${javac.version}"
target="${javac.version}"
deprecation="${javac.deprecation}"
failonerror="true"
memoryMaximumSize="512m"
fork="true"
/>
</target>
<!-- package -->
<target name="package" depends="package-init" description="jar OSGI bundle">
<mkdir dir="${asm.classes.dir}/META-INF"/>
<copy file="META-INF/MANIFEST.MF" todir="${asm.classes.dir}/META-INF"/>
<replace file="${asm.classes.dir}/META-INF/MANIFEST.MF" token="${release.version}.qualifier" value="${version.string}" />
<jar jarfile="${asm.2.common.plugins.dir}/${ant.project.name}_${version.string}.jar" manifest="${asm.classes.dir}/META-INF/MANIFEST.MF">
<fileset dir="${asm.2.base.dir}">
<include name="license.*"/>
</fileset>
<fileset dir="${asm.build.location}">
<include name="about.html"/>
<include name="readme.html"/>
</fileset>
<fileset dir="${asm.classes.dir}">
<include name="org/eclipse/persistence/**/*.class"/>
</fileset>
<fileset dir="${src.dir}">
<include name="org/eclipse/persistence/**/*.html"/>
<include name="org/eclipse/persistence/**/*.xsd"/>
<include name="org/eclipse/persistence/**/*.dtd"/>
</fileset>
</jar>
<jar jarfile="${asm.2.common.plugins.dir}/${ant.project.name}.source_${version.string}.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 ASM 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=&quot;${version.string}&quot;"/>
</manifest>
<fileset dir="${asm.2.base.dir}">
<include name="license.*"/>
</fileset>
<fileset dir="${asm.build.location}">
<include name="about.html"/>
<include name="readme.html"/>
</fileset>
<fileset dir="${src.dir}">
<include name="org/eclipse/persistence/**/*.java"/>
<include name="org/eclipse/persistence/**/*.html"/>
<include name="org/eclipse/persistence/**/*.xsd"/>
<include name="org/eclipse/persistence/**/*.dtd"/>
</fileset>
</jar>
</target>
</project>