1<?xml version="1.0"?>
2<!--
3 Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
6 This code is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License version 2 only, as
8 published by the Free Software Foundation.  Oracle designates this
9 particular file as subject to the "Classpath" exception as provided
10 by Oracle in the LICENSE file that accompanied this code.
11
12 This code is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 version 2 for more details (a copy is included in the LICENSE file that
16 accompanied this code).
17
18 You should have received a copy of the GNU General Public License version
19 2 along with this work; if not, write to the Free Software Foundation,
20 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
22 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23 or visit www.oracle.com if you need additional information or have any
24 questions.
25-->
26
27<project name="jaxws" default="all" basedir=".">
28   
29    <!-- For 'ant -p' or 'ant -projecthelp' -->
30    
31    <description>
32    Ant build script for the ${ant.project.name} part of the jdk.
33
34    Input Properties: (see build.properties for the ant defaults)
35      bootstrap.dir        - dir with lib/javac.jar, added to javac bootclasspath
36      javac.debug          - true or false for debug classfiles
37      javac.target         - classfile version target
38      javac.source         - source version
39
40      Run 'make help' for help using the Makefile.
41    </description>
42
43    <!-- Project build properties. -->
44    <property file="build.properties"/>
45
46    <property name="jaxws.src.dir" value="src/share/jaxws_classes"/>
47    <property name="jaf.src.dir" value="src/share/jaf_classes"/>
48    <path id="src.dir.id">
49      <pathelement path="${jaxws.src.dir}"/>
50      <pathelement path="${jaf.src.dir}"/>
51    </path>
52
53    <!-- Initialization of directories needed for build. -->
54    <target name="init">
55        <mkdir dir="${build.dir}"/>
56        <mkdir dir="${build.classes.dir}"/>
57        <mkdir dir="${dist.dir}"/>
58        <mkdir dir="${dist.lib.dir}"/>
59    </target>
60    
61    <!-- Sanity checks and settings -->
62    <target name="sanity"
63	    depends="-javac-jar-exists"
64            description="Display settings of configuration values">
65        <echo message="${sanity.info}"/>
66    </target>
67
68     <!-- Check for bootstrap javac.jar file, warn if missing. -->
69    <condition property="javac.jar.exists">
70        <available file="${javac.jar}" type="file"/>
71    </condition>
72    <target name="-javac-jar-exists"
73            unless="javac.jar.exists">
74        <echo message="WARNING: Cannot find ${javac.jar}"/>
75    </target>
76    
77    <!-- Create src.zip. -->
78    <target name="-dist-src-zip" depends="init">
79        <zip file="${dist.src.zip}" basedir="${jaxws.src.dir}"/>
80        <zip file="${dist.src.zip}" basedir="${jaf.src.dir}" update="true"/>
81    </target>
82
83    <!-- Creation of distribution files to jdk build process. -->
84    <target name="dist"
85	    depends="init, build, -dist-classes-jar, -dist-src-zip"
86            description="Create all built distribution files.">
87    </target>
88    <target name="-dist-classes-jar-uptodate"
89	    depends="init">
90        <condition property="dist.classes.jar.uptodate">
91            <and>
92                <available file="${dist.classes.jar}" type="file"/>
93                <uptodate targetfile="${dist.classes.jar}">
94                    <srcfiles dir="${build.classes.dir}" includes="**"/>
95                </uptodate>
96            </and>
97        </condition>
98    </target>
99    <target name="-dist-classes-jar"
100	    depends="init, -dist-classes-jar-uptodate"
101            unless="dist.classes.jar.uptodate">
102        <delete file="${dist.classes.jar}"/>
103        <jar file="${dist.classes.jar}" basedir="${build.classes.dir}"/>
104    </target>
105
106    <!-- Special build area setup. -->
107    <target name="-build-setup" depends="init">
108        <mkdir dir="${build.classes.dir}"/>
109        <copy todir="${build.classes.dir}">
110            <fileset dir="${jaxws.src.dir}"
111                includes="**/*.xsd, **/*.default, **/*.properties"
112                excludes="**/*.java, **/*.package.html"/>
113        </copy>
114        <replaceregexp match="#(.*)$" replace="#" flags="gm">
115            <fileset dir="${build.classes.dir}" includes="**/*.properties"/>
116        </replaceregexp>
117
118        <mkdir dir="${build.classes.dir}/META-INF/services"/>
119        <copy todir="${build.classes.dir}/META-INF"
120            file="${jaf.src.dir}/META-INF/mailcap.default"/>
121        <copy todir="${build.classes.dir}/META-INF"
122            file="${jaf.src.dir}/META-INF/mimetypes.default"/>
123        <copy todir="${build.classes.dir}/META-INF/services"
124            file="${jaxws.src.dir}/com/sun/tools/etc/META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin"/>
125        <copy todir="${build.classes.dir}/META-INF/services"
126            file="${jaxws.src.dir}/com/sun/tools/etc/META-INF/services/com.sun.tools.internal.xjc.Plugin"/>
127        <mkdir dir="${build.classes.dir}/com/sun/tools/internal/xjc/runtime"/>
128        <copy todir="${build.classes.dir}/com/sun/tools/internal/xjc/runtime">
129            <fileset dir="${jaxws.src.dir}/com/sun/tools/internal/xjc/runtime"
130                includes="**/*.java"
131                excludes="**/*.package.html"/>
132        </copy>
133    </target>
134
135    <!-- Build (compilation) of sources to class files. -->
136    <target name="build"
137	    depends="compile, -build-setup">
138    </target>
139    <target name="compile"
140	    depends="init">
141        <mkdir dir="${build.classes.dir}"/>
142        <javac 
143	     includeAntRuntime="false" 
144	     classpath="${build.classes.dir}:${tools.jar}"
145	     fork="true"
146             destdir="${build.classes.dir}"
147             memoryInitialSize="${javac.memoryInitialSize}"
148             memoryMaximumSize="${javac.memoryMaximumSize}"
149             source="${javac.source}"
150	     debug="${javac.debug}"
151             target="${javac.target}">
152            <compilerarg value="-J-Xbootclasspath/p:${javac.jar}"/>
153            <compilerarg line="${javac.version.opt} ${javac.lint.opts} ${javac.no.jdk.warnings}"/>
154            <src refid="src.dir.id"/>
155        </javac>
156    </target>
157
158    <!-- Test. (FIXME: Need to know how to run tests.) -->
159    <target name="test"
160	    depends="init, dist">
161        <echo message="FIXME: How do you run the tests"/>
162    </target>
163    
164    <!-- Populate source area if needed. -->
165    <target name="source"
166            depends="init"
167            description="Populate all source file directories">
168    </target>
169
170    <!-- Clean up compiled files. -->
171    <target name="clean"
172            description="Delete all generated files">
173        <delete dir="${build.dir}"/>
174        <delete dir="${dist.dir}"/>
175    </target>
176
177    <!-- Clean up compiled files and all imported source files. -->
178    <target name="clobber"
179	    depends="clean"
180            description="Delete all generated files, including imported sources">
181    </target>
182
183    <target name="-banner">
184        <echo message="+---------------------------------------+"/>
185        <echo message="+ Starting ant project ${ant.project.name} +"/>
186        <echo message="+---------------------------------------+"/>
187    </target>
188   
189    <!-- Do everything but test. -->
190    <target name="all"
191	    depends="-banner, sanity, dist"
192            description="Build everything.">
193        <echo message="+---------------------------------------+"/>
194        <echo message="+ Finishing ant project ${ant.project.name}"/>
195        <echo message="+---------------------------------------+"/>
196    </target>
197
198</project>
199