JdbcMapper/samples/controls-webservices-blank/build.xml

222 lines
9.6 KiB
XML
Raw Normal View History

<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
$Header:$
-->
<project name="controls-webservices-blank" basedir="." default="usage">
<property environment="os"/>
<property file="build.properties"/>
<import file="${beehive.home}/beehive-imports.xml"/>
<import file="${beehive.home}/ant/beehive-tools.xml"/>
<property name="junit.source.dir" location="junit"/>
<property name="build.dir" location="build"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.beansrc" location="${build.dir}/beansrc"/>
<property name="lib.dir" location="lib"/>
<!-- Service control specific properties -->
<property name="gen.source.dir" location="${build.dir}/jcxsrc"/>
<property name="my.service.control.package" value="mypackage"/>
<property name="schema.dir" location="schemas"/>
<property name="xmlbean.type.gen.dir" location="${build.dir}/xmlbeantypes"/>
<property name="build.jar" value="myservicecontrols.jar"/>
<property name="test.logs" location="logs"/>
<property name="junit.build.dir" location="${build.dir}/junitclasses"/>
<property name="junit.build.beansrc" location="${build.dir}/junitbeansrc"/>
<path id="build.classpath">
<fileset dir="${lib.dir}" includes="*.jar"/>
<pathelement location="${build.classes}"/>
</path>
<path id="run.classpath">
<fileset dir="${lib.dir}" includes="*.jar"/>
<pathelement location="${servlet-api.jar}"/>
<pathelement location="${jsp-api.jar}"/>
<pathelement path="${build.dir}/${build.jar}"/>
<pathelement path="${junit.build.dir}"/>
</path>
<target name="clean" description="Delete all generated files">
<delete dir="${build.dir}"/>
<delete file="velocity.log"/>
<delete dir="${test.logs}"/>
<delete dir="${lib.dir}"/>
</target>
<target name="dirs">
<mkdir dir="${build.classes}"/>
<mkdir dir="${lib.dir}"/>
<mkdir dir="${build.beansrc}"/>
<mkdir dir="${xmlbean.type.gen.dir}"/>
<mkdir dir="${test.logs}"/>
<mkdir dir="${junit.build.dir}"/>
<mkdir dir="${junit.build.beansrc}"/>
<mkdir dir="${gen.source.dir}"/>
</target>
<!-- copy all dependencies -->
<target name="deploy-beehive" depends="dirs">
<deploy-controls destDir="${lib.dir}"/>
<copy todir="${lib.dir}">
<fileset file="${beehive.home}/lib/wsm/*.jar"/>
<fileset file="${beehive.home}/lib/common/*.jar"/>
<fileset file="${beehive.home}/lib/controls/beehive-webservice-control.jar"/>
</copy>
</target>
<target name="build" depends="gen-svc-ctrl" description="Build control sources">
<build-controls srcdir="${gen.source.dir}" destdir="${build.classes}" tempdir="${build.beansrc}" classpathref="build.classpath"/>
<!-- have the wsdls, in the same dir as the jcx files -->
<copy todir="${build.classes}">
<fileset dir="${gen.source.dir}/">
<include name="**/*.wsdl"/>
</fileset>
</copy>
<control-jar destfile="${build.dir}/${build.jar}" basedir="${build.classes}"/>
</target>
<!-- Generate the service control, should run after types have been generated. -->
<target name="gen-svc-ctrl" depends="gen-types">
<path id="wscgen.dependencies">
<path refid="build.classpath"/>
<pathelement location="${build.classes}"/>
</path>
<taskdef name="webservice-control-gen"
classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
classpathref="wscgen.dependencies"/>
<webservice-control-gen wsdlsrc="${schema.dir}" destdir="${gen.source.dir}" destPackageName="${my.service.control.package}"/>
<!-- have the wsdls, in the same dir as the jcx files -->
<copy todir="${gen.source.dir}/${my.service.control.package}">
<fileset dir="${schema.dir}">
<include name="**/*.wsdl"/>
</fileset>
</copy>
</target>
<!-- Generate types for the WSDL and Scheams -->
<!--
***********************************************************************************
NOTE: The type generation uses Apache XMLBeans compiler. The Compiler doesn't support RPC/Encoded style.
To generate types for RPC/Encoded web service you need to use Axis's tools.
<property name="encoded.schema.dir" value="rpc-schemas"/>
<property name="encoded.type.gen.dir" value="${build.dir}/encodedtypes"/>
<target name="gen-axis-types" depends="check-axis-types, dirs" unless="gen-axis-types-are-uptodate">
<taskdef name="encodedtypegen" classname="org.apache.beehive.wsm.axis.ant.AxisTypeGeneratorTask">
<classpath>
<path refid="build.classpath"/>
</classpath>
</taskdef>
<encodedtypegen wsdldir="${encoded.schema.dir}" outputdir="${encoded.type.gen.dir}"/>
<javac srcdir="${encoded.type.gen.dir}" destdir="${build.classes}" classpathref="build.classpath" debug="true"/>
</target>
<target name="check-axis-types">
<uptodate property="gen-axis-types-are-uptodate" targetfile="${encoded.type.gen.dir}">
<srcfiles dir="${encoded.schema.dir}" includes="*.wsdl"/>
</uptodate>
</target>
***********************************************************************************
-->
<target name="gen-types" depends="checktypes,deploy-beehive,dirs" unless="gen-types-are-uptodate">
<!-- XMLBean build -->
<taskdef name="xmlbeanbuild" classname="org.apache.xmlbeans.impl.tool.XMLBean">
<classpath>
<path refid="xbean.dependency.path"/>
</classpath>
</taskdef>
<xmlbeanbuild schema="${schema.dir}" srcgendir="${xmlbean.type.gen.dir}" classgendir="${build.classes}" failonerror="true">
<classpath>
<path refid="build.classpath"/>
</classpath>
</xmlbeanbuild>
</target>
<target name="checktypes">
<uptodate property="gen-types-are-uptodate" targetfile="${xmlbean.type.gen.dir}">
<srcfiles dir="${schema.dir}" includes="*.wsdl,*.xsd"/>
</uptodate>
</target>
<!-- Build the junit tests -->
<target name="build.junit" depends="build">
<build-controls srcdir="${junit.source.dir}" destdir="${junit.build.dir}" tempdir="${junit.build.beansrc}" classpathref="run.classpath"/>
<!-- have the wsdls, in the same dir as the jcx files -->
<copy todir="${junit.build.dir}">
<fileset dir="${junit.source.dir}">
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<target name="run.junit" depends="build.junit">
<echo message="** junit logfiles written to ${test.logs} **"/>
<junit failureproperty="testfailed" printsummary="on" tempdir="${junit.build.dir}" fork="yes">
<classpath>
<path refid="run.classpath"/>
</classpath>
<formatter type="plain"/>
<batchtest filtertrace="off" todir="${test.logs}">
<fileset dir="${junit.source.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<fail if="testfailed" message="One or more tests failed. The unit test requires
the wsm-addressbook-enhanced web serivce to be running. Please verify
that http://localhost:8080/EnhancedAddressBook/ is available before trying the unit testing.
See the documentation at http://beehive.apache.org/ for instructions on running the sample"/>
</target>
<target name="usage" description="Print the usage for this build.xml">
<echo message=""/>
<echo message=""/>
<echo message="Service Controls Project Template Build file"/>
<echo message=""/>
<echo message=""/>
<echo message="----------------------------------------------------------------"/>
<echo message="| Standard Targets |"/>
<echo message="----------------------------------------------------------------"/>
<echo message="clean - Delete all generated files"/>
<echo message="build - Build control sources"/>
<echo message="gen-types - Just generate the types from schemas"/>
<echo message="run.junit - Run Junit tests for the service control"/>
<echo message="----------------------------------------------------------------"/>
</target>
</project>