summaryrefslogtreecommitdiffstats
path: root/tags/cpp-0.1.incubating-M1-RC3a/sca/tools/scagen/build.xml
blob: 1b8e66e50a1fb6ffa66d533698bc4dd8cbf86f9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2006 The Apache Software Foundation or its licensors, as applicable.

  Licensed 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.
 -->

<project name="org.apache.tuscany.sca.cpp.tools" default="all" basedir=".">

    <target name="init">
        <property name="build.result.folder" value="${basedir}/bld" />
        <property name="temp.folder" value="${basedir}/tmp" />
        <property name="junit.jar.folder" value="${basedir}/lib" />
        <property name="tool.name" value="scagen" />
        <property name="bin.dir" value="${basedir}/../../deploy/bin" />
    </target>

    <!-- Add "test" to the depends list below to add auto-testing to the build -->
    <!-- a junit.jar is needed at ${junit.jar.folder}/junit.jar though         -->
    <target name="all" depends="init,jars,doc,scripts,zip.all">
    </target>

    <target name="test" depends="init,jars,test.jar">
        <java classname="org.apache.tuscany.sca.cpp.tools.junit.TestAllModulesTest">
            <classpath>
                <pathelement location="${build.result.folder}/test.jar" />
                <pathelement location="${junit.jar.folder}/junit.jar" />
                <pathelement location="${build.result.folder}/scagen.jar" />
                <pathelement path="${java.class.path}" />
            </classpath>
        </java>
    </target>



    <target name="doc">
        <javadoc packagenames="org.apache.tuscany.sca.cpp.tools.*" sourcepath="src" defaultexcludes="yes" destdir="docs/api" author="true" version="true" use="true" windowtitle="SCA for C++ Tools">
            <doctitle>
                <![CDATA[<h1>SCA for C++ Tools</h1>]]>
            </doctitle>
        <bottom>
            <![CDATA[<i>Copyright 2005 The Apache Software Foundation or its licensors, as applicable.</i>]]></bottom>
    <group title="C++ Parser" packages="org.apache.tuscany.sca.cpp.tools.common" />
    <group title="SCA Services Generator" packages="org.apache.tuscany.sca.cpp.tools.services" />
    <link offline="true" href="http://java.sun.com/products/jdk/1.2/docs/api/" packagelistLoc="C:\tmp" />
</javadoc>
</target>

<target name="jars" depends="init, scagen.jar, src.jar">
</target>

<target name="scripts" depends="init">
<mkdir dir="${build.result.folder}" />
<copy file="scagen.cmd" todir="${build.result.folder}" />
<copy file="scagen.sh" todir="${build.result.folder}" />
</target>



<target name="src.jar" depends="init">
<delete dir="${temp.folder}/src.jar.bin" />
<mkdir dir="${temp.folder}/src.jar.bin" />
<!-- Copy necessary resources i.e XSL stylesheets, test input etc
             for the src jar too
         -->
<copy todir="${temp.folder}/src.jar.bin" failonerror="true">
    <fileset dir="src/" />
</copy>
<mkdir dir="${build.result.folder}" />
<jar jarfile="${build.result.folder}/src.jar" basedir="${temp.folder}/src.jar.bin" />
<delete dir="${temp.folder}/test.jar.bin" />
</target>

<target name="test.jar" depends="init, scagen.jar" unless="test.jar" description="Create jar for unit tests: test.jar.">
<delete dir="${temp.folder}/test.jar.bin" />
<mkdir dir="${temp.folder}/test.jar.bin" />
<!-- compile the source code -->
<javac srcdir="junit" destdir="${temp.folder}/test.jar.bin" failonerror="true" includeAntRuntime="no">
    <src path="junit/" />
    <classpath>
        <pathelement path="${junit.jar.folder}/junit.jar" />
        <pathelement path="${build.result.folder}/scagen.jar" />
    </classpath>
</javac>
<!-- Copy necessary resources i.e XSL stylesheets, test input etc -->
<copy todir="${temp.folder}/test.jar.bin" failonerror="true">
    <fileset dir="junit/" excludes="testoutput/**" />
</copy>
<mkdir dir="${build.result.folder}" />
<jar jarfile="${build.result.folder}/test.jar" basedir="${temp.folder}/test.jar.bin" />
<delete dir="${temp.folder}/test.jar.bin" />
</target>

<target name="scagen.jar" depends="init" unless="scagen.jar" description="Create main jar: scagen.jar">
<delete dir="${temp.folder}/scagen.jar.bin" />
<mkdir dir="${temp.folder}/scagen.jar.bin" />
<!-- compile the source code -->
<javac srcdir="src" destdir="${temp.folder}/scagen.jar.bin" failonerror="true" includeAntRuntime="no">
    <src path="src/" />
</javac>
<!-- Copy necessary resources i.e XSL stylesheets, test input etc -->
<copy todir="${temp.folder}/scagen.jar.bin" failonerror="true">
    <fileset dir="src/" excludes="**/*.java" />
</copy>
	
<copy todir="${temp.folder}/scagen.jar.bin/META-INF" failonerror="true">
    <fileset dir="META-INF/"/>
</copy>
	
<mkdir dir="${build.result.folder}" />
<jar jarfile="${build.result.folder}/scagen.jar" basedir="${temp.folder}/scagen.jar.bin">
    <manifest>
        <attribute name="Main-Class" value="org.apache.tuscany.sca.cpp.tools.services.Scagen" />
    </manifest>
</jar>
<delete dir="${temp.folder}/scagen.jar.bin" />
</target>

<target name="tobin" depends="jars, scripts" description="move the desired stuff to bin">
    <move file="${build.result.folder}/scagen.cmd" todir="${bin.dir}" />
    <move file="${build.result.folder}/scagen.sh" todir="${bin.dir}" />
    <move file="${build.result.folder}/scagen.jar" todir="${bin.dir}" />
</target>

    

<target name="clean" depends="init" description="Clean of all the files created.">
<delete file="${build.result.folder}/test.jar" />
<delete file="${build.result.folder}/src.jar" />
<delete file="${build.result.folder}/scagen.jar" />
<delete file="${build.result.folder}/org.apache.tuscany.sca.cpp.tools.zip" />
<delete dir="${temp.folder}" />
</target>

<target name="zip.all" depends="jars" description="Create a zip containing everything">
<delete file="${build.result.folder}/org.apache.tuscany.sca.cpp.tools.zip" />
<zip zipfile="${build.result.folder}/org.apache.tuscany.sca.cpp.tools.zip" excludes="bin/**,tmp/**,lib/**,junit/testoutput/**" basedir="." filesonly="true" whenempty="skip" update="false" />
<delete dir="${temp.folder}" />
</target>

</project>