306 lines
10 KiB
XML
306 lines
10 KiB
XML
<project name="allElements Delegator">
|
|
<property name="defaultAssemblyEnabled" value="true" />
|
|
|
|
<!-- ===================================================================== -->
|
|
<!-- Run a given ${target} on all elements being built -->
|
|
<!-- By default ${topLevelElementType} and ${topLevelElementId} should be -->
|
|
<!-- defined in the builder's build.properties file. You can customize by -->
|
|
<!-- setting the type/id values directly here. -->
|
|
<!-- You can add additional calls to ${genericTargets} to build more top -->
|
|
<!-- level elements. -->
|
|
<!-- -->
|
|
<!-- The top level must exist in the ${buildDirectory}, ${baseLocation} or -->
|
|
<!-- ${pluginPath} locations. -->
|
|
<!-- ===================================================================== -->
|
|
<target name="allElementsDelegator">
|
|
<property file="${builder}/common.properties" />
|
|
<!-- TODO: actually consider evaluating the result. -->
|
|
<property name="current.workspace.directory"
|
|
value="${builder}/../../" />
|
|
<property name="awips.baseline.directory"
|
|
value="${builder}/../../../" />
|
|
<path id="ant.classpath">
|
|
<fileset dir="${builder}/../lib/ant">
|
|
<include name="*.jar" />
|
|
</fileset>
|
|
</path>
|
|
<path id="ant.contrib.path">
|
|
<fileset dir="/awips2/ant/lib/">
|
|
<include name="ant-contrib-*.jar" />
|
|
</fileset>
|
|
</path>
|
|
|
|
|
|
<taskdef
|
|
name="includegen"
|
|
classname="com.raytheon.uf.anttasks.includesgen.GenerateIncludesFromFeature"
|
|
classpathref="ant.classpath" />
|
|
<taskdef resource="net/sf/antcontrib/antlib.xml"
|
|
classpathref="ant.contrib.path" />
|
|
<propertyselector property="baseline.variables"
|
|
delimiter="${path.separator}"
|
|
match="dir.([0-9][0-9])"
|
|
select="\1"
|
|
casesensitive="true" />
|
|
|
|
<var name="basedirectories" value="${current.workspace.directory}" />
|
|
<for list="${baseline.variables}" param="index"
|
|
delimiter="${path.separator}">
|
|
<sequential>
|
|
<propertycopy property="variable.name"
|
|
override="true"
|
|
from="dir.@{index}" />
|
|
|
|
<var name="basedirectories"
|
|
value="${awips.baseline.directory}${variable.name};${basedirectories}" />
|
|
</sequential>
|
|
</for>
|
|
|
|
<!-- Find the feature. -->
|
|
<var name="feature.path" value="" />
|
|
<var name="feature.directory" value="" />
|
|
<for list="${basedirectories}" param="directory"
|
|
delimiter=";">
|
|
<sequential>
|
|
<if>
|
|
<available file="@{directory}/${topLevelElementId}" />
|
|
<then>
|
|
<var name="feature.directory" value="@{directory}" />
|
|
<var name="feature.path"
|
|
value="${feature.directory}/${topLevelElementId}" />
|
|
</then>
|
|
</if>
|
|
</sequential>
|
|
</for>
|
|
|
|
<if>
|
|
<equals arg1="${feature.path}" arg2="" />
|
|
<then>
|
|
<fail message="Failed to find feature: ${topLevelElementId}" />
|
|
</then>
|
|
</if>
|
|
|
|
<mkdir dir="${builder}/tmp/features" />
|
|
<!-- copy the feature -->
|
|
<copy todir="${builder}/tmp/features">
|
|
<fileset dir="${feature.directory}"
|
|
includes="${topLevelElementId}/**" />
|
|
</copy>
|
|
|
|
<mkdir dir="${builder}/includes" />
|
|
<!-- Determine what plugins we need for the feature. -->
|
|
<includegen providerfilter="${includegen.filter}"
|
|
basedirectories="${basedirectories}"
|
|
featurefile="${feature.path}/feature.xml"
|
|
cotsout="${builder}/includes/cots.includes"
|
|
plugsout="${builder}/includes/plugins.includes"
|
|
coreout="${builder}/includes/core.includes" />
|
|
|
|
<mkdir dir="${builder}/tmp/plugins" />
|
|
<!-- iterate through and copy the plugins -->
|
|
<if>
|
|
<available file="${builder}/dependencies-stash"
|
|
type="dir" />
|
|
<then>
|
|
<delete includeemptydirs="true">
|
|
<fileset dir="${builder}"
|
|
includes="dependencies-stash/**" />
|
|
</delete>
|
|
</then>
|
|
</if>
|
|
<!-- stash the foss dependencies -->
|
|
<mkdir dir="${builder}/dependencies-stash" />
|
|
<processPlugins
|
|
includes.file="${builder}/includes/cots.includes"
|
|
plugin.type="cots"
|
|
plugin.directories="${basedirectories}" />
|
|
|
|
<processPlugins
|
|
includes.file="${builder}/includes/plugins.includes"
|
|
plugin.type="plugins"
|
|
plugin.directories="${basedirectories}" />
|
|
|
|
<processPlugins
|
|
includes.file="${builder}/includes/core.includes"
|
|
plugin.type="core"
|
|
plugin.directories="${basedirectories}" />
|
|
|
|
<ant antfile="${genericTargets}" target="${target}">
|
|
<property name="type" value="${topLevelElementType}" />
|
|
<property name="id" value="${topLevelElementId}" />
|
|
</ant>
|
|
</target>
|
|
|
|
<macrodef name="processPlugins">
|
|
<attribute name="includes.file" />
|
|
<attribute name="plugin.type" />
|
|
<attribute name="plugin.directories" />
|
|
|
|
<sequential>
|
|
<loadfile property="includefile.@{plugin.type}"
|
|
srcfile="@{includes.file}" />
|
|
<var name="index" value="1" />
|
|
|
|
<for param="line" list="${includefile.@{plugin.type}}"
|
|
delimiter="${line.separator}">
|
|
<sequential>
|
|
<!-- skip the first line -->
|
|
<if>
|
|
<not>
|
|
<equals arg1="${index}" arg2="1" />
|
|
</not>
|
|
<then>
|
|
<copyPlugin
|
|
plugin.name="@{line}"
|
|
plugin.type="@{plugin.type}"
|
|
plugin.directories="@{plugin.directories}"
|
|
plugin.pattern="@{line}" />
|
|
</then>
|
|
</if>
|
|
<math result="index"
|
|
operand1="${index}"
|
|
operation="+"
|
|
operand2="1"
|
|
datatype="int" />
|
|
</sequential>
|
|
</for>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<macrodef name="copyPlugin">
|
|
<attribute name="plugin.name" />
|
|
<attribute name="plugin.type" />
|
|
<attribute name="plugin.directories" />
|
|
<attribute name="plugin.pattern" />
|
|
|
|
<sequential>
|
|
<!-- find the plugin -->
|
|
<var name="plugin.directory" value="" />
|
|
<for list="${basedirectories}" param="directory"
|
|
delimiter=";">
|
|
<sequential>
|
|
<if>
|
|
<available file="@{directory}/@{plugin.name}" />
|
|
<then>
|
|
<var name="plugin.directory" value="@{directory}" />
|
|
</then>
|
|
</if>
|
|
</sequential>
|
|
</for>
|
|
|
|
<!-- copy the plugin to the plugins directory -->
|
|
<copy todir="${builder}/tmp/plugins">
|
|
<fileset dir="${plugin.directory}"
|
|
includes="@{plugin.name}/**" />
|
|
</copy>
|
|
<if>
|
|
<equals arg1="@{plugin.type}" arg2="cots" />
|
|
<then>
|
|
<copyFOSS
|
|
plugin.directory323="${plugin.directory}/@{plugin.name}"
|
|
destination.directory323="${builder}/dependencies-stash/@{plugin.name}" />
|
|
</then>
|
|
</if>
|
|
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<macrodef name="copyFOSS">
|
|
<!--
|
|
random character suffixes added to
|
|
maintain uniqueness of variable names
|
|
-->
|
|
<attribute name="plugin.directory323" />
|
|
<attribute name="destination.directory323" />
|
|
|
|
<sequential>
|
|
<mkdir dir="@{destination.directory323}" />
|
|
|
|
<!-- scan build.properties -->
|
|
<var file="@{plugin.directory323}/build.properties" />
|
|
|
|
<!--
|
|
* iterate through bin.includes
|
|
* '.' is seen as the ${output..} directory, itself
|
|
* artifacts are only deployed if they are present
|
|
-->
|
|
<for list="${bin.includes}" param="include"
|
|
delimiter="," trim="true">
|
|
<sequential>
|
|
<if>
|
|
<available file="@{plugin.directory323}/@{include}"
|
|
type="dir" />
|
|
<then>
|
|
<!-- deploy a directory -->
|
|
|
|
<!-- is this the output directory? -->
|
|
<if>
|
|
<not>
|
|
<equals arg1="@{include}" arg2="." />
|
|
</not>
|
|
<then>
|
|
<copy todir="@{destination.directory323}"
|
|
overwrite="true" verbose="true">
|
|
<fileset dir="@{plugin.directory323}"
|
|
includes="@{include}/**" />
|
|
</copy>
|
|
</then>
|
|
</if>
|
|
</then>
|
|
<else>
|
|
<!-- are we deploying a file? -->
|
|
<if>
|
|
<available file="@{plugin.directory323}/@{include}"
|
|
type="file" />
|
|
<then>
|
|
<copy todir="@{destination.directory323}"
|
|
overwrite="true" verbose="true">
|
|
<fileset dir="@{plugin.directory323}"
|
|
includes="@{include}" />
|
|
</copy>
|
|
</then>
|
|
<else>
|
|
<!-- fail: unknown deployment artifact -->
|
|
<fail
|
|
message="Unable to deploy '@{include}' specified in @{plugin.directory323}/build.properties; unable to find the file / directory." />
|
|
</else>
|
|
</if>
|
|
</else>
|
|
</if>
|
|
</sequential>
|
|
</for>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<!-- ====================================================================== -->
|
|
<!-- The default assemble target, this will be called to assemble each -->
|
|
<!-- config if a custom assemble target is not defined. -->
|
|
<!-- The following properties will be defined: -->
|
|
<!-- config : The configuration being assembled eg "win32.win32.x86" -->
|
|
<!-- element: The element being assembled eg "org.eclipse.sdk" -->
|
|
<!-- assembleScriptName: The assemble script to be called -->
|
|
<!-- ====================================================================== -->
|
|
<target name="defaultAssemble">
|
|
<ant antfile="${builder}/packageOverride.xml" dir="${buildDirectory}" />
|
|
<property name="assembleScriptName" value="${assembleScriptName}" />
|
|
</target>
|
|
|
|
<!-- ===================================================================== -->
|
|
<!-- Custom targets to assemble the built elements for particular -->
|
|
<!-- configurations. These generally call the generated assemble scripts -->
|
|
<!-- (named in ${assembleScriptName}) but may also add pre and post -->
|
|
<!-- processing -->
|
|
<!-- Add one target for each root element and each configuration for which -->
|
|
<!-- custom processing is desired. Replace element.id with the id of the -->
|
|
<!-- top level element being built. A property with a matching name must -->
|
|
<!-- be defined for this custom target to be called instead of the -->
|
|
<!-- defaultAssemble target above. -->
|
|
<!-- Example: name="assemble.org.eclipse.sdk" -->
|
|
<!-- Example: name="assemble.org.eclipse.sdk.win32.win32.x86" -->
|
|
<!-- ====================================================================== -->
|
|
<property name="assemble.element.id[.config.spec]" value="true" />
|
|
<target name="assemble.element.id[.config.spec]">
|
|
<ant antfile="${assembleScriptName}" dir="${buildDirectory}"/>
|
|
</target>
|
|
|
|
</project>
|