File: maven.xml

package info (click to toggle)
groovy 0.1.0beta10-3
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k
  • size: 11,640 kB
  • ctags: 7,195
  • sloc: java: 44,640; xml: 1,199; sh: 544; makefile: 79; ansic: 43
file content (511 lines) | stat: -rw-r--r-- 18,562 bytes parent folder | download | duplicates (2)
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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
<project default="default" xmlns:j="jelly:core" xmlns:u="jelly:util" xmlns:maven="jelly:maven">

  <goal name="default" prereqs="clean, groovy:make-install"/>

  <goal name="dc" prereqs="clean">
    <attainGoal name="jar:deploy-snapshot"/>

    <j:set var="maven.test.skip" value="true"/>

    <attainGoal name="site:deploy"/>
  </goal>

  <goal name="modules" description="Builds related modules">
    <maven:reactor
       basedir="${basedir}/../modules"
       includes="xmlrpc/project.xml"
       banner="Executing build:"
       ignoreFailures="false"
       postProcessing="true"
       goals="jar"
       />
  </goal>
  <preGoal name="site:deploy">
    <attainGoal name="javadoc"/>
  </preGoal>

  <postGoal name="dist:prepare-src-filesystem">
    <!-- lets zap the build.xml -->
    <delete file="${maven.dist.src.assembly.dir}/build.xml"/>

  </postGoal>
  
  <goal name="rebuild" prereqs="clean" description="Rebuilds the groovy install without running the unit tests">
   <j:set var="maven.test.skip" value="true"/>
   <echo>Rebuilding the binary distro of Groovy without running the unit test cases</echo>
   <attainGoal name="groovy:make-install"/>
  </goal>
  
  <goal name="groovy:release" prereqs="clean, jar:install, release, groovy:disable-unittests, site, dist:deploy-bin, dist:deploy-src, jar:deploy"
    description="Performs a release of the source, binary and jar distros">
  </goal>

  <goal name="groovy:disable-unittests" description="Disables the running of the unit test cases">
   <!-- we've run the tests by now once already, lets avoid it again -->
   <j:set var="maven.test.skip" value="true"/>
  </goal>

  <preGoal name="groovy:release">
   <!-- we've run the tests by now once already, lets avoid it again -->
   <j:set var="maven.test.skip" value="true"/>
  </preGoal>

  <goal name="groovy:test-wiki" description="Generates the test cases for the wiki and runs the tests">
   <attainGoal name="clean"/>
   <attainGoal name="groovy:compile"/>
   <j:set var="testcase" value="org.codehaus.groovy.wiki.RunWikiTest"/>
   <attainGoal name="test:single"/>
  </goal>
  
  <goal name="groovy:test-single" prereqs="groovy:compile" description="Runs a named groovy test case using the 'test' property">
    <java classname="groovy.util.GroovyTestSuite" fork="yes">
      <classpath refid="test.classpath"/>
      <sysproperty key="test" value="${test}"/>
    </java>
  </goal>
  

  <goal name="groovy:test-quick" prereqs="clean" description="Tries running all the unit test cases in the same JVM">
   <attainGoal name="clean"/>
   <attainGoal name="groovy:compile"/>
   <j:set var="testcase" value="org.codehaus.groovy.tools.FindAllTestsSuite"/>
   <j:set var="maven.junit.usefile" value="false"/>
   <attainGoal name="test:single"/>
  </goal>
  
  <postGoal name="dist:prepare-bin-filesystem">
    <attainGoal name="groovy:make-full-install"/>
    <echo>Copying groovy install to ${maven.dist.bin.assembly.dir}</echo>
    <copy toDir="${maven.dist.bin.assembly.dir}">
      <fileset dir="${groovy.install.staging.dest}">
        <include name="**/*"/>
        <exclude name="**/*.groovy"/>
      </fileset>
    </copy>
    <chmod perm="ugo+x">
      <fileset dir="${maven.dist.bin.assembly.dir}/bin">
        <include name="*"/>
        <include name="*.*"/>
      </fileset>
    </chmod>
  </postGoal>

  <goal
    name="dist:build-bin"
    prereqs="dist:build-setup,dist:prepare-bin-filesystem"
    description="Build the binary distribution.">

    <!-- Create a tar.gz file -->
    <tar longfile="gnu" tarfile="${maven.dist.dir}/${maven.final.name}.tar">
      <tarfileset dir="${maven.dist.bin.archive.dir}" >
        <exclude name="groovy-${pom.currentVersion}/bin/**" />
      </tarfileset>
      <tarfileset dir="${maven.dist.bin.archive.dir}" mode ="0755">
        <include name="groovy-${pom.currentVersion}/bin/**"  />
      </tarfileset>
    </tar>


    <gzip
      zipfile="${maven.dist.dir}/${maven.final.name}.tar.gz"
      src="${maven.dist.dir}/${maven.final.name}.tar"
    />

    <delete file="${maven.dist.dir}/${maven.final.name}.tar"/>

    <!-- Create a zip file -->
    <zip zipfile="${maven.dist.dir}/${maven.final.name}.zip">
      <zipfileset dir="${maven.dist.bin.archive.dir}"/>
    </zip>
  </goal>


  <goal name="run" prereqs="test:compile"
    description="Runs the given compiled Groovy class">
    <j:if test="${empty(name)}">
      <j:set var="name" value="HelloWorld"/>
    </j:if>
    <echo>Running class $$name = ${name}</echo>
    <java classname="${name}" fork="yes">
      <classpath refid="test.classpath"/>
      <arg value="${args}"/>
    </java>
  </goal>

  <goal name="script" prereqs="test:compile"
    description="Runs the given Groovy script file">

    <j:if test="${empty(name)}">
      <j:set var="name" value="src/test/groovy/script/HelloWorld.groovy"/>
    </j:if>

    <echo>Running class $$name = ${name}</echo>
    <java classname="groovy.lang.GroovyShell" fork="yes">
      <classpath refid="test.classpath"/>
      <arg value="${name}"/>
      <arg value="${args}"/>
    </java>
  </goal>


  <goal name="console" prereqs="test:compile"
    description="Runs the Groovy command console">
    <java classname="groovy.ui.Console" fork="yes">
      <classpath refid="test.classpath"/>
    </java>
<!--
    <java classname="groovy.lang.GroovyShell" fork="yes">
      <arg value="src/main/groovy/ui/Console.groovy"/>
      <classpath refid="test.classpath"/>
    </java>
-->    
  </goal>

  <goal name="swing:demo" prereqs="test:compile"
    description="Runs the GroovySwing demo">
    <java classname="groovy.swing.Demo" fork="yes">
      <classpath refid="test.classpath"/>
    </java>
  </goal>



  <preGoal name="xdoc:jelly-transform">
    <attainGoal name="groovy:xdoc-stuff"/>
  </preGoal>

  <goal name="groovy:xdoc-stuff" prereqs="java:compile, setclasspath, groovy:make-new-javadoc">
    <mkdir dir="${maven.html2xdoc.dir}"/>
    <!--
    <copy toDir="${maven.html2xdoc.dir}">
      <fileset dir="${basedir}/xdocs">
        <include name="**/*.html"/>
      </fileset>
    </copy>
    -->

    <!-- now lets run the wiki plugin -->
    <!--
    <attainGoal name="java:compile"/>
    <attainGoal name="setclasspath"/>
    -->

    <wiki2html srcdir="${basedir}/xdocs" destdir="${maven.html2xdoc.dir}"/>

    <!-- lets generate the HTML docs -->
    <attainGoal name="groovy:make-new-javadoc"/>

    <attainGoal name="html2xdoc"/>
    <attainGoal name="faq"/>
  </goal>

  <goal name="groovy:make-new-javadoc" prereqs="java:compile"
    description="Generates the HTML of the new JavaDoc added to the JDK">
    <mkdir dir="${maven.html2xdoc.dir}"/>
    <java classname="org.codehaus.groovy.tools.DocGenerator" fork="yes">
      <classpath refid="test.classpath"/>
    </java>
  </goal>


  <postGoal name="test:compile">
    <attainGoal name="setclasspath"/>
    <j:if test="${unitTestSourcesPresent == 'true' and context.getVariable('maven.test.skip') != 'true'}">
      <attainGoal name="groovy:compile-tests"/>
    </j:if>
    ${context.setVariable('java.awt.headless', true)}
  </postGoal>
    
  <goal name="setclasspath">
    <path id="test.classpath">
      <pathelement path="${maven.build.dest}"/>
      <pathelement path="target/classes"/>
      <pathelement path="target/test-classes"/>
      <path refid="maven.dependency.classpath"/>
    </path>
    <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="test.classpath"/> 
    <taskdef name="wiki2html" classname="org.codehaus.groovy.wiki.Wiki2Markup" classpathref="test.classpath"/> 
    <taskdef name="wiki2testcase" classname="org.codehaus.groovy.wiki.Wiki2TestCase" classpathref="test.classpath"/> 
  </goal>
  

  <goal name="asm:dump" prereqs="test:compile"
    description="Dumps the ASM instructions to generate the given class using the name property">

    <j:if test="${empty(name)}">
      <j:set var="name" value="org.codehaus.groovy.classgen.DumpClass"/>
    </j:if>

    <echo>Dumping class $$name = ${name}</echo>
    <java classname="org.objectweb.asm.util.DumpClassVisitor" fork="yes">
      <classpath refid="test.classpath"/>
      <arg value="${name}"/>
    </java>
  </goal>

  <goal name="groovy:compile" prereqs="java:compile, setclasspath"
    description="Compiles the Groovy code">

    <!-- lets create the test cases from the wiki documentation -->
    <mkdir dir="${basedir}/target/test-classes/wiki"/>
    <wiki2testcase srcdir="${basedir}/xdocs" destdir="${basedir}/target/test-classes/wiki"/>
    
    <copy todir="${basedir}/target/classes">
      <fileset dir="${basedir}/src/main">
        <include name="**/*.groovy"/>
        <exclude name="CVS/*"/>
      </fileset>
    </copy>
    <groovyc destdir="${basedir}/target/classes" srcdir="${basedir}/target/classes" listfiles="true">
      <classpath refid="test.classpath"/>
    </groovyc>
  </goal>

  <goal name="groovy:compile-tests" prereqs="groovy:compile, setclasspath"
    description="Compiles the Groovy unit test cases">
    <!-- lets copy and touch all the groovy files to ensure they all recompile -->
    <mkdir dir="${basedir}/target/test-classes"/>
    <copy todir="${basedir}/target/test-classes">
      <fileset dir="${basedir}/src/test">
        <include name="**/*.groovy"/>
        <exclude name="**/notworking/*.groovy"/>
        <exclude name="**/parser/*.groovy"/>
        <!--
        <exclude name="**/script/AtomTestScript.groovy"/>
        -->
        <exclude name="CVS/*"/>
      </fileset>
    </copy>
    <!--
    <touch>
    <fileset dir="${basedir}/target/test-classes" includes="**/*.groovy"/>
    </touch>
    -->
    <groovyc destdir="${basedir}/target/test-classes" srcdir="${basedir}/target/test-classes" listfiles="true">
      <classpath refid="test.classpath"/>
    </groovyc>

      <!-- re compile java, so that UberTests are now built -->
      <javac srcdir="${basedir}/src/test"
             destdir="${basedir}/target/test-classes"
             classpathref="test.classpath">
        <include name="**/Uber*.java" />   
      </javac>

  </goal>

<!--
  <goal name="test" 
        description="Test the application"
        prereqs="">
    <attainGoal name="groovy:test"/>
  </goal>

  <goal name="test:test" 
        description="Test the application"
        prereqs="">
    <attainGoal name="groovy:test"/>
  </goal>
-->

  <goal name="groovy:test"
        description="Test the application with any Java or Groovy unit tests"
        prereqs="test:compile">
      
    <j:if test="${unitTestSourcesPresent == 'true' and context.getVariable('maven.test.skip') != 'true'}">
      
      <taskdef
        name="junit"
        classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
      />

      <j:set var="testPlugin" value="${pom.getPluginContext('maven-test-plugin')}"/>
      <j:set var="reportsDirectory">${testPlugin.findVariable('maven.test.reportsDirectory')}</j:set>

      <mkdir dir="${reportsDirectory}"/>

      <junit printSummary="yes" 
             failureProperty="maven.test.failure"
             fork="${maven.junit.fork}"
             dir="${maven.junit.dir}">
        <sysproperty key="basedir" value="${basedir}"/>
        
        <!-- use headless for AWT stuff -->
        <u:replace var="headless" oldChar="_" newChar=".">java_awt_headless</u:replace>
        <echo>Setting property ${headless} to true</echo>
        <sysproperty key="${headless}" value="true"/>
        
        <u:tokenize var="listOfProperties" delim=" ">${maven.junit.sysproperties}</u:tokenize>
        <j:forEach var="someProperty" items="${listOfProperties}">
          <sysproperty key="${someProperty}" value="${context.getVariable(someProperty)}"/>
        </j:forEach>
        <u:tokenize var="listOfJvmArgs" delim=" ">${maven.junit.jvmargs}</u:tokenize>
        <j:forEach var="somejvmarg" items="${listOfJvmArgs}">
          <jvmarg value="${somejvmarg}"/>
        </j:forEach>
        <formatter type="xml"/>
        <formatter type="plain" usefile="${maven.junit.usefile}"/>
        <classpath>
          <path refid="maven.dependency.classpath"/>
          <pathelement location="${basedir}/target/classes"/>
          <pathelement location="${basedir}/target/test-classes"/>
          <pathelement path="${plugin.getDependencyPath('junit')}"/>
        </classpath>
        <batchtest todir="${reportsDirectory}">
          <fileset dir="${basedir}/target/test-classes">
            <j:forEach var="pat" items="${pom.build.unitTest.includes}">
              <include name="${pat}"/>
            </j:forEach>
            <j:forEach var="pat" items="${pom.build.unitTest.excludes}">
              <exclude name="${pat}"/>
            </j:forEach>
              <!-- KEEP ALL ABSTRACT TESTS FROM BEING RUN! -->
              <exclude name="**/*AbstractTestCase.*"/>
          </fileset>
        </batchtest>
      </junit>

      <j:if test="${maven.test.failure}">
        <j:set var="ignore__" value="${maven.test.failure.ignore}X"/>
        <j:if test="${ignore__ == 'X'}">
          <fail message="There were test failures."/>
        </j:if>
      </j:if>

    </j:if>
    
    <j:if test="${!unitTestSourcesPresent}">
      <echo>No tests to run.</echo>
    </j:if>

  </goal>

  <goal name="groovy-eclipse:copyjars">
    <j:if test="${empty(groovy.eclipse.dir)}">
      <j:set var="groovy.eclipse.dir" value="../groovy-eclipse"/>
    </j:if>
    
    <copy file="${maven.build.dir}/${maven.final.name}.jar" tofile="${groovy.eclipse.dir}/lib/groovy.jar"/>

    <j:forEach var="lib" items="${pom.artifacts}">
      <echo>Processing ${lib.name}</echo>
      <j:choose>
        <j:when test="${lib.name.startsWith('commons-log')}">
          <copy file="${lib.path}" tofile="${groovy.eclipse.dir}/lib/commons-logging.jar"/>
        </j:when>
        <j:when test="${lib.name.startsWith('asm-util')}">
        </j:when>
        <j:when test="${lib.name.startsWith('asm')}">
          <copy file="${lib.groovypath}" tofile="${groovy.eclipse.dir}/lib/asm.jar"/>
        </j:when>
      </j:choose>
    </j:forEach>
    
  </goal>

  <preGoal name="jar:jar">
     <attainGoal name="groovy:compile"/>
  </preGoal>
    
  <goal name="groovy:make-install" prereqs="jar:jar">
    <echo>${groovy.install.staging.dest}</echo>
    <mkdir dir="${groovy.install.staging.dest}"/>
    <mkdir dir="${groovy.install.staging.dest}/lib"/>
    <mkdir dir="${groovy.install.staging.dest}/bin"/>
    <mkdir dir="${groovy.install.staging.dest}/conf"/>
    <j:forEach var="lib" items="${pom.artifacts}">
      <copy file="${lib.path}" toDir="${groovy.install.staging.dest}/lib"/>
    </j:forEach>
    <copy file="${maven.build.dir}/${maven.final.name}.jar" toDir="${groovy.install.staging.dest}/lib"/>
    <copy toDir="${groovy.install.staging.dest}/conf">
      <fileset dir="${maven.src.dir}/conf">
        <include name="*"/>
      </fileset>
    </copy>
    <copy toDir="${groovy.install.staging.dest}/bin">
      <fileset dir="${maven.src.dir}/bin">
        <include name="*"/>
      </fileset>
    </copy>
    <chmod perm="ugo+x">
      <fileset dir="${groovy.install.staging.dest}/bin">
        <include name="*"/>
        <include name="*.*"/>
      </fileset>
    </chmod>
    <attainGoal name="groovy:embeddable-jar"/>
  </goal>

  <goal name="groovy:make-full-install" prereqs="groovy:make-install">
    <!-- lets copy xmlrpc into the release -->
    <attainGoal name="modules"/>
    <!--
    <echo>Copying the xmlrpc jar into the install directory ${groovy.install.staging.dest}/lib</echo>
    -->

    <copy toDir="${groovy.install.staging.dest}/lib">
      <fileset dir="../modules/xmlrpc/target">
        <include name="groovy*.jar"/>
      </fileset>

      <!-- temporary hack while we move things around -->
      <fileset dir="../jsr/ideas/parsers/antlr/dist">
        <include name="groovy*.jar"/>
      </fileset>
      <fileset dir="../jsr/ideas/parsers/antlr/lib">
        <include name="ant*.jar"/>
      </fileset>
    </copy>
  </goal>

  <goal name="groovy:embeddable-jar">
  	<mkdir dir="${groovy.embeddable.working.dir}"/>
	<unzip dest="${groovy.embeddable.working.dir}">
		<fileset dir="${groovy.install.staging.dest}/lib">
			<include name="asm*.jar"/>
			<exclude name="asm-attr*.jar"/>
			<exclude name="asm-util*.jar"/>
			<exclude name="asm-analysis*.jar"/>
			<include name="groovy*.jar"/>
		</fileset>
	</unzip>
	<copy toDir="${groovy.embeddable.working.dir}/META-INF">
		<fileset dir="${basedir}">
			<include name="ASM-LICENSE.txt"/>
		</fileset>
	</copy>
	<mkdir dir="${groovy.install.staging.dest}/embeddable"/>
	<jar jarfile="${groovy.install.staging.dest}/embeddable/groovy-all-${pom.currentVersion}.jar" 
                                                        manifest="${groovy.embeddable.working.dir}/META-INF/MANIFEST.MF">
		<fileset dir="${groovy.embeddable.working.dir}"/>
	</jar>
<!--	<delete dir="${groovy.embeddable.working.dir}"/>-->
  </goal>

  <goal name="groovy:exe" prereqs="rebuild">
    <echo>Building a Groovy executable</echo>
    <mkdir dir="${maven.build.dir}/native/classes"/>
    <unzip src="${maven.build.dir}/${maven.final.name}.jar" dest="${maven.build.dir}/native/classes"
/>

    <unzip src="${groovy.install.staging.dest}/lib/asm-1.5.2.jar" dest="${maven.build.dir}/native/classes"/>
    <unzip src="${groovy.install.staging.dest}/lib/asm-util-1.5.2.jar" dest="${maven.build.dir}/native/classes"/>
    <unzip src="${groovy.install.staging.dest}/lib/asm-attrs-1.5.2.jar" dest="${maven.build.dir}/native/classes"/>
    <unzip src="${groovy.install.staging.dest}/lib/asm-analysis-1.5.2.jar" dest="${maven.build.dir}/native/classes"/>

    <unzip src="${groovy.install.staging.dest}/lib/commons-cli-1.0.jar" dest="${maven.build.dir}/native/classes"/>
    <exec executable="gcc">
      <arg line="-g -o ${maven.build.dir}/native/base ${maven.src.dir}/native/base.c"/>
    </exec>
    <jar manifest="${maven.src.dir}/native/manifest-groovy" destfile="${maven.build.dir}/native/groovy.jar" basedir="${maven.build.dir}/native/classes"/>
    <jar manifest="${maven.src.dir}/native/manifest-groovyc" destfile="${maven.build.dir}/native/groovyc.jar" basedir="${maven.build.dir}/native/classes"/>
    <concat destfile="${maven.build.dir}/native/groovy">
      <filelist dir="${maven.build.dir}/native" files="base,groovy.jar"/>
    </concat>
    <concat destfile="${maven.build.dir}/native/groovyc">
      <filelist dir="${maven.build.dir}/native" files="base,groovyc.jar"/>
    </concat>
    <chmod file="${maven.build.dir}/native/groovy" perm="ugo+rx"/>
  </goal>
 
</project>