1 <?xml version="1.0"?> |
|
2 <!-- |
|
3 CDDL HEADER START |
|
4 |
|
5 The contents of this file are subject to the terms of the |
|
6 Common Development and Distribution License (the "License"). |
|
7 You may not use this file except in compliance with the License. |
|
8 |
|
9 You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
10 or http://www.opensolaris.org/os/licensing. |
|
11 See the License for the specific language governing permissions |
|
12 and limitations under the License. |
|
13 |
|
14 When distributing Covered Code, include this CDDL HEADER in each |
|
15 file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
16 If applicable, add the following below this CDDL HEADER, with the |
|
17 fields enclosed by brackets "[]" replaced with your own identifying |
|
18 information: Portions Copyright [yyyy] [name of copyright owner] |
|
19 |
|
20 CDDL HEADER END |
|
21 |
|
22 Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. |
|
23 --> |
|
24 |
|
25 <project name="commondef"> |
|
26 <import file="env-common.xml"/> |
|
27 |
|
28 <!-- |
|
29 Projects can redefine these paths to set the classpath for |
|
30 javac, javadoc (uses classpath.javac), and jar tasks. |
|
31 --> |
|
32 <path id="classpath.javac" /> |
|
33 <path id="classpath.jar" refid="classpath.javac" /> |
|
34 |
|
35 <!-- |
|
36 Generic copy/filter-based file generation task. |
|
37 --> |
|
38 <macrodef name="generate.filter"> |
|
39 <attribute name="pattern" /> |
|
40 <attribute name="fromdir" default="." /> |
|
41 <attribute name="from" /> |
|
42 <attribute name="to" /> |
|
43 <element name="filters" implicit="yes" /> |
|
44 <sequential> |
|
45 <copy todir="${proj.gen}"> |
|
46 <globmapper from="@{from}" to="@{to}" /> |
|
47 <fileset dir="@{fromdir}" |
|
48 includes="@{pattern}" /> |
|
49 <filterset begintoken="<" endtoken=">"> |
|
50 <filters /> |
|
51 </filterset> |
|
52 </copy> |
|
53 </sequential> |
|
54 </macrodef> |
|
55 |
|
56 <target name="generate_project" /> |
|
57 <target name="generate" depends="generate_project"> |
|
58 <mkdir dir="${proj.gen}" /> |
|
59 </target> |
|
60 |
|
61 <target name="clean_project" /> |
|
62 <target name="clean" depends="clean_project"> |
|
63 <delete dir="${proj.build}" /> |
|
64 </target> |
|
65 |
|
66 <target name="clobber_project" /> |
|
67 <target name="clobber" depends="clean,clobber_project"> |
|
68 <delete file="${proj.jarfile}" /> |
|
69 </target> |
|
70 |
|
71 <!-- |
|
72 Default compile target body. |
|
73 --> |
|
74 <presetdef name="javac.default"> |
|
75 <javac includeAntRuntime="no" sourcepathref="proj.srcroots" |
|
76 destdir="${proj.classes}" debug="on" |
|
77 classpathref="classpath.javac"> |
|
78 <src> |
|
79 <dirset dir="."> |
|
80 <include name="com"/> |
|
81 </dirset> |
|
82 </src> |
|
83 <src location="build/gen" /> |
|
84 <compilerarg value="-Xlint" /> |
|
85 <compilerarg value="-Xlint:-serial" /> |
|
86 </javac> |
|
87 </presetdef> |
|
88 |
|
89 <target name="compile_project" /> |
|
90 <target name="compile" depends="generate,compile_project"> |
|
91 <mkdir dir="${proj.classes}" /> |
|
92 <javac.default /> |
|
93 </target> |
|
94 |
|
95 <!-- |
|
96 Default jar target body. |
|
97 --> |
|
98 <presetdef name="jar.default"> |
|
99 <jar destfile="${proj.jarfile}"> |
|
100 <fileset dir="${proj.classes}" /> |
|
101 <fileset dir="."> |
|
102 <patternset id="pattern.resources"> |
|
103 <include name="com/**/*.properties" /> |
|
104 <include name="com/**/panel.policy" /> |
|
105 <include name="com/**/help/**" /> |
|
106 <include name="com/**/images/**" /> |
|
107 <exclude name="com/**/images/**/*.xcf" /> |
|
108 </patternset> |
|
109 </fileset> |
|
110 <fileset dir="${proj.gen}"> |
|
111 <patternset refid="pattern.resources" /> |
|
112 </fileset> |
|
113 </jar> |
|
114 </presetdef> |
|
115 |
|
116 <!-- |
|
117 A pathmapper that maps from a classpath in build-space to |
|
118 install-space, mapping paths in the workspace to a single |
|
119 directory and leaving absolute paths alone. |
|
120 --> |
|
121 <macrodef name="map.targetjar"> |
|
122 <attribute name="targetdir" default="${abs.java}" /> |
|
123 <attribute name="pathsep" default=" " /> |
|
124 <attribute name="property" /> |
|
125 <attribute name="pathref" /> |
|
126 <sequential> |
|
127 <pathconvert pathsep="@{pathsep}" property="@{property}" |
|
128 refid="@{pathref}"> |
|
129 <filtermapper> |
|
130 <replaceregex pattern="^${ws.java}/.*/" |
|
131 replace="@{targetdir}/" /> |
|
132 </filtermapper> |
|
133 </pathconvert> |
|
134 </sequential> |
|
135 </macrodef> |
|
136 |
|
137 <!-- |
|
138 Alternate jar target body, used for creating executables. |
|
139 --> |
|
140 <macrodef name="jar.executable"> |
|
141 <attribute name="mainclass" /> |
|
142 <attribute name="targetdir" default="${abs.java}" /> |
|
143 <element name="jar-elements" implicit="yes" optional="yes"/> |
|
144 <sequential> |
|
145 <map.targetjar targetdir="@{targetdir}" |
|
146 property="jarclasspath" pathref="classpath.jar" /> |
|
147 <jar.default> |
|
148 <manifest> |
|
149 <attribute name="Main-Class" |
|
150 value="@{mainclass}" /> |
|
151 <attribute name="Class-Path" |
|
152 value="${jarclasspath}" /> |
|
153 </manifest> |
|
154 <jar-elements /> |
|
155 </jar.default> |
|
156 </sequential> |
|
157 </macrodef> |
|
158 |
|
159 <target name="jar" depends="compile"> |
|
160 <jar.default /> |
|
161 </target> |
|
162 |
|
163 <!-- |
|
164 Default javadoc target body. |
|
165 --> |
|
166 <presetdef name="javadoc.default"> |
|
167 <javadoc noqualifier="all" sourcepathref="proj.srcroots" |
|
168 destdir="${proj.javadoc}" classpathref="classpath.javac"> |
|
169 <packageset dir="." includes="com/" /> |
|
170 </javadoc> |
|
171 </presetdef> |
|
172 |
|
173 <target name="javadoc" unless="env.ANT_SKIP_JAVADOC"> |
|
174 <javadoc.default /> |
|
175 </target> |
|
176 |
|
177 <presetdef name="l10n.default"> |
|
178 <copy todir="${proj.l10n}"> |
|
179 <fileset dir="."> |
|
180 <patternset id="pattern.resources"> |
|
181 <include name="com/**/*.properties" /> |
|
182 <include name="com/**/help/**" /> |
|
183 <exclude name="com/**/runtime.properties" /> |
|
184 </patternset> |
|
185 </fileset> |
|
186 </copy> |
|
187 </presetdef> |
|
188 <target name="l10n" unless="env.ANT_SKIP_L10N"> |
|
189 <l10n.default /> |
|
190 </target> |
|
191 |
|
192 |
|
193 <!-- |
|
194 Default install target body. |
|
195 --> |
|
196 <macrodef name="install.default"> |
|
197 <attribute name="targetdir" default="${proto.java}" /> |
|
198 <sequential> |
|
199 <mkdir dir="@{targetdir}" /> |
|
200 <copy file="${proj.jarfile}" todir="@{targetdir}" /> |
|
201 </sequential> |
|
202 </macrodef> |
|
203 |
|
204 <!-- |
|
205 Optionally used by a project's install_project to install |
|
206 javadoc. Currently copies from build/javadoc; in the future |
|
207 it might make sense to build javadoc differently in, and |
|
208 directly into, each location. |
|
209 --> |
|
210 <macrodef name="install.javadoc"> |
|
211 <sequential> |
|
212 <copy todir="${proto.javadoc}"> |
|
213 <fileset dir="${proj.javadoc}" |
|
214 erroronmissingdir="false"/> |
|
215 </copy> |
|
216 </sequential> |
|
217 </macrodef> |
|
218 |
|
219 <macrodef name="install.l10n"> |
|
220 <sequential> |
|
221 <copy todir="${proto.l10n}"> |
|
222 <fileset dir="."> |
|
223 <patternset id="pattern.resources"> |
|
224 <include name="com/**/*.properties" /> |
|
225 <include name="com/**/help/**" /> |
|
226 <exclude name="com/**/runtime.properties" /> |
|
227 </patternset> |
|
228 </fileset> |
|
229 </copy> |
|
230 </sequential> |
|
231 </macrodef> |
|
232 |
|
233 |
|
234 <target name="install_project" /> |
|
235 |
|
236 <target name="install" depends="jar,install_project,l10n"> |
|
237 <!-- Temporarily set targetdir --> |
|
238 <install.default targetdir="${proto.vpanels}" /> |
|
239 <install.l10n /> |
|
240 </target> |
|
241 |
|
242 <target name="build" depends="jar,build_project" /> |
|
243 |
|
244 <target name="build_project" /> |
|
245 |
|
246 <target name="lint" /> |
|
247 </project> |
|