Omaha #3299 - Updated deploy-install to find features
Change-Id: I107c16d832936d63af5dbc76b07166db119c95e2 Former-commit-id:1a3ca4f8df
[formerly2fd4ace0a2
[formerly6a5463ab87
] [formerly1a3ca4f8df
[formerly a25d39959ccdc41ab99e0eaf4ad87559adfcb362]]] Former-commit-id:2fd4ace0a2
[formerly6a5463ab87
] Former-commit-id:2fd4ace0a2
Former-commit-id:fe5cf3f8e6
This commit is contained in:
parent
e5f5cfc7ae
commit
f74a9a2360
11 changed files with 794 additions and 733 deletions
Binary file not shown.
Binary file not shown.
|
@ -4,128 +4,150 @@
|
|||
<property file="${basedir}/edex/common.properties" />
|
||||
<property file="${basedir}/edex/developer.properties" />
|
||||
<condition property="wa.enabled">
|
||||
<not><equals arg1="${wa.to.deploy}" arg2="" /></not>
|
||||
<not>
|
||||
<equals arg1="${wa.to.deploy}" arg2="" />
|
||||
</not>
|
||||
</condition>
|
||||
|
||||
|
||||
<dirname property="antfile.dir" file="${ant.file}" />
|
||||
<echo message="ANT FILE DIR:${antfile.dir}"/>
|
||||
<echo message="ANT FILE DIR:${antfile.dir}" />
|
||||
<dirname property="base.dir" file="${antfile.dir}" />
|
||||
<echo message="BASE DIR:${base.dir}"/>
|
||||
<basename property="base.name" file="${base.dir}"/>
|
||||
<echo message="BASE NAME:${base.name}"/>
|
||||
<echo message="BASE DIR:${base.dir}" />
|
||||
<basename property="base.name" file="${base.dir}" />
|
||||
<echo message="BASE NAME:${base.name}" />
|
||||
<if>
|
||||
<equals arg1="${base.name}" arg2="edexOsgi" />
|
||||
<then>
|
||||
<!-- we are in the distributed development environment -->
|
||||
<echo message="BUILDING: in distributed development environment"/>
|
||||
<echo message="BUILDING: in distributed development environment" />
|
||||
<dirname property="awips.baseline.directory" file="${base.dir}" />
|
||||
<dirname property="git.directory" file="${awips.baseline.directory}" />
|
||||
<echo message="GIT.DIRECTORY:${git.directory}"/>
|
||||
<var name="repository.directories"
|
||||
value="${awips.baseline.directory}" />
|
||||
<echo message="GIT.DIRECTORY:${git.directory}" />
|
||||
<var name="repository.directories" value="${awips.baseline.directory}" />
|
||||
<for list="${core.repositories}" param="repo.directory">
|
||||
<sequential>
|
||||
<var name="repository.directories"
|
||||
value="${repository.directories},${git.directory}${file.separator}@{repo.directory}" />
|
||||
<var name="repository.directories" value="${repository.directories},${git.directory}${file.separator}@{repo.directory}" />
|
||||
</sequential>
|
||||
</for>
|
||||
<property name="tab" value=" "/>
|
||||
<echo level="info" message=" "/>
|
||||
<echo level="info" message="Deploy checks the following directories for source:"/>
|
||||
<echo level="info" message=" "/>
|
||||
<for list="${repository.directories}" param="repository.directory">
|
||||
<sequential>
|
||||
<echo level="info" message="${tab}@{repository.directory}" />
|
||||
<if>
|
||||
<not>
|
||||
<available file="@{repository.directory}" type="dir" />
|
||||
</not>
|
||||
<then>
|
||||
<echo level="error" message="${tab}@{repository.directory} does not exist!"/>
|
||||
<property name="missingDir"
|
||||
value="true" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
<if>
|
||||
<isset property="missingDir" />
|
||||
<then>
|
||||
<echo level="error" message=" "/>
|
||||
<echo level="error" message="Edit core.repositories=${core.repositories} in common.properties, rename source directories or create a symlink!"/>
|
||||
<echo level="error" message=" "/>
|
||||
<fail message="Unable to locate source directories."/>
|
||||
</then>
|
||||
</if>
|
||||
<echo level="info" message=" "/>
|
||||
|
||||
<echo message="${optional.repositories}"/>
|
||||
<for list="${optional.repositories}" param="repo.directory">
|
||||
<sequential>
|
||||
<if>
|
||||
<isset property="optional.directories" />
|
||||
<then>
|
||||
<var name="optional.directories" value="${optional.directories},${git.directory}${file.separator}@{repo.directory}" />
|
||||
</then>
|
||||
<else>
|
||||
<var name="optional.directories" value="${git.directory}${file.separator}@{repo.directory}" />
|
||||
</else>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
|
||||
<property name="tab" value=" " />
|
||||
<echo level="info" message=" " />
|
||||
<echo level="info" message="Deploy checks the following directories for source:" />
|
||||
<echo level="info" message=" " />
|
||||
<for list="${repository.directories}" param="repository.directory">
|
||||
<sequential>
|
||||
<echo level="info" message="${tab}@{repository.directory}" />
|
||||
<if>
|
||||
<not>
|
||||
<available file="@{repository.directory}" type="dir" />
|
||||
</not>
|
||||
<then>
|
||||
<echo level="error" message="${tab}@{repository.directory} does not exist!" />
|
||||
<property name="missingDir" value="true" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
<if>
|
||||
<isset property="missingDir" />
|
||||
<then>
|
||||
<echo level="error" message=" " />
|
||||
<echo level="error" message="Edit core.repositories=${core.repositories} in common.properties, rename source directories or create a symlink!" />
|
||||
<echo level="error" message=" " />
|
||||
<fail message="Unable to locate source directories." />
|
||||
</then>
|
||||
</if>
|
||||
<echo level="info" message=" " />
|
||||
</then>
|
||||
<else>
|
||||
<!-- all of the projects are in the workspace or one single directory -->
|
||||
<echo message="BUILDING: in workspace or flattened directory structure"/>
|
||||
<var name="awips.baseline.directory"
|
||||
value="${base.dir}" />
|
||||
<var name="repository.directories"
|
||||
value="${base.dir}" />
|
||||
<echo message="BUILDING: in workspace or flattened directory structure" />
|
||||
<var name="awips.baseline.directory" value="${base.dir}" />
|
||||
<var name="repository.directories" value="${base.dir}" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<echo message="AWIPS.BASELINE.DIRECTORY:${awips.baseline.directory}"/>
|
||||
<echo message="REPOSITORY.DIRECTORIES:${repository.directories}"/>
|
||||
<echo message="AWIPS.BASELINE.DIRECTORY:${awips.baseline.directory}" />
|
||||
<echo message="REPOSITORY.DIRECTORIES:${repository.directories}" />
|
||||
|
||||
<!-- construct the list of "basedirectories" -->
|
||||
<propertyselector property="baseline.variables"
|
||||
delimiter="${path.separator}"
|
||||
match="dir.([0-9][0-9])"
|
||||
select="\1"
|
||||
casesensitive="true" />
|
||||
|
||||
<var name="basedirectories"
|
||||
value="${awips.baseline.directory}" />
|
||||
|
||||
<for list="${baseline.variables}" param="index"
|
||||
delimiter="${path.separator}">
|
||||
<sequential>
|
||||
<propertycopy property="variable.name"
|
||||
override="true"
|
||||
from="dir.@{index}" />
|
||||
<for list="${repository.directories}" param="repo.directory">
|
||||
<sequential>
|
||||
<var name="base.directory"
|
||||
value="@{repo.directory}/${variable.name}" />
|
||||
<if>
|
||||
<available file="${base.directory}" type="dir" />
|
||||
<then>
|
||||
<echo message="BASE.DIRECTORY:${base.directory}"/>
|
||||
<var name="basedirectories"
|
||||
value="${base.directory};${basedirectories}" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
|
||||
<!-- Loop through the WA directories, if they exist. -->
|
||||
<if>
|
||||
<isset property="wa.enabled" />
|
||||
<then>
|
||||
<for list="${wa.to.deploy}" param="wa"
|
||||
delimiter="${path.separator}">
|
||||
<sequential>
|
||||
<var name="wa.base.directory"
|
||||
value="@{wa}/${variable.name}" />
|
||||
|
||||
<if>
|
||||
<available file="${wa.base.directory}"
|
||||
type="dir" />
|
||||
<then>
|
||||
<var name="basedirectories"
|
||||
value="${wa.base.directory};${basedirectories}" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
<propertyselector property="baseline.variables" delimiter="${path.separator}" match="dir.([0-9][0-9])" select="\1" casesensitive="true" />
|
||||
|
||||
<var name="basedirectories" value="${awips.baseline.directory}" />
|
||||
|
||||
<for list="${baseline.variables}" param="index" delimiter="${path.separator}">
|
||||
<sequential>
|
||||
<propertycopy property="variable.name" override="true" from="dir.@{index}" />
|
||||
<for list="${repository.directories}" param="repo.directory">
|
||||
<sequential>
|
||||
<var name="base.directory" value="@{repo.directory}/${variable.name}" />
|
||||
<if>
|
||||
<available file="${base.directory}" type="dir" />
|
||||
<then>
|
||||
<echo message="BASE.DIRECTORY:${base.directory}" />
|
||||
<var name="basedirectories" value="${base.directory};${basedirectories}" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
|
||||
<for list="${optional.directories}" param="repo.directory">
|
||||
<sequential>
|
||||
<var name="optional.directory" value="@{repo.directory}/${variable.name}" />
|
||||
<if>
|
||||
<available file="${optional.directory}" type="dir" />
|
||||
<then>
|
||||
<echo message="OPTIONAL.DIRECTORY:${optional.directory}" />
|
||||
<if>
|
||||
<isset property="optionaldirectories"/>
|
||||
<then>
|
||||
<var name="optionaldirectories" value="${optional.directory};${optionaldirectories}" />
|
||||
</then>
|
||||
<else>
|
||||
<var name="optionaldirectories" value="${optional.directory}" />
|
||||
</else>
|
||||
|
||||
</if>
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
|
||||
|
||||
<!-- Loop through the WA directories, if they exist. -->
|
||||
<if>
|
||||
<isset property="wa.enabled" />
|
||||
<then>
|
||||
<for list="${wa.to.deploy}" param="wa" delimiter="${path.separator}">
|
||||
<sequential>
|
||||
<var name="wa.base.directory" value="@{wa}/${variable.name}" />
|
||||
|
||||
<if>
|
||||
<available file="${wa.base.directory}" type="dir" />
|
||||
<then>
|
||||
<var name="basedirectories" value="${wa.base.directory};${basedirectories}" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
</project>
|
|
@ -49,7 +49,7 @@
|
|||
<sequential>
|
||||
<var name="plugin.path" value="" />
|
||||
<!-- first we need to find the plugin -->
|
||||
<for list="${basedirectories}" param="directory"
|
||||
<for list="@{plugin.directories}" param="directory"
|
||||
delimiter=";">
|
||||
<sequential>
|
||||
<if>
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
<import file="${basedir}/deploy-common/deploy-init.xml" />
|
||||
<import file="${basedir}/deploy-common/deploy-setup.xml" />
|
||||
<import file="${basedir}/deploy-common/plugin-methods.xml" />
|
||||
|
||||
|
||||
<!-- public static final -->
|
||||
<path id="ant.classpath">
|
||||
<fileset dir="${basedir}/lib/ant">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
<path id="ant.classpath">
|
||||
<fileset dir="${basedir}/lib/ant">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
<property name="esb.directory" value="${basedir}/esb" />
|
||||
|
||||
|
||||
<target name="main" depends="init, setup">
|
||||
<!-- deploy esb {optionally: data, web} -->
|
||||
<ant antfile="${basedir}/deploy-common/deploy-esb.xml" />
|
||||
|
@ -33,40 +33,35 @@
|
|||
Find the feature associated with
|
||||
Work Assignments.
|
||||
-->
|
||||
<var name="feature.to.find"
|
||||
value="${wa.edex.feature}" />
|
||||
<var name="feature.to.find" value="${wa.edex.feature}" />
|
||||
</then>
|
||||
<else>
|
||||
<!--
|
||||
Find the standard AWIPS II
|
||||
Baseline feature.
|
||||
-->
|
||||
<var name="feature.to.find"
|
||||
value="${edex.feature}" />
|
||||
<var name="feature.to.find" value="${edex.feature}" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
|
||||
<var name="feature" value="" />
|
||||
<!--
|
||||
find the feature file: we may deploy multiple features
|
||||
if multiple Work Assignment directories have been
|
||||
specified.
|
||||
-->
|
||||
<for list="${basedirectories}" param="directory"
|
||||
delimiter=";">
|
||||
<sequential>
|
||||
<if>
|
||||
<available file="@{directory}/${feature.to.find}" />
|
||||
<then>
|
||||
<var name="feature"
|
||||
value="@{directory}/${feature.to.find}" />
|
||||
<deploy.feature
|
||||
feature="${feature}" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
|
||||
<for list="${basedirectories}" param="directory" delimiter=";">
|
||||
<sequential>
|
||||
<if>
|
||||
<available file="@{directory}/${feature.to.find}" />
|
||||
<then>
|
||||
<var name="feature" value="@{directory}/${feature.to.find}" />
|
||||
<deploy.feature feature="${feature}" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
|
||||
<!-- optionally: deploy raytheon python -->
|
||||
<if>
|
||||
<equals arg1="${deploy.python}" arg2="true" />
|
||||
|
@ -91,36 +86,30 @@
|
|||
<if>
|
||||
<isset property="wa.enabled" />
|
||||
<then>
|
||||
<for list="${wa.to.deploy}" param="wa"
|
||||
delimiter="${path.separator}">
|
||||
<for list="${wa.to.deploy}" param="wa" delimiter="${path.separator}">
|
||||
<sequential>
|
||||
<basename property="wa.name" file="@{wa}" />
|
||||
<if>
|
||||
<available file="@{wa}/edex/deploy-${wa.name}/wa-deploy.xml"
|
||||
type="file" />
|
||||
<available file="@{wa}/edex/deploy-${wa.name}/wa-deploy.xml" type="file" />
|
||||
<then>
|
||||
<ant
|
||||
antfile="@{wa}/edex/deploy-${wa.name}/wa-deploy.xml"
|
||||
inheritall="true" inheritrefs="true"
|
||||
useNativeBasedir="true" />
|
||||
<ant antfile="@{wa}/edex/deploy-${wa.name}/wa-deploy.xml" inheritall="true" inheritrefs="true" useNativeBasedir="true" />
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</for>
|
||||
</then>
|
||||
</then>
|
||||
</if>
|
||||
<tstamp>
|
||||
<format property="TIMESTAMP_COMPLETE" pattern="d-MMM-yyyy h:mm:ss a"
|
||||
locale="en,US" />
|
||||
</tstamp>
|
||||
<echo message="Deploy Complete: ${TIMESTAMP_COMPLETE}" />
|
||||
<tstamp>
|
||||
<format property="TIMESTAMP_COMPLETE" pattern="d-MMM-yyyy h:mm:ss a" locale="en,US" />
|
||||
</tstamp>
|
||||
<echo message="Deploy Complete: ${TIMESTAMP_COMPLETE}" />
|
||||
</target>
|
||||
|
||||
|
||||
<!-- public -->
|
||||
<!-- Targets specific to the developer deployment. -->
|
||||
<macrodef name="deploy.feature">
|
||||
<attribute name="feature" />
|
||||
|
||||
|
||||
<sequential>
|
||||
<!-- prepare to run includegen -->
|
||||
<var name="includes.directory" value="${basedir}/tmp/includes" />
|
||||
|
@ -128,151 +117,125 @@
|
|||
<available file="${includes.directory}" type="dir" />
|
||||
<then>
|
||||
<delete verbose="true" includeemptydirs="true">
|
||||
<fileset dir="${includes.directory}"
|
||||
includes="*/**" />
|
||||
<fileset dir="${includes.directory}" includes="*/**" />
|
||||
</delete>
|
||||
</then>
|
||||
</if>
|
||||
<mkdir dir="${includes.directory}" />
|
||||
|
||||
|
||||
<!-- run includegen -->
|
||||
<echo message="Generating deployment list for feature: ${feature}" />
|
||||
<echo message="Generating deployment list for feature: ${feature}" />
|
||||
<!--
|
||||
TODO: need to update the includegen ant task to recognize
|
||||
plugin architecture restrictions. Plugins that should only
|
||||
be deployed for a 64-bit system should not be deployed for
|
||||
a 32-bit system, etc.
|
||||
-->
|
||||
<includegen providerfilter="${includegen.filter}"
|
||||
basedirectories="${basedirectories}"
|
||||
featurefile="${feature}"
|
||||
cotsout="${includes.directory}/cots.includes"
|
||||
plugsout="${includes.directory}/plugins.includes"
|
||||
coreout="${includes.directory}/core.includes" />
|
||||
|
||||
<var name="destination.directory"
|
||||
value="${edex.root.directory}/lib/plugins" />
|
||||
<echo message="${feature}" />
|
||||
<echo message="${includes.directory}/cots.includes" />
|
||||
<echo message="${includes.directory}/core.includes" />
|
||||
|
||||
<includegen providerfilter="${includegen.filter}" basedirectories="${basedirectories}" optionaldirectories="${optionaldirectories}" featurefile="${feature}" cotsout="${includes.directory}/cots.includes" plugsout="${includes.directory}/plugins.includes" coreout="${includes.directory}/core.includes" />
|
||||
|
||||
<var name="destination.directory" value="${edex.root.directory}/lib/plugins" />
|
||||
<mkdir dir="${destination.directory}" />
|
||||
<processPlugins
|
||||
includes.file="${includes.directory}/plugins.includes"
|
||||
plugin.type="plugins"
|
||||
plugin.directories="${basedirectories}"
|
||||
destination.directory="${destination.directory}" />
|
||||
<processPlugins
|
||||
includes.file="${includes.directory}/core.includes"
|
||||
plugin.type="core"
|
||||
plugin.directories="${basedirectories}"
|
||||
destination.directory="${destination.directory}" />
|
||||
|
||||
<var name="destination.directory"
|
||||
value="${edex.root.directory}/lib/dependencies" />
|
||||
<processPlugins includes.file="${includes.directory}/plugins.includes" plugin.type="plugins" plugin.directories="${basedirectories}" destination.directory="${destination.directory}" />
|
||||
<processPlugins includes.file="${includes.directory}/core.includes" plugin.type="core" plugin.directories="${basedirectories}" destination.directory="${destination.directory}" />
|
||||
|
||||
<var name="destination.directory" value="${edex.root.directory}/lib/dependencies" />
|
||||
<mkdir dir="${destination.directory}" />
|
||||
<processPlugins
|
||||
includes.file="${includes.directory}/cots.includes"
|
||||
plugin.type="cots"
|
||||
plugin.directories="${basedirectories}"
|
||||
destination.directory="${destination.directory}" />
|
||||
|
||||
|
||||
<if>
|
||||
<isset property="optionaldirectories" />
|
||||
<then>
|
||||
<var name="allDir" value="${basedirectories};${optionaldirectories}" />
|
||||
<processPlugins includes.file="${includes.directory}/cots.includes" plugin.type="cots" plugin.directories="${allDir}" destination.directory="${destination.directory}" />
|
||||
</then>
|
||||
<else>
|
||||
<processPlugins includes.file="${includes.directory}/cots.includes" plugin.type="cots" plugin.directories="${basedirectories}" destination.directory="${destination.directory}" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- cleanup the temporary directories -->
|
||||
<if>
|
||||
<available file="${basedir}/tmp"
|
||||
type="dir" />
|
||||
<available file="${basedir}/tmp" type="dir" />
|
||||
<then>
|
||||
<delete includeemptydirs="true">
|
||||
<fileset dir="${basedir}"
|
||||
includes="tmp/**" />
|
||||
<fileset dir="${basedir}" includes="tmp/**" />
|
||||
</delete>
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
|
||||
<target name="deploy.python">
|
||||
<property name="site-package.directory"
|
||||
value="${python.root.directory}/lib/${python.version.dir}/site-packages" />
|
||||
|
||||
<property name="site-package.directory" value="${python.root.directory}/lib/${python.version.dir}/site-packages" />
|
||||
|
||||
<echo message="Deploying the Raytheon python site-packages." />
|
||||
<deploy.python.site-package
|
||||
site.package="ufpy" />
|
||||
<deploy.python.site-package
|
||||
site.package="dynamicserialize" />
|
||||
<deploy.python.site-package
|
||||
site.package="pypies" />
|
||||
<deploy.python.site-package site.package="ufpy" />
|
||||
<deploy.python.site-package site.package="dynamicserialize" />
|
||||
<deploy.python.site-package site.package="pypies" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="deploy.localization">
|
||||
<for list="${localization.sites}" param="site"
|
||||
delimiter="${path.separator}">
|
||||
<sequential>
|
||||
<echo message="Deploying localization for site: @{site}" />
|
||||
|
||||
<for list="${localization.sites}" param="site" delimiter="${path.separator}">
|
||||
<sequential>
|
||||
<echo message="Deploying localization for site: @{site}" />
|
||||
|
||||
<!-- determine which directory the localization
|
||||
project should be in. -->
|
||||
<var name="localization.path" value="" />
|
||||
<var name="localization.path" value="" />
|
||||
<if>
|
||||
<available file="${awips.baseline.directory}/localization.@{site}"
|
||||
type="dir" />
|
||||
<available file="${awips.baseline.directory}/localization.@{site}" type="dir" />
|
||||
<then>
|
||||
<var name="localization.path"
|
||||
value="${awips.baseline.directory}/localization.@{site}" />
|
||||
<var name="localization.path" value="${awips.baseline.directory}/localization.@{site}" />
|
||||
</then>
|
||||
<else>
|
||||
<var name="localization.path"
|
||||
value="${awips.baseline.directory}/${localization.directory}/localization.@{site}" />
|
||||
<var name="localization.path" value="${awips.baseline.directory}/${localization.directory}/localization.@{site}" />
|
||||
</else>
|
||||
</if>
|
||||
|
||||
<!-- copy the localization files. -->
|
||||
<copy todir="${edex.root.directory}/data/utility"
|
||||
overwrite="true">
|
||||
<fileset dir="${localization.path}/utility"
|
||||
includes="*/**" />
|
||||
</copy>
|
||||
</sequential>
|
||||
</for>
|
||||
|
||||
<!-- copy the localization files. -->
|
||||
<copy todir="${edex.root.directory}/data/utility" overwrite="true">
|
||||
<fileset dir="${localization.path}/utility" includes="*/**" />
|
||||
</copy>
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- private -->
|
||||
<macrodef name="deploy.python.site-package">
|
||||
<attribute name="site.package" />
|
||||
|
||||
|
||||
<sequential>
|
||||
<echo message="Deploying @{site.package} ..." />
|
||||
<if>
|
||||
<available file="${site-package.directory}/@{site.package}"
|
||||
type="dir" />
|
||||
<available file="${site-package.directory}/@{site.package}" type="dir" />
|
||||
<then>
|
||||
<delete dir="${site-package.directory}/@{site.package}"
|
||||
includeemptydirs="true">
|
||||
<fileset dir="${site-package.directory}"
|
||||
includes="@{site.package}/**" />
|
||||
<delete dir="${site-package.directory}/@{site.package}" includeemptydirs="true">
|
||||
<fileset dir="${site-package.directory}" includes="@{site.package}/**" />
|
||||
</delete>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
|
||||
<if>
|
||||
<equals arg1="@{site.package}" arg2="pypies" />
|
||||
<then>
|
||||
<!-- custom rule for pypies due to alternate directory layout -->
|
||||
<copy todir="${site-package.directory}">
|
||||
<fileset dir="${awips.baseline.directory}/pythonPackages/pypies"
|
||||
includes="@{site.package}/**" />
|
||||
<fileset dir="${awips.baseline.directory}/pythonPackages/pypies" includes="@{site.package}/**" />
|
||||
</copy>
|
||||
</then>
|
||||
<else>
|
||||
<copy todir="${site-package.directory}">
|
||||
<fileset dir="${awips.baseline.directory}/pythonPackages"
|
||||
includes="@{site.package}/**" />
|
||||
<fileset dir="${awips.baseline.directory}/pythonPackages" includes="@{site.package}/**" />
|
||||
</copy>
|
||||
</else>
|
||||
</if>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
|
||||
<!-- static -->
|
||||
<taskdef name="includegen"
|
||||
classname="com.raytheon.uf.anttasks.includesgen.GenerateIncludesFromFeature"
|
||||
classpathref="ant.classpath" />
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"
|
||||
classpath="${basedir}/lib/ant/ant-contrib-1.0b3.jar" />
|
||||
<taskdef name="includegen" classname="com.raytheon.uf.anttasks.includesgen.GenerateIncludesFromFeature" classpathref="ant.classpath" />
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${basedir}/lib/ant/ant-contrib-1.0b3.jar" />
|
||||
</project>
|
|
@ -1,14 +1,19 @@
|
|||
edex.root.directory=/awips2/edex
|
||||
architecture=x86_64
|
||||
|
||||
includegen.filter=raytheon|noaa\.nws|noaa\.gsd|gov\.nasa\.msfc|edu\.wisc\.ssec\.cimss
|
||||
includegen.filter=raytheon|noaa\.nws|noaa\.gsd|nasa|edu\.wisc\.ssec\.cimss
|
||||
|
||||
# AWIPSII core repositories required for build
|
||||
core.repo=ufcore
|
||||
core-foss.repo=ufcore-foss
|
||||
awips2-foss.repo=AWIPS2_foss
|
||||
|
||||
awips2-ncep.repo=AWIPS2_NCEP
|
||||
awips2-cimss.repo=AWIPS2_CIMSS
|
||||
awips2-gsd.repo=AWIPS2_GSD
|
||||
|
||||
core.repositories=${core.repo},${core-foss.repo},${awips2-foss.repo}
|
||||
optional.repositories=${awips2-ncep.repo},${awips2-cimss.repo},${awips2-gsd.repo}
|
||||
|
||||
# Note: currently, there is a limit of 99 plugin directories.
|
||||
dir.01=cave
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -7,3 +7,4 @@ Bundle-Vendor: RAYTHEON
|
|||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.apache.ant;bundle-version="1.7.1",
|
||||
com.raytheon.uf.featureexplorer;bundle-version="1.0.0"
|
||||
Import-Package: com.raytheon.uf.featureexplorer
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package com.raytheon.uf.anttasks.includesgen;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -28,6 +30,7 @@ import com.raytheon.uf.featureexplorer.FeatureExplorer;
|
|||
* 28Jan2009 1930 MW Fegan Added provider and plugin filtering.
|
||||
* Feb 4, 2013 #1577 bkowal Remove component-deploy.xml suffixes for
|
||||
* core and plugins; remove jar wildcard for cots
|
||||
* Feb 25, 2015 #3299 garmendariz Process a list of included features
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
|
@ -36,319 +39,367 @@ import com.raytheon.uf.featureexplorer.FeatureExplorer;
|
|||
|
||||
public class GenerateIncludesFromFeature extends Task {
|
||||
|
||||
protected String baseDirectories;
|
||||
protected String baseDirectories;
|
||||
|
||||
protected File baseDirectory;
|
||||
protected File baseDirectory;
|
||||
|
||||
protected File featureFile;
|
||||
protected File featureFile;
|
||||
|
||||
protected File cotsOut;
|
||||
protected File cotsOut;
|
||||
|
||||
protected File plugsOut;
|
||||
protected File plugsOut;
|
||||
|
||||
protected File coreOut;
|
||||
protected File coreOut;
|
||||
|
||||
protected File allOut;
|
||||
protected File allOut;
|
||||
|
||||
/* attributes for filtering */
|
||||
private static final String PATTERN = "^.*(%s).*$";
|
||||
protected String optionalDirectories;
|
||||
|
||||
protected String provider = "raytheon";
|
||||
/* attributes for filtering */
|
||||
private static final String PATTERN = "^.*(%s).*$";
|
||||
|
||||
private Pattern providerPattern = Pattern.compile(String.format(PATTERN,
|
||||
provider));
|
||||
protected String provider = "raytheon";
|
||||
|
||||
protected String plugin = "plugin";
|
||||
private Pattern providerPattern = Pattern.compile(String.format(PATTERN,
|
||||
provider));
|
||||
|
||||
private Pattern pluginPattern = Pattern.compile(String.format(PATTERN,
|
||||
plugin));
|
||||
protected String plugin = "plugin";
|
||||
|
||||
/**
|
||||
* @return the baseDirectories
|
||||
*/
|
||||
public String getBaseDirectories() {
|
||||
return baseDirectories;
|
||||
}
|
||||
private Pattern pluginPattern = Pattern.compile(String.format(PATTERN,
|
||||
plugin));
|
||||
|
||||
/**
|
||||
* @param baseDirectories
|
||||
* the baseDirectories to set
|
||||
*/
|
||||
public void setBaseDirectories(String baseDirectories) {
|
||||
this.baseDirectories = baseDirectories;
|
||||
}
|
||||
/**
|
||||
* @return the baseDirectories
|
||||
*/
|
||||
public String getBaseDirectories() {
|
||||
return baseDirectories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the component provider filter. This is a pipe (|) separated string
|
||||
* of names that identify a component as a non-COTS component. The default
|
||||
* provider filter is <em>raytheon</em>.
|
||||
*/
|
||||
public void setProviderFilter(String filter) {
|
||||
this.provider = filter;
|
||||
this.providerPattern = Pattern.compile(String.format("^.*(%s).*$",
|
||||
filter));
|
||||
}
|
||||
/**
|
||||
* @param baseDirectories
|
||||
* the baseDirectories to set
|
||||
*/
|
||||
public void setBaseDirectories(String baseDirectories) {
|
||||
this.baseDirectories = baseDirectories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the plug-in identifier filter. This is a pipe (|) separated string
|
||||
* of names that identify a component as an EDEX plug-in. The default
|
||||
* plug-in filter is <em>plugin</em>.
|
||||
*/
|
||||
public void setPluginFilter(String filter) {
|
||||
this.plugin = filter;
|
||||
this.pluginPattern = Pattern.compile(String
|
||||
.format("^.*(%s).*$", filter));
|
||||
}
|
||||
/**
|
||||
* @return the optionalDirectories
|
||||
*/
|
||||
public String getOptionalDirectories() {
|
||||
return optionalDirectories;
|
||||
}
|
||||
|
||||
public void setAllOut(File f) {
|
||||
this.allOut = f;
|
||||
}
|
||||
/**
|
||||
* @param optionalDirectories
|
||||
* the optionalDirectories to set
|
||||
*/
|
||||
public void setOptionalDirectories(String optionalDirectories) {
|
||||
this.optionalDirectories = optionalDirectories;
|
||||
}
|
||||
|
||||
public void setFeatureFile(File f) {
|
||||
this.featureFile = f;
|
||||
}
|
||||
/**
|
||||
* Sets the component provider filter. This is a pipe (|) separated string
|
||||
* of names that identify a component as a non-COTS component. The default
|
||||
* provider filter is <em>raytheon</em>.
|
||||
*/
|
||||
public void setProviderFilter(String filter) {
|
||||
this.provider = filter;
|
||||
this.providerPattern = Pattern.compile(String.format("^.*(%s).*$",
|
||||
filter));
|
||||
}
|
||||
|
||||
public void setCotsOut(File f) {
|
||||
this.cotsOut = f;
|
||||
}
|
||||
/**
|
||||
* Sets the plug-in identifier filter. This is a pipe (|) separated string
|
||||
* of names that identify a component as an EDEX plug-in. The default
|
||||
* plug-in filter is <em>plugin</em>.
|
||||
*/
|
||||
public void setPluginFilter(String filter) {
|
||||
this.plugin = filter;
|
||||
this.pluginPattern = Pattern.compile(String
|
||||
.format("^.*(%s).*$", filter));
|
||||
}
|
||||
|
||||
public void setPlugsOut(File f) {
|
||||
this.plugsOut = f;
|
||||
}
|
||||
public void setAllOut(File f) {
|
||||
this.allOut = f;
|
||||
}
|
||||
|
||||
public void setCoreOut(File f) {
|
||||
this.coreOut = f;
|
||||
}
|
||||
public void setFeatureFile(File f) {
|
||||
this.featureFile = f;
|
||||
}
|
||||
|
||||
public void setBaseDirectory(File aDir) {
|
||||
this.baseDirectory = aDir;
|
||||
}
|
||||
public void setCotsOut(File f) {
|
||||
this.cotsOut = f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main class called from ant. Tests to see if at least 1 includes file is
|
||||
* to be generated. Only generates includes that have been specified from
|
||||
* ant script. Throws BuildException if any error occurs, this halts the ant
|
||||
* build and displays the error.
|
||||
*
|
||||
*/
|
||||
public void execute() throws BuildException {
|
||||
public void setPlugsOut(File f) {
|
||||
this.plugsOut = f;
|
||||
}
|
||||
|
||||
log("provider filter=" + this.providerPattern.toString());
|
||||
log("plugin filter=" + this.pluginPattern.toString());
|
||||
public void setCoreOut(File f) {
|
||||
this.coreOut = f;
|
||||
}
|
||||
|
||||
ArrayList<File> components = getComponents();
|
||||
if (cotsOut == null && plugsOut == null && coreOut == null
|
||||
&& allOut == null)
|
||||
throw new BuildException(
|
||||
"Must supply destination for at least one includes file");
|
||||
if (featureFile == null)
|
||||
throw new BuildException("Must supply a feature.xml file");
|
||||
if (cotsOut != null)
|
||||
generateCots(components);
|
||||
if (plugsOut != null)
|
||||
generatePlugs(components);
|
||||
if (coreOut != null)
|
||||
generateCore(components);
|
||||
if (allOut != null)
|
||||
generateAll(components);
|
||||
}
|
||||
public void setBaseDirectory(File aDir) {
|
||||
this.baseDirectory = aDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an includes file for all components in the feature. The
|
||||
* directories in comps will be added to the includes file with a recursive
|
||||
* reg ex. This means that the director and all of its sub directories and
|
||||
* files will be included.
|
||||
*
|
||||
* @param comps
|
||||
*/
|
||||
protected void generateAll(ArrayList<File> comps) {
|
||||
log("Generating ALL list in " + this.allOut.getPath());
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new FileWriter(allOut));
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss z");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
out.println("## Feature includes file generated on "
|
||||
+ format.format(new Date()));
|
||||
/**
|
||||
* Main class called from ant. Tests to see if at least 1 includes file is
|
||||
* to be generated. Only generates includes that have been specified from
|
||||
* ant script. Throws BuildException if any error occurs, this halts the ant
|
||||
* build and displays the error.
|
||||
*
|
||||
*/
|
||||
public void execute() throws BuildException {
|
||||
|
||||
for (File f : comps) {
|
||||
out.println(f.getName() + "/**");
|
||||
}
|
||||
log(String.format("Identified %d ALL list entries", comps.size()));
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
log("provider filter=" + this.providerPattern.toString());
|
||||
log("plugin filter=" + this.pluginPattern.toString());
|
||||
|
||||
}
|
||||
ArrayList<File> components = getComponents();
|
||||
if (cotsOut == null && plugsOut == null && coreOut == null
|
||||
&& allOut == null)
|
||||
throw new BuildException(
|
||||
"Must supply destination for at least one includes file");
|
||||
if (featureFile == null)
|
||||
throw new BuildException("Must supply a feature.xml file");
|
||||
if (cotsOut != null)
|
||||
generateCots(components);
|
||||
if (plugsOut != null)
|
||||
generatePlugs(components);
|
||||
if (coreOut != null)
|
||||
generateCore(components);
|
||||
if (allOut != null)
|
||||
generateAll(components);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates a list of project directories with one directory for each
|
||||
* component stated in feature. This list is built based on manifest ids and
|
||||
* version compared to what is stated in the feature. These can differ
|
||||
* drastically from the name of project.
|
||||
*
|
||||
* @return a populated list of directories based off feature
|
||||
* @throws BuildException
|
||||
* if there are any problems accessing feature or finding
|
||||
* required components from feature.
|
||||
*/
|
||||
protected ArrayList<File> getComponents() throws BuildException {
|
||||
/**
|
||||
* Generates an includes file for all components in the feature. The
|
||||
* directories in comps will be added to the includes file with a recursive
|
||||
* reg ex. This means that the director and all of its sub directories and
|
||||
* files will be included.
|
||||
*
|
||||
* @param comps
|
||||
*/
|
||||
protected void generateAll(ArrayList<File> comps) {
|
||||
log("Generating ALL list in " + this.allOut.getPath());
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new FileWriter(allOut));
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss z");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
out.println("## Feature includes file generated on "
|
||||
+ format.format(new Date()));
|
||||
|
||||
ArrayList<File> rval = null;
|
||||
for (File f : comps) {
|
||||
out.println(f.getName() + "/**");
|
||||
}
|
||||
log(String.format("Identified %d ALL list entries", comps.size()));
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
FeatureExplorer fe = null;
|
||||
}
|
||||
|
||||
// list of directories overrides single directory
|
||||
if (baseDirectories != null) {
|
||||
String[] fileNames = baseDirectories.split(";");
|
||||
ArrayList<File> files = new ArrayList<File>(fileNames.length);
|
||||
for (String fName : fileNames) {
|
||||
File file = new File(fName);
|
||||
files.add(file);
|
||||
}
|
||||
fe = new FeatureExplorer(new WorkspaceFeatureSearch(files),
|
||||
new WorkspacePluginSearch(files));
|
||||
} else if (baseDirectory != null) {
|
||||
fe = new FeatureExplorer(baseDirectory, new WorkspaceFeatureSearch(
|
||||
baseDirectory), new WorkspacePluginSearch(baseDirectory));
|
||||
} else {
|
||||
throw new BuildException(
|
||||
"Did not have a baseDirectory or baseDirectories");
|
||||
}
|
||||
/**
|
||||
* Populates a list of project directories with one directory for each
|
||||
* component stated in feature. This list is built based on manifest ids and
|
||||
* version compared to what is stated in the feature. These can differ
|
||||
* drastically from the name of project.
|
||||
*
|
||||
* @return a populated list of directories based off feature
|
||||
* @throws BuildException
|
||||
* if there are any problems accessing feature or finding
|
||||
* required components from feature.
|
||||
*/
|
||||
protected ArrayList<File> getComponents() throws BuildException {
|
||||
|
||||
try {
|
||||
rval = fe.getPlugins(featureFile);
|
||||
} catch (FeatureException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
if (rval.isEmpty()) {
|
||||
throw new BuildException("Unable to access file " + featureFile);
|
||||
}
|
||||
ArrayList<File> rval = null;
|
||||
|
||||
return rval;
|
||||
}
|
||||
FeatureExplorer fe = null;
|
||||
|
||||
/**
|
||||
* Generates an includes file for all components (comps) having a project
|
||||
* directory name that does not match the {@link #setProviderFilter(String)
|
||||
* provider filter}. The project's manifest will be searched for a list of
|
||||
* jars to specify in the includes file. If the list is not present in the
|
||||
* manifest, the default is to include all *.jar files in the includes file.
|
||||
*
|
||||
* @param comps
|
||||
* The full list of feature specified components
|
||||
* @throws BuildException
|
||||
* if any IOException occurs
|
||||
*/
|
||||
protected void generateCots(ArrayList<File> comps) throws BuildException {
|
||||
log("Generating COTS list in " + this.cotsOut.getPath());
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new FileWriter(cotsOut));
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss z");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
out.println("## Cots includes file generated on "
|
||||
+ format.format(new Date()));
|
||||
int count = 0;
|
||||
for (File f : comps) {
|
||||
Matcher m = providerPattern.matcher(f.getName());
|
||||
if (!m.matches()) {
|
||||
out.println(f.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
log(String.format("Identified %d COTS list entries", count));
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<File> files = null;
|
||||
|
||||
/**
|
||||
* Generates an includes file for all components (comps) having a project
|
||||
* directory name that matches both the {@link #setProviderFilter(String)
|
||||
* provider filter} and the {@link #setPluginFilter(String) plug-in filter}.
|
||||
*
|
||||
* @param comps
|
||||
* The full list of feature specified components
|
||||
* @throws BuildException
|
||||
* if any IOException occurs
|
||||
*/
|
||||
protected void generatePlugs(ArrayList<File> comps) throws BuildException {
|
||||
log("Generating PLUGS list in " + this.plugsOut.getPath());
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new FileWriter(plugsOut));
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss z");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
out.println("## Plug-in includes file generated on "
|
||||
+ format.format(new Date()));
|
||||
int count = 0;
|
||||
for (File f : comps) {
|
||||
Matcher prm = providerPattern.matcher(f.getName());
|
||||
Matcher plm = pluginPattern.matcher(f.getName());
|
||||
if (prm.matches() && plm.matches()) {
|
||||
out.println(f.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
log(String.format("Identified %d PLUGS list entries", count));
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
File[] incFiles = null;
|
||||
|
||||
/**
|
||||
* Generates an includes file for all components (comps) having a project
|
||||
* directory name that matches the {@link #setProviderFilter(String)
|
||||
* provider filter} and does not match the {@link #setPluginFilter(String)
|
||||
* plug-in filter}.
|
||||
*
|
||||
* @param comps
|
||||
* The full list of feature specified components
|
||||
* @throws BuildException
|
||||
* if any IOException occurs
|
||||
*/
|
||||
protected void generateCore(ArrayList<File> comps) throws BuildException {
|
||||
log("Generating CORE list in " + this.coreOut.getPath());
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new FileWriter(coreOut));
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss z");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
out.println("## Core includes file generated on "
|
||||
+ format.format(new Date()));
|
||||
int count = 0;
|
||||
for (File f : comps) {
|
||||
Matcher prm = providerPattern.matcher(f.getName());
|
||||
Matcher plm = pluginPattern.matcher(f.getName());
|
||||
if (prm.matches() && !plm.matches()) {
|
||||
out.println(f.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
log(String.format("Identified %d CORE list entries", count));
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<File> includes = null;
|
||||
|
||||
// list of directories overrides single directory
|
||||
if (baseDirectories != null) {
|
||||
String[] fileNames = baseDirectories.split(";");
|
||||
files = new ArrayList<File>(fileNames.length);
|
||||
for (String fName : fileNames) {
|
||||
File file = new File(fName);
|
||||
files.add(file);
|
||||
}
|
||||
|
||||
if (optionalDirectories != null) {
|
||||
fileNames = optionalDirectories.split(";");
|
||||
includes = new ArrayList<File>();
|
||||
for (String fName : fileNames) {
|
||||
|
||||
File file = new File(fName);
|
||||
files.add(file);
|
||||
|
||||
// iterate through each optional dir to find edex features
|
||||
final Pattern p = Pattern.compile(".*edex.*feature");
|
||||
incFiles = file.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return p.matcher(file.getName()).matches();
|
||||
}
|
||||
});
|
||||
|
||||
if (incFiles != null) {
|
||||
includes.addAll(Arrays.asList(incFiles));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fe = new FeatureExplorer(new WorkspaceFeatureSearch(files),
|
||||
new WorkspacePluginSearch(files));
|
||||
} else if (baseDirectory != null) {
|
||||
fe = new FeatureExplorer(baseDirectory, new WorkspaceFeatureSearch(
|
||||
baseDirectory), new WorkspacePluginSearch(baseDirectory));
|
||||
} else {
|
||||
throw new BuildException(
|
||||
"Did not have a baseDirectory or baseDirectories");
|
||||
}
|
||||
|
||||
try {
|
||||
rval = fe.getPlugins(featureFile, includes);
|
||||
} catch (FeatureException e) {
|
||||
throw new BuildException(e);
|
||||
}
|
||||
if (rval.isEmpty()) {
|
||||
throw new BuildException("Unable to access file " + featureFile);
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an includes file for all components (comps) having a project
|
||||
* directory name that does not match the {@link #setProviderFilter(String)
|
||||
* provider filter}. The project's manifest will be searched for a list of
|
||||
* jars to specify in the includes file. If the list is not present in the
|
||||
* manifest, the default is to include all *.jar files in the includes file.
|
||||
*
|
||||
* @param comps
|
||||
* The full list of feature specified components
|
||||
* @throws BuildException
|
||||
* if any IOException occurs
|
||||
*/
|
||||
protected void generateCots(ArrayList<File> comps) throws BuildException {
|
||||
log("Generating COTS list in " + this.cotsOut.getPath());
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new FileWriter(cotsOut));
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss z");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
out.println("## Cots includes file generated on "
|
||||
+ format.format(new Date()));
|
||||
int count = 0;
|
||||
for (File f : comps) {
|
||||
Matcher m = providerPattern.matcher(f.getName());
|
||||
if (!m.matches()) {
|
||||
out.println(f.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
log(String.format("Identified %d COTS list entries", count));
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an includes file for all components (comps) having a project
|
||||
* directory name that matches both the {@link #setProviderFilter(String)
|
||||
* provider filter} and the {@link #setPluginFilter(String) plug-in filter}.
|
||||
*
|
||||
* @param comps
|
||||
* The full list of feature specified components
|
||||
* @throws BuildException
|
||||
* if any IOException occurs
|
||||
*/
|
||||
protected void generatePlugs(ArrayList<File> comps) throws BuildException {
|
||||
log("Generating PLUGS list in " + this.plugsOut.getPath());
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new FileWriter(plugsOut));
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss z");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
out.println("## Plug-in includes file generated on "
|
||||
+ format.format(new Date()));
|
||||
int count = 0;
|
||||
for (File f : comps) {
|
||||
Matcher prm = providerPattern.matcher(f.getName());
|
||||
Matcher plm = pluginPattern.matcher(f.getName());
|
||||
if (prm.matches() && plm.matches()) {
|
||||
out.println(f.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
log(String.format("Identified %d PLUGS list entries", count));
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an includes file for all components (comps) having a project
|
||||
* directory name that matches the {@link #setProviderFilter(String)
|
||||
* provider filter} and does not match the {@link #setPluginFilter(String)
|
||||
* plug-in filter}.
|
||||
*
|
||||
* @param comps
|
||||
* The full list of feature specified components
|
||||
* @throws BuildException
|
||||
* if any IOException occurs
|
||||
*/
|
||||
protected void generateCore(ArrayList<File> comps) throws BuildException {
|
||||
log("Generating CORE list in " + this.coreOut.getPath());
|
||||
PrintWriter out = null;
|
||||
try {
|
||||
out = new PrintWriter(new FileWriter(coreOut));
|
||||
SimpleDateFormat format = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss z");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
out.println("## Core includes file generated on "
|
||||
+ format.format(new Date()));
|
||||
int count = 0;
|
||||
for (File f : comps) {
|
||||
Matcher prm = providerPattern.matcher(f.getName());
|
||||
Matcher plm = pluginPattern.matcher(f.getName());
|
||||
if (prm.matches() && !plm.matches()) {
|
||||
out.println(f.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
log(String.format("Identified %d CORE list entries", count));
|
||||
} catch (IOException e) {
|
||||
throw new BuildException(e);
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
@ -36,253 +37,271 @@ import com.raytheon.uf.featureexplorer.search.IPluginSearch;
|
|||
* Oct 10, 2008 SP#15 bclement Added static functions for reading manifests
|
||||
* Feb 4, 2013 #1577 bkowal Verify that a plugin has not been included in more than one feature.
|
||||
* May 22, 2013 #1927 bkowal Fix improper String comparison
|
||||
* Feb 25, 2015 #3299 garmendariz Process a list of included features
|
||||
* </pre>
|
||||
*
|
||||
* @author dglazesk
|
||||
* @version 1.0
|
||||
*/
|
||||
public class FeatureExplorer {
|
||||
/**
|
||||
* This holds the feature searching object for the class.
|
||||
*/
|
||||
protected IFeatureSearch featureSearch;
|
||||
/**
|
||||
* This holds the feature searching object for the class.
|
||||
*/
|
||||
protected IFeatureSearch featureSearch;
|
||||
|
||||
/**
|
||||
* This holds the plugin searching object for the class.
|
||||
*/
|
||||
protected IPluginSearch pluginSearch;
|
||||
/**
|
||||
* This holds the plugin searching object for the class.
|
||||
*/
|
||||
protected IPluginSearch pluginSearch;
|
||||
|
||||
/**
|
||||
* This holds the feature file object should the user choose to set it.
|
||||
*/
|
||||
protected File feature = null;
|
||||
/**
|
||||
* This holds the feature file object should the user choose to set it.
|
||||
*/
|
||||
protected File feature = null;
|
||||
|
||||
private Map<String, File> pluginLookupMap = new HashMap<String, File>();
|
||||
private Map<String, File> pluginLookupMap = new HashMap<String, File>();
|
||||
|
||||
/**
|
||||
* This constructor allows a user to setup what the feature for this
|
||||
* instance is. This allows the user to use getPlugins(), though the other
|
||||
* methods are still available.
|
||||
*
|
||||
* @param aFeature
|
||||
* File object for the feature for this instance
|
||||
* @param aFeatureSearch
|
||||
* The object that can search for features
|
||||
* @param aPluginSearh
|
||||
* The object that can search for plugins
|
||||
*/
|
||||
public FeatureExplorer(File aFeature, IFeatureSearch aFeatureSearch,
|
||||
IPluginSearch aPluginSearh) {
|
||||
featureSearch = aFeatureSearch;
|
||||
pluginSearch = aPluginSearh;
|
||||
feature = aFeature;
|
||||
}
|
||||
/**
|
||||
* This constructor allows a user to setup what the feature for this
|
||||
* instance is. This allows the user to use getPlugins(), though the other
|
||||
* methods are still available.
|
||||
*
|
||||
* @param aFeature
|
||||
* File object for the feature for this instance
|
||||
* @param aFeatureSearch
|
||||
* The object that can search for features
|
||||
* @param aPluginSearh
|
||||
* The object that can search for plugins
|
||||
*/
|
||||
public FeatureExplorer(File aFeature, IFeatureSearch aFeatureSearch,
|
||||
IPluginSearch aPluginSearh) {
|
||||
featureSearch = aFeatureSearch;
|
||||
pluginSearch = aPluginSearh;
|
||||
feature = aFeature;
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor sets up the classes that will be used for searching for
|
||||
* plugins and features. It is expected that a user will use
|
||||
* getPlugins(File) or getPlugins(String) later when getting the plugins.
|
||||
*
|
||||
* @param aFeatureSearch
|
||||
* The object that can search for features
|
||||
* @param aPluginSearh
|
||||
* The object that can search for plugins
|
||||
*/
|
||||
public FeatureExplorer(IFeatureSearch aFeatureSearch,
|
||||
IPluginSearch aPluginSearh) {
|
||||
featureSearch = aFeatureSearch;
|
||||
pluginSearch = aPluginSearh;
|
||||
}
|
||||
/**
|
||||
* This constructor sets up the classes that will be used for searching for
|
||||
* plugins and features. It is expected that a user will use
|
||||
* getPlugins(File) or getPlugins(String) later when getting the plugins.
|
||||
*
|
||||
* @param aFeatureSearch
|
||||
* The object that can search for features
|
||||
* @param aPluginSearh
|
||||
* The object that can search for plugins
|
||||
*/
|
||||
public FeatureExplorer(IFeatureSearch aFeatureSearch,
|
||||
IPluginSearch aPluginSearh) {
|
||||
featureSearch = aFeatureSearch;
|
||||
pluginSearch = aPluginSearh;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a convenience method for when the feature file object is set in a
|
||||
* constructor.
|
||||
*
|
||||
* @return The list of files in the feature for this instance
|
||||
* @throws FeatureException
|
||||
*/
|
||||
public ArrayList<File> getPlugins() throws FeatureException {
|
||||
return getPlugins(feature);
|
||||
}
|
||||
/**
|
||||
* This is a convenience method for when the feature file object is set in a
|
||||
* constructor.
|
||||
*
|
||||
* @return The list of files in the feature for this instance
|
||||
* @throws FeatureException
|
||||
*/
|
||||
public ArrayList<File> getPlugins() throws FeatureException {
|
||||
return getPlugins(feature, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is just a convenience method for getting plugins from a feature.
|
||||
* This is equivalent to doing getPlugins(new File(aPath)).
|
||||
*
|
||||
* @param aPath
|
||||
* Path to the feature.xml file to be scanned
|
||||
* @return The list of file objects for all of the plugins in the feature
|
||||
* @throws FeatureException
|
||||
*/
|
||||
public ArrayList<File> getPlugins(String aPath) throws FeatureException {
|
||||
File feat = new File(aPath);
|
||||
return getPlugins(feat);
|
||||
}
|
||||
/**
|
||||
* This is just a convenience method for getting plugins from a feature.
|
||||
* This is equivalent to doing getPlugins(new File(aPath)).
|
||||
*
|
||||
* @param aPath
|
||||
* Path to the feature.xml file to be scanned
|
||||
* @return The list of file objects for all of the plugins in the feature
|
||||
* @throws FeatureException
|
||||
*/
|
||||
public ArrayList<File> getPlugins(String aPath, ArrayList<File> incList)
|
||||
throws FeatureException {
|
||||
File feat = new File(aPath);
|
||||
return getPlugins(feat, incList);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function attempts to find all of the plugins associated with the
|
||||
* feature. This includes recursing into any included features and grabbing
|
||||
* their plugins.
|
||||
*
|
||||
* @param aFeature
|
||||
* The file object for the feature to be scanned
|
||||
* @return The list of file objects for the located plugins
|
||||
* @throws FeatureException
|
||||
*/
|
||||
public ArrayList<File> getPlugins(File aFeature) throws FeatureException {
|
||||
ArrayList<File> rval = new ArrayList<File>();
|
||||
/**
|
||||
* This function attempts to find all of the plugins associated with the
|
||||
* feature. This includes recursing into any included features and grabbing
|
||||
* their plugins.
|
||||
*
|
||||
* @param aFeature
|
||||
* The file object for the feature to be scanned
|
||||
* @param incList
|
||||
* @return The list of file objects for the located plugins
|
||||
* @throws FeatureException
|
||||
*/
|
||||
public ArrayList<File> getPlugins(File aFeature, ArrayList<File> incList)
|
||||
throws FeatureException {
|
||||
ArrayList<File> rval = new ArrayList<File>();
|
||||
|
||||
HashMap<String, File> plugins = getFeaturePlugins(aFeature);
|
||||
rval = new ArrayList<File>(plugins.values());
|
||||
HashMap<String, File> plugins = getFeaturePlugins(aFeature, incList);
|
||||
rval = new ArrayList<File>(plugins.values());
|
||||
|
||||
return rval;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* This finds all of the plugins listed in a feature and maps their ids to
|
||||
* their file system locations as file objects. This is the function that
|
||||
* does the brunt of the work in locating the plugins.
|
||||
*
|
||||
* @param aFile
|
||||
* The feature file that is being scanned
|
||||
* @return A hash map that links the plugin id to its file system location
|
||||
* @throws FeatureException
|
||||
* If there are any problems with JAXB, a feature cannot be
|
||||
* found, or a plugin cannot be found
|
||||
*/
|
||||
protected HashMap<String, File> getFeaturePlugins(File aFile)
|
||||
throws FeatureException {
|
||||
HashMap<String, File> rval = new HashMap<String, File>();
|
||||
if (aFile == null || !aFile.exists() || !aFile.canRead())
|
||||
return rval;
|
||||
/**
|
||||
* This finds all of the plugins listed in a feature and maps their ids to
|
||||
* their file system locations as file objects. This is the function that
|
||||
* does the brunt of the work in locating the plugins.
|
||||
*
|
||||
* @param aFile
|
||||
* The feature file that is being scanned
|
||||
* @param incList
|
||||
* @return A hash map that links the plugin id to its file system location
|
||||
* @throws FeatureException
|
||||
* If there are any problems with JAXB, a feature cannot be
|
||||
* found, or a plugin cannot be found
|
||||
*/
|
||||
protected HashMap<String, File> getFeaturePlugins(File aFile,
|
||||
ArrayList<File> incList) throws FeatureException {
|
||||
HashMap<String, File> rval = new HashMap<String, File>();
|
||||
if (aFile == null || !aFile.exists() || !aFile.canRead())
|
||||
return rval;
|
||||
|
||||
Feature feat = null;
|
||||
try {
|
||||
JAXBContext jc = JAXBContext.newInstance(Feature.class);
|
||||
Unmarshaller unmarshaller = jc.createUnmarshaller();
|
||||
feat = (Feature) unmarshaller.unmarshal(aFile);
|
||||
} catch (Exception e) {
|
||||
throw new FeatureException("Unable to unmarshal file " + aFile, e);
|
||||
}
|
||||
Feature feat = null;
|
||||
try {
|
||||
JAXBContext jc = JAXBContext.newInstance(Feature.class);
|
||||
Unmarshaller unmarshaller = jc.createUnmarshaller();
|
||||
feat = (Feature) unmarshaller.unmarshal(aFile);
|
||||
} catch (Exception e) {
|
||||
throw new FeatureException("Unable to unmarshal file " + aFile, e);
|
||||
}
|
||||
|
||||
for (Includes include : feat.getIncludes()) {
|
||||
// go through all of the included features and try to find them
|
||||
List<File> features = featureSearch.findFeature(include.getId(),
|
||||
include.getVersion());
|
||||
try {
|
||||
// get all of the plugin id to file objects and add them
|
||||
rval.putAll(getFeaturePlugins(features.get(0)));
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
if (!include.getOptional()) {
|
||||
// this means we received an empty list, no feature found
|
||||
throw new FeatureException("Could not find feature "
|
||||
+ include.getId() + " with version greater than "
|
||||
+ include.getVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
// if additional includes are passed in, add them for processing
|
||||
if (incList != null && feat != null) {
|
||||
List<Includes> featList = feat.getIncludes();
|
||||
|
||||
for (Plugin plugin : feat.getPlugins()) {
|
||||
// go through all of the mentioned plugins
|
||||
List<File> plugs = pluginSearch.findPlugin(plugin.getId(),
|
||||
plugin.getVersion());
|
||||
try {
|
||||
if (this.pluginLookupMap.containsKey(plugin.getId())
|
||||
&& !this.pluginLookupMap.get(plugin.getId()).equals(aFile)) {
|
||||
StringBuilder stringBuilder = new StringBuilder("Plugin ");
|
||||
stringBuilder.append(plugin.getId());
|
||||
stringBuilder.append(" is in Feature ");
|
||||
stringBuilder.append(this.generateFeatureFileName(
|
||||
aFile.getParent(), aFile.getName()));
|
||||
stringBuilder.append(" and Feature ");
|
||||
stringBuilder
|
||||
.append(this.generateFeatureFileName(
|
||||
this.pluginLookupMap.get(plugin.getId())
|
||||
.getParent(), this.pluginLookupMap
|
||||
.get(plugin.getId()).getName()));
|
||||
stringBuilder.append("!");
|
||||
throw new FeatureException(stringBuilder.toString());
|
||||
}
|
||||
for (Iterator<File> iterator = incList.iterator(); iterator
|
||||
.hasNext();) {
|
||||
File incFile = (File) iterator.next();
|
||||
featList.add(new Includes(incFile.getName(), "0.0.0", false));
|
||||
}
|
||||
|
||||
// add the plugin id and its file object to the map
|
||||
rval.put(plugin.getId(), plugs.get(0));
|
||||
this.pluginLookupMap.put(plugin.getId(), aFile);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// this means we received an empty list, no plugin found
|
||||
throw new FeatureException("Could not find plugin "
|
||||
+ plugin.getId() + " with version greater than "
|
||||
+ plugin.getVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
for (Includes include : feat.getIncludes()) {
|
||||
// go through all of the included features and try to find them
|
||||
List<File> features = featureSearch.findFeature(include.getId(),
|
||||
include.getVersion());
|
||||
try {
|
||||
// get all of the plugin id to file objects and add them
|
||||
rval.putAll(getFeaturePlugins(features.get(0), null));
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
if (!include.getOptional()) {
|
||||
// this means we received an empty list, no feature found
|
||||
throw new FeatureException("Could not find feature "
|
||||
+ include.getId() + " with version greater than "
|
||||
+ include.getVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String generateFeatureFileName(String parentPath, String fileName) {
|
||||
String[] pathElements = parentPath.split(File.separator);
|
||||
return pathElements[pathElements.length - 1] + File.separator
|
||||
+ fileName;
|
||||
}
|
||||
for (Plugin plugin : feat.getPlugins()) {
|
||||
// go through all of the mentioned plugins
|
||||
List<File> plugs = pluginSearch.findPlugin(plugin.getId(),
|
||||
plugin.getVersion());
|
||||
try {
|
||||
if (this.pluginLookupMap.containsKey(plugin.getId())
|
||||
&& !this.pluginLookupMap.get(plugin.getId()).equals(
|
||||
aFile)) {
|
||||
StringBuilder stringBuilder = new StringBuilder("Plugin ");
|
||||
stringBuilder.append(plugin.getId());
|
||||
stringBuilder.append(" is in Feature ");
|
||||
stringBuilder.append(this.generateFeatureFileName(
|
||||
aFile.getParent(), aFile.getName()));
|
||||
stringBuilder.append(" and Feature ");
|
||||
stringBuilder
|
||||
.append(this.generateFeatureFileName(
|
||||
this.pluginLookupMap.get(plugin.getId())
|
||||
.getParent(), this.pluginLookupMap
|
||||
.get(plugin.getId()).getName()));
|
||||
stringBuilder.append("!");
|
||||
throw new FeatureException(stringBuilder.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches a project's manifest for a specific attribute. The returned list
|
||||
* will contain all values for the attribute or empty if not found.
|
||||
*
|
||||
* @param projectRoot
|
||||
* @param attrib
|
||||
* @return a list of a values for the attribute or an empty list if not
|
||||
* found
|
||||
* @throws IOException
|
||||
*/
|
||||
public static List<String> readManifest(File projectRoot, String attrib)
|
||||
throws IOException {
|
||||
File maniFile = new File(projectRoot, "/META-INF/MANIFEST.MF");
|
||||
Manifest m = null;
|
||||
List<String> rval = new ArrayList<String>();
|
||||
// add the plugin id and its file object to the map
|
||||
rval.put(plugin.getId(), plugs.get(0));
|
||||
this.pluginLookupMap.put(plugin.getId(), aFile);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// this means we received an empty list, no plugin found
|
||||
throw new FeatureException("Could not find plugin "
|
||||
+ plugin.getId() + " with version greater than "
|
||||
+ plugin.getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
m = new Manifest();
|
||||
// we only care if the manifest actually exists
|
||||
InputStream is = new FileInputStream(maniFile);
|
||||
m.read(is);
|
||||
is.close();
|
||||
return rval;
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new IOException(
|
||||
"IO Error while reading manifest for project: "
|
||||
+ projectRoot.getName());
|
||||
}
|
||||
private String generateFeatureFileName(String parentPath, String fileName) {
|
||||
String[] pathElements = parentPath.split(File.separator);
|
||||
return pathElements[pathElements.length - 1] + File.separator
|
||||
+ fileName;
|
||||
}
|
||||
|
||||
// if we get this far, m shouldn't be null
|
||||
if (m != null) {
|
||||
Attributes attribs = m.getMainAttributes();
|
||||
String deploys = attribs.getValue(attrib);
|
||||
/**
|
||||
* Searches a project's manifest for a specific attribute. The returned list
|
||||
* will contain all values for the attribute or empty if not found.
|
||||
*
|
||||
* @param projectRoot
|
||||
* @param attrib
|
||||
* @return a list of a values for the attribute or an empty list if not
|
||||
* found
|
||||
* @throws IOException
|
||||
*/
|
||||
public static List<String> readManifest(File projectRoot, String attrib)
|
||||
throws IOException {
|
||||
File maniFile = new File(projectRoot, "/META-INF/MANIFEST.MF");
|
||||
Manifest m = null;
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
// manifests that do not have a deploy entry will return a wildcard
|
||||
if (deploys != null) {
|
||||
for (String s : deploys.split(",")) {
|
||||
rval.add(s.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
try {
|
||||
m = new Manifest();
|
||||
// we only care if the manifest actually exists
|
||||
InputStream is = new FileInputStream(maniFile);
|
||||
m.read(is);
|
||||
is.close();
|
||||
|
||||
/**
|
||||
* Reads the manifest for the project and returns all values for the
|
||||
* "Edex-Deploy" attribute. If the attribute could not be found, default to
|
||||
* returning a wildcard for all jars.
|
||||
*
|
||||
* @param projectRoot
|
||||
* @return a list of jar names or a wildcard for all jars if attribute not
|
||||
* found
|
||||
* @throws IOException
|
||||
*/
|
||||
public static List<String> getJars(File projectRoot) throws IOException {
|
||||
List<String> rval = readManifest(projectRoot, "Edex-Deploy");
|
||||
if (rval.isEmpty()) {
|
||||
rval.add("*.jar");
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new IOException(
|
||||
"IO Error while reading manifest for project: "
|
||||
+ projectRoot.getName());
|
||||
}
|
||||
|
||||
// if we get this far, m shouldn't be null
|
||||
if (m != null) {
|
||||
Attributes attribs = m.getMainAttributes();
|
||||
String deploys = attribs.getValue(attrib);
|
||||
|
||||
// manifests that do not have a deploy entry will return a wildcard
|
||||
if (deploys != null) {
|
||||
for (String s : deploys.split(",")) {
|
||||
rval.add(s.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the manifest for the project and returns all values for the
|
||||
* "Edex-Deploy" attribute. If the attribute could not be found, default to
|
||||
* returning a wildcard for all jars.
|
||||
*
|
||||
* @param projectRoot
|
||||
* @return a list of jar names or a wildcard for all jars if attribute not
|
||||
* found
|
||||
* @throws IOException
|
||||
*/
|
||||
public static List<String> getJars(File projectRoot) throws IOException {
|
||||
List<String> rval = readManifest(projectRoot, "Edex-Deploy");
|
||||
if (rval.isEmpty()) {
|
||||
rval.add("*.jar");
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue