Source

xwork / osbuild.xml

  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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<project name="common" default="jar" basedir=".">
    <!--
    OpenSymphony Common Build
    =========================
    TODO (Introduction)

    Layout
    =========================
    TODO

    Overriding
    =========================
    TODO
    Example: <target name="compile" depends="myPreCompile,common.compile,myPostCompile"/>

    -->
    <!-- NOTE: this property is purely here to make a clear distinction in IDEA where the common build is -->
    <property name="------common-properties-below------" value="Common properties below:"/>

    <property name="compile.version" value="1.5"/>
    <property name="test.compile.version" value="1.5"/>

    <dirname property="common.dir" file="${ant.file.common}"/>
    <property file="build.properties"/>
    <property file="release.properties"/>
    <property file="ivyrep.properties"/>

    <property name="lib" location="lib"/>
    <property name="lib.core" value="${lib}/core"/>
    <property name="lib.build" value="${lib}/build"/>
    <property name="lib.optional" value="${lib}/optional"/>

    <property name="src" location="src"/>
    <property name="src.java" value="${src}/java"/>

    <property name="test" value="${src}/test"/>
    <property name="src.test" value="${test}/java"/>

    <property name="build" location="build"/>
    <property name="build.test" value="${build}/test"/>
    <property name="build.java-test" value="${build}/java-test"/>
    <property name="build.java" value="${build}/java"/>
    <property name="dist" location="dist"/>

    <property name="docs" location="docs"/>
    <property name="docs.packages" value="com.opensymphony.xwork2.*"/>

    <property name="jar.manifest" value="${common.dir}/EMPTY.MF"/>
    <property name="jar.excludes" value=""/>

    <property name="testcase" value="*"/>
    <patternset id="src.test.pattern">
        <exclude name="**/Abstract*.java"/>
        <include name="**/${testcase}Test.java"/>
        <include name="**/${testcase}TestCase.java"/>
    </patternset>

    <path id="cp">
        <fileset dir="lib">
            <include name="**/*.jar"/>
            <include name="**/*.zip"/>
            <exclude name="**/jalopy/**"/>
        </fileset>
    </path>

    <path id="junit.cp">
        <pathelement location="${build.test}"/>
        <pathelement location="${build.java-test}"/>
        <path refid="cp"/>
    </path>

    <available property="junit.available" classname="junit.framework.TestCase"/>

    <target name="init" depends="init-anthill, init-standalone">
        <tstamp/>
    </target>

    <!-- in Anthill, the docs should be the Intranet copyDir -->
    <target name="init-anthill" if="anthill.copyDir">
        <property name="dist.docs" value="${anthill.copyDir}"/>
    </target>

    <!-- when building Standalone, the docs should be the normal place -->
    <target name="init-standalone" unless="anthill.copyDir">
        <property name="dist.docs" value="${dist}/docs"/>
    </target>

    <target name="junit-check" depends="init" unless="junit.available">
        <fail message="Cannot run test cases. Please copy lib/build/junit.jar to ${ant.home}/lib"/>
    </target>

    <target name="clean">
        <delete dir="${build}"/>
        <delete dir="${dist}"/>
    </target>

    <target name="precompile"/>

    <macrodef name="compile">
        <attribute name="srcdir"/>
        <attribute name="destdir"/>
        <attribute name="classpath" default=""/>
        <attribute name="classpathref" default="cp"/>
        <attribute name="excludes" default=""/>
        <attribute name="source" default="${compile.version}"/>
        <attribute name="target" default="${compile.version}"/>
        <sequential>
            <mkdir dir="@{destdir}"/>
            <javac srcdir="@{srcdir}" destdir="@{destdir}" classpath="@{classpath}" classpathref="@{classpathref}"
                   debug="on" source="@{source}" target="@{target}"/>
            <copy filtering="no" todir="@{destdir}">
                <fileset dir="@{srcdir}">
                    <exclude name="**/*.java"/>
                    <exclude name="**/package.html"/>
                </fileset>
            </copy>
        </sequential>
    </macrodef>

    <target name="compile" depends="init,precompile" description="compile project">
        <compile srcdir="${src.java}" destdir="${build.java}"/>
    </target>

    <target name="jar" depends="compile" description="build the project jar file">
        <mkdir dir="${build}"/>
        <mkdir dir="${build.java}/maven/com/opensymphony/xwork" />
        <copy file="pom.xml" todir="${build.java}/maven/com/opensymphony/xwork" />

        <jar basedir="${build.java}" excludes="${jar.excludes}" jarfile="${build}/${name}-${version}.jar">
            <manifest>
                <attribute name="Implementation-Title" value="${fullname}"/>
                <attribute name="Implementation-Version" value="${version}"/>
                <attribute name="Implementation-Vendor" value="OpenSymphony"/>
            </manifest>
        </jar>
        <jar basedir="${src.java}" jarfile="${build}/${name}-${version}-sources.jar">
            <manifest>
                <attribute name="Implementation-Title" value="${fullname}"/>
                <attribute name="Implementation-Version" value="${version}"/>
                <attribute name="Implementation-Vendor" value="OpenSymphony"/>
            </manifest>
        </jar>
    </target>

    <target name="src-jar" depends="init" description="build a jar of the project source code">
        <mkdir dir="${build}"/>
        <jar basedir="${src.java}" jarfile="${build}/${name}-${version}-sources.jar">
            <manifest>
                <attribute name="Implementation-Title" value="${fullname}"/>
                <attribute name="Implementation-Version" value="${version}"/>
                <attribute name="Implementation-Vendor" value="OpenSymphony"/>
            </manifest>
        </jar>
    </target>

    <target name="javadoc-jar" depends="javadocs" description="build a jar of the project javadocs">
        <mkdir dir="${build}"/>
        <jar basedir="${dist.docs}/api" jarfile="${build}/${name}-${version}-javadoc.jar">
            <manifest>
                <attribute name="Implementation-Title" value="${fullname}"/>
                <attribute name="Implementation-Version" value="${version}"/>
                <attribute name="Implementation-Vendor" value="OpenSymphony"/>
            </manifest>
        </jar>
    </target>

    <target name="test-compile" unless="skip.tests">
        <compile srcdir="${src.test}" destdir="${build.test}" classpath="${build.java}"
                 source="${test.compile.version}" target="${test.compile.version}"/>

        <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
        <compile srcdir="${src.java}" destdir="${build.java-test}"/>
    </target>

    <target name="test" depends="junit-check, compile, test-compile" description="run tests"
            unless="skip.tests">
        <run-junit/>
    </target>

    <macrodef name="run-junit">
        <attribute name="classpathref" default="junit.cp"/>
        <sequential>
            <mkdir dir="${dist.docs}/junit"/>
            <junit haltonfailure="no" haltonerror="yes" fork="yes" forkmode="once" failureproperty="test.failure">
                <jvmarg value="-Djava.awt.headless=true"/>
                <jvmarg value="-Dorg.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl"/>
                <classpath>
                    <path refid="@{classpathref}"/>
                </classpath>

                <formatter type="plain" useFile="false"/>
                <formatter type="xml"/>

                <batchtest todir="${dist.docs}/junit">
                    <fileset dir="${src.test}">
                        <patternset refid="src.test.pattern"/>
                    </fileset>
                </batchtest>
            </junit>
        </sequential>
    </macrodef>

    <target name="javadocs" description="generate javadocs" depends="init">
        <mkdir dir="${dist.docs}/api"/>
        <javadoc sourcepath="${src.java}"
                 destdir="${dist.docs}/api"
                 packagenames="${docs.packages}"
                 classpathref="cp"
                 author="true"
                 version="true"
                 overview="${src.java}/overview.html"
                 windowTitle="${fullname} API - ${version}"
                 doctitle="${fullname} API (${version})"
                 footer="&lt;a href=&quot;http://www.opensymphony.com/${name}/&quot; target=&quot;_top&quot;&gt;${fullname} Project Page&lt;/a&gt;"
                 use="true"
                 failonerror="false"
                 verbose="false"
                 private="true"
                 source="1.5"
                >
            <link href="http://java.sun.com/j2se/1.5.0/docs/api" />
            <link href="http://java.sun.com/javaee/5/docs/api/" />
            <link href="http://struts.apache.org/2.x/struts2-core/apidocs"/>
            <link href="http://jakarta.apache.org/commons/logging/apidocs"/>
            <link href="http://logging.apache.org/log4j/docs/api"/>
        </javadoc>
        <jar basedir="${dist.docs}/api" jarfile="${build}/${name}-${version}-javadoc.jar">
            <manifest>
                <attribute name="Implementation-Title" value="${fullname}"/>
                <attribute name="Implementation-Version" value="${version}"/>
                <attribute name="Implementation-Vendor" value="OpenSymphony"/>
            </manifest>
        </jar>

        <!-- <copy overwrite="yes" file="${docs}/main.css" tofile="${docs}/api/stylesheet.css"/> -->
    </target>

    <target name="docs.impl">
        <copy todir="${dist.docs}">
            <fileset dir="${docs}"/>
        </copy>
    </target>

    <target name="reports" depends="junit.report, javadocs"
            description="generate javadocs and junit and coverage reports"/>

    <target name="docs" depends="reports, docs.impl"/>

    <target name="junit.report" depends="test" description="generate junit reports" unless="skip.tests">
        <junitreport todir="${dist.docs}/junit">
            <fileset dir="${dist.docs}/junit">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="${dist.docs}/junit"/>
        </junitreport>

        <!-- we fail here (instead of in the test target) so that the reports get generated first) -->
        <fail if="test.failure" message="Tests did not all pass, failing!"/>
    </target>

    <target name="predist"/>

    <target name="predist.zip"/>

    <target name="dist" depends="jar, docs, predist" description="generate distribution zip file">
        <copy todir="${dist}">
            <fileset dir="${build}">
                <include name="*.jar"/>
            </fileset>
        </copy>

        <copy todir="${dist}/src">
            <fileset dir="${src}"/>
        </copy>

        <mkdir dir="${dist}/lib"/>
        <copy todir="${dist}/lib">
            <fileset dir="${lib}">
                <exclude name="**/no_dist/**"/>
            </fileset>
        </copy>

        <copy todir="${dist}">
            <fileset dir="${basedir}">
                <include name="build.*"/>
                <include name="osbuild.*"/>
                <include name="ivy.*"/>
                <include name="pom.*"/>
                <include name="readme.txt"/>
                <include name="license.txt"/>
            </fileset>
        </copy>

        <!-- give a chance for project builds to do more before the zip is made. -->
        <antcall target="predist.zip"/>

        <zip zipfile="${build}/${name}-${version}.zip">
            <zipfileset prefix="${name}-${version}" dir="${dist}">
                <exclude name="docs/junit/**/*"/>
            </zipfileset>
        </zip>

        <move file="${build}/${name}-${version}.zip" todir="${dist}"/>
    </target>

    <target name="website" depends="javadocs, docs.impl"/>

    <!-- =================================================================== -->
    <!-- Fix carriage-return line feeds                                      -->
    <!-- =================================================================== -->
    <target name="fixcrlf" description="Fixed CR/LF problems">
        <echo>Running fixcrlf....</echo>
        <fixcrlf eol="lf" srcdir="${basedir}/src"
                 includes="**/*.sh,
                      **/*.properties,
                      **/*.sql,
                      **/*.script,
                      **/*.java,
                      **/*.css,
                      **/*.js,
                      **/*.jsp,
                      **/*.ftl,
                      **/*.txt,
                      **/*.vm,
                      **/*.xml,
                      **/*.dtd,
                      **/*.xsl,
                      **/*.xslt,
                      **/*.html"/>

    </target>


    <target name="ivyrep" depends="jar, ivyrep.impl"/>

    <target name="ivyrep.impl">
        <tstamp>
            <format property="TIME" pattern="yyyyMMddHHmmss"/>
        </tstamp>

        <!-- make sure we have the latest -->
        <echo>svn update</echo>
        <exec executable="svn">
            <arg value="update"/>
            <arg line="${ivyrep.path}/opensymphony/${name}"/>
        </exec>

        <!-- delete the old timestamped builds and commit -->
        <fileset dir="${ivyrep.path}/opensymphony/${name}" id="filesref">
            <include name="${name}-${version}-*"/>
            <include name="ivy-${version}-*"/>
        </fileset>
        <pathconvert property="files" refid="filesref" pathsep=" "/>
        <echo>svn delete: ${files}</echo>
        <exec executable="svn">
            <arg value="delete"/>
            <arg line="${files}"/>
        </exec>

        <!-- copy over the new build and source -->
        <copy file="${build}/${name}-${version}.jar"
              tofile="${ivyrep.path}/opensymphony/${name}/${name}-${version}-${TIME}.jar"/>
        <copy file="${build}/${name}-${version}-sources.jar"
              tofile="${ivyrep.path}/opensymphony/${name}/${name}-${version}-${TIME}-sources.jar"/>
        <copy file="${build}/${name}-${version}-javadoc.jar"
              tofile="${ivyrep.path}/opensymphony/${name}/${name}-${version}-${TIME}-javadoc.jar"/>
        <echo>svn add (jar)</echo>
        <exec executable="svn">
            <arg value="add"/>
            <arg value="${ivyrep.path}/opensymphony/${name}/${name}-${version}-${TIME}.jar"/>
        </exec>
        <exec executable="svn">
            <arg value="add"/>
            <arg value="${ivyrep.path}/opensymphony/${name}/${name}-${version}-${TIME}-sources.jar"/>
        </exec>
        <exec executable="svn">
            <arg value="add"/>
            <arg value="${ivyrep.path}/opensymphony/${name}/${name}-${version}-${TIME}-javadoc.jar"/>
        </exec>

        <antcall target="ivyrep.copy-ivy"/>
        <exec executable="svn">
            <arg value="add"/>
            <arg value="${ivyrep.path}/opensymphony/${name}/ivy-${version}-${TIME}.xml"/>
        </exec>

        <!-- now commit everything -->
        <echo>svn commit</echo>
        <exec executable="svn">
            <arg value="commit"/>
            <arg value="--username"/>
            <arg value="${ivyrep.username}"/>
            <arg value="--password"/>
            <arg value="${ivyrep.password}"/>
            <arg value="--non-interactive"/>
            <arg value="-m"/>
            <arg value="automatic commit"/>
            <arg value="${ivyrep.path}/opensymphony/${name}"/>
        </exec>
    </target>

    <target name="ivyrep.copy-ivy">
        <!--
        Note: Default implementation does not use Ivy itself to generate these files.
              However, Ivy is really the best way to generate these, so projects that
              do use Ivy should override this target like so:

              <ivy-deliver deliverpattern="${ivyrep.path}/opensymphony/${name}/[artifact]-[revision].[ext]"
                           pubrevision="${version}-${TIME}" pubdate="${TIME}"/>

              Over time as more projects adopt Ivy, this may become built in to the
              common build.
        -->
        <copy file="ivy.xml" tofile="${ivyrep.path}/opensymphony/${name}/ivy-${version}-${TIME}.xml">
            <filterset id="ivy.filter">
                <filter token="VERSION" value="${version}-${TIME}"/>
                <filter token="STATUS" value="${status}"/>
                <filter token="PUBLICATION" value="${TIME}"/>
            </filterset>
        </copy>
    </target>
</project>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.