blob: 9be8eaeef2e130252e2c7d68003acb18968d4a66 [file] [log] [blame]
<project name="CXF package and deploy" default="deploy">
<!--
JAX-RS TCK package target: package JAX-RS TCK test application into web archive
resource.classes: specified in individual test's build.xml,
contains all resource class used in the test
app.name: specified in individual test's build.xml,
is used for web archive name: ${app.name}_web.war
is also used in web application's context root:
${app.name}_web
web.xml: located in individual test's directory.
Is web application's deployment descriptor.
class.dir: TCK's class directory. Located at $TS_HOME/classes
servlet_adaptor: specified in $TS_HOME/bin/ts.jte.
Required by JAX-RS specification to run in servlet container,
it is imeplementation specific.
appconfig.class: specified in individual test's build.xml.
Required by JAX-RS spec to list all resources in the test application.
-->
<!--
JAX-RS TCK deploy target: Deploy JAX-RS web archive
webapp.dir: autodeploy directory for web application
-->
<import file="../../ts.top.import.xml"/>
<target name="pre.deploy">
<fileset id="all.jaxrs.src.dirs" dir="${ts.home}/src" includes="**/web.xml.template"/>
<property name="prop.all.jaxrs.src.dirs" refid="all.jaxrs.src.dirs"/>
<propertyregex property="all.jaxrs.tests.dir"
input="${prop.all.jaxrs.src.dirs}"
regexp="[\/|\\]web.xml.template"
replace=""
casesensitive="false"/>
<!-- It seems the separator can be != path.separator -->
<propertyregex property="all.jaxrs.tests.dir.correct.separator"
input="${all.jaxrs.tests.dir}"
regexp=";"
replace="${path.separator}"
casesensitive="false"/>
<foreach list="${all.jaxrs.tests.dir.correct.separator}"
delimiter="${path.separator}"
target="all_action"
param="pkg.dir"/>
</target>
<target name="check.web.xml">
<available file="${ts.home}/src/${pkg.dir}/web.xml.template" property="exist.web.xml"/>
</target>
<target name="all_action" depends="update_servlet_adaptor,copywar"/>
<target name="update_servlet_adaptor" depends="check.web.xml" if="exist.web.xml">
<echo message=">>> Servlet adaptor class ${servlet_adaptor}"/>
<!--
Create implementation specific web with servlet information
-->
<copy file="${ts.home}/src/${pkg.dir}/web.xml.template" verbose="true"
tofile="${ts.home}/dist/${pkg.dir}/web.xml.${jaxrs_impl_name}"/>
<replace file="${ts.home}/dist/${pkg.dir}/web.xml.${jaxrs_impl_name}" value="${servlet_adaptor}" summary="yes">
<replacetoken>servlet_adaptor</replacetoken>
</replace>
<!--
Create implementation specfic war files with
updated web.xml;
servlet class;
-->
<antcall target="updatewar"/>
</target>
<target name="get.app.name">
<fileset id="dist.contents" dir="${ts.home}/dist/${pkg.dir}" includes="jaxrs*.war.template"/>
<property name="prop.dist.contents" refid="dist.contents"/>
<propertyregex property="app.name"
input="${prop.dist.contents}"
regexp="_web.war.template$"
replace=""/>
</target>
<target name="updatewar" depends="get.app.name" if="app.name">
<!-- Copy web.war.template to web.war.cxf -->
<jar destfile="${ts.home}/dist/${pkg.dir}/${app.name}_web.war.${jaxrs_impl_name}" update="true">
<zipfileset src="${ts.home}/dist/${pkg.dir}/${app.name}_web.war.template"
excludes="WEB-INF/web.xml"/>
</jar>
<!-- Copy web.xml to web.war.cxf -->
<jar destfile="${ts.home}/dist/${pkg.dir}/${app.name}_web.war.${jaxrs_impl_name}" update="true">
<zipfileset dir="${ts.home}/dist/${pkg.dir}"
includes="web.xml.${jaxrs_impl_name}"
fullpath="WEB-INF/web.xml"/>
</jar>
<copy failonerror="false" verbose="true"
file="${dist.dir}/${pkg.dir}/${app.name}_web.war.${jaxrs_impl_name}"
tofile="${dist.dir}/${pkg.dir}/${app.name}_web.war"/>
</target>
<!-- for 3.0 servlet wars without web.xml -->
<target name="copywar" depends="check.web.xml,get.app.name" if="app.name" unless="exist.web.xml">
<copy failonerror="false" verbose="true"
file="${dist.dir}/${pkg.dir}/${app.name}_web.war.template"
tofile="${dist.dir}/${pkg.dir}/${app.name}_web.war"/>
</target>
</project>