Project

General

Profile

« Previous | Next » 

Revision 1939

Added by brooke over 20 years ago

overhaul of ant build file. removed duplicate code for getting dtds and schema. Renamed these targets, pulled all code for copying xsl into a single target (still need separate targets for getting beta6 eml files nad eml2+ files, since older version uses dtds instead of schema.) In future, as eml versions are added, the geteml2+ target shoudl be updated to use the ant iterator class found in the utilities module - this would enable the cvs tags to be defined as a comma-delimited list, and then a common target can be called multile times to do the checkouts, instead of duplicating code. Also added description= attributes to all the targets that looked as if they shoudl be public. These now appear (with their descriptions) when the user types ant -projecthelp

View differences:

build.xml
272 272
      </copy>
273 273
   </target>
274 274

  
275
   <target name="compile" depends="prepare,utilities">
275
   <target name="compile" depends="prepare,utilities"
276
    description="Compiles java code to build dir, and copies metacat + srb props files there">
277

  
276 278
       <javac srcdir="${build.src}"
277 279
              destdir="${build.dest}"
278 280
              classpath="${cpath}"
......
285 287
             tofile="${build.dest}/${package.home}/srbProps.properties"/>
286 288
   </target>
287 289

  
288
   <target name="jar" depends="compile">
290
   <target name="jar" depends="compile"
291
    description="Compiles and jars metacat java code to metacat.jar in build dir">
292

  
289 293
       <delete file="${build.dir}/${name}.jar" />
290 294
       <copy todir="${build.dest}">
291 295
         <fileset dir="lib/srbrmi"/>
......
294 298
            excludes="**/protocols/" />
295 299
   </target>
296 300

  
297
   <target name="protocol" depends="compile">
301
   <target name="protocol" depends="compile"
302
    description="Compiles and jars protocol java code to protocol.jar in build dir">
298 303
       <delete file="${build.dir}/protocol.jar" />
299 304
       <jar jarfile="${build.dir}/protocol.jar" basedir="${build.dest}"
300 305
            includes="**/protocols/" />
......
307 312
     <copy file="${utilitiesdir}/build/utilities.jar" todir="lib" />
308 313
   </target>
309 314

  
310
   <target name="client" depends="utilities, prepare">
315
   <target name="client" depends="utilities, prepare"
316
    description="Compiles metacat-client java code to build dir">
311 317
       <javac srcdir="${build.src}"
312 318
              destdir="${build.dest}"
313 319
              classpath="${cpath}"
314 320
              includes="edu/ucsb/nceas/metacat/client/*" />
315 321
   </target>
316 322

  
317
   <target name="clientjar" depends="client">
323
   <target name="clientjar" depends="client"
324
    description="Compiles and jars metacat-client java code to metacat-client.jar in build dir">
318 325
       <delete file="${build.dir}/${name}-client.jar" />
319 326
       <jar jarfile="${build.dir}/${name}-client.jar" basedir="${build.dest}"
320 327
            includes="**/metacat/client/" />
321 328
   </target>
322 329

  
323
   <target name="getdtdschema" depends="prepare">
330
   <target  name="geteml" depends="getemlpre2,geteml2+" 
331
            description="Calls getemlpre2 and geteml2+ targets" />
332

  
333
   <target name="getemlpre2" depends="prepare"
334
   description="Checks EML-beta6 out of cvs and copies dtds and xsl to your metacat cvs sandbox">
324 335
     <echo>Enter CVS password: </echo>
325 336
     <cvs cvsRoot="${cvsroot}"
326 337
          package="${eml-module}"
327 338
          tag="${eml-tag}"
328
          dest="${build.tmp}" />
339
          dest="${build.tmp}/eml_${eml-tag}" />
329 340
     <mkdir dir="lib/dtd" />
330 341
     <copy todir="lib/dtd" filtering="yes">
331
       <fileset dir="${build.tmp}/${eml-module}">
342
       <fileset dir="${build.tmp}/eml_${eml-tag}/${eml-module}">
332 343
         <include name="*.dtd"/>
333 344
       </fileset>
334 345
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
335 346
     </copy>
336
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
337
       <fileset dir="${build.tmp}/${eml-module}/style">
338
       <include name="**/*.xsl"/>
339
     </fileset>
340
     </copy>     <echo>Enter CVS password: </echo>
347
     <antcall target="copyxsl">
348
        <param name="cvs.tagname" value="${eml-tag}" />
349
     </antcall>
350
   </target>
351

  
352
   <target name="geteml2+" depends="prepare"
353
   description="Checks eml-2 out of cvs and copies schema and xsl to your metacat cvs sandbox">
354
     <echo>Enter CVS password: </echo>
341 355
     <cvs cvsRoot="${cvsroot}"
342 356
          package="${eml-module}"
343 357
          tag="${eml2-tag}"
344
          dest="${build.tmp}" />
358
          dest="${build.tmp}/eml_${eml2-tag}" />
345 359
     <mkdir dir="lib/schema" />
346 360
     <copy todir="lib/schema" filtering="yes">
347
       <fileset dir="${build.tmp}/${eml-module}">
361
       <fileset dir="${build.tmp}/eml_${eml2-tag}/${eml-module}">
348 362
         <include name="*.xsd"/>
349 363
       </fileset>
364
       
365
       <!-- shouldn't we have a mapper here like this??
366
       <mapper type="glob" from="eml-*.xsd" to="eml-*-${eml-version}.xsd" />
367
       
368
       Jing's code didn't nave one - does it need to be added? 
369
       NOTE that eml-version is set to beta 6, so this would need changing -->
370
     
350 371
     </copy>
372
     <antcall target="copyxsl">
373
        <param name="cvs.tagname" value="${eml2-tag}" />
374
     </antcall>
375
   </target>
376
   
377
   
378

  
379
   <target  name="copyxsl" 
380
   description="Copies xsl stylesheets from checkout in build/tmp to your metacat cvs sandbox">
381

  
382
     <delete file="${style-common-cvsrelpath}/${eml-css}"/>
383
     
351 384
     <copy todir="${style-common-cvsrelpath}" filtering="yes">
352
       <fileset dir="${build.tmp}/${eml-module}/style">
385
       <fileset dir="${build.tmp}/eml_${cvs.tagname}/${eml-module}/style">
353 386
       <include name="**/*.xsl"/>
354 387
     </fileset>
355 388
     </copy>
356 389
     
390

  
357 391
     <!-- now copy default css from eml module and put it in style-common-path 
358 392
          dir with a new name, so other skin-specific css can import it if reqd -->
359
     <copy file="${build.tmp}/${eml-module}/${eml-module.default.css}"
393
     <copy file="${build.tmp}/eml_${cvs.tagname}/${eml-module}/${eml-module.default.css}"
360 394
           tofile="${style-common-cvsrelpath}/${eml-css}" />
361
   </target>
362 395

  
363
   <target name="getdtd" depends="prepare">
364
     <echo>Enter CVS password: </echo>
365
     <cvs cvsRoot="${cvsroot}"
366
          package="${eml-module}"
367
          tag="${eml-tag}"
368
          dest="${build.tmp}" />
369
     <mkdir dir="lib/dtd" />
370
     <copy todir="lib/dtd" filtering="yes">
371
       <fileset dir="${build.tmp}/${eml-module}">
372
         <include name="*.dtd"/>
373
       </fileset>
374
       <mapper type="glob" from="eml-*.dtd" to="eml-*-${eml-version}.dtd" />
375
     </copy>
376 396
   </target>
377

  
378
   <target name="getschema" depends="prepare">
379
     <echo>Enter CVS password: </echo>
380
     <cvs cvsRoot="${cvsroot}"
381
          package="${eml-module}"
382
          tag="${eml2-tag}"
383
          dest="${build.tmp}" />
384
     <mkdir dir="lib/schema" />
385
     <copy todir="lib/schema" filtering="yes">
386
       <fileset dir="${build.tmp}/${eml-module}">
387
         <include name="*.xsd"/>
388
       </fileset>
389
     </copy>
390
     <copy todir="lib/style/common">
391
       <fileset dir="${build.tmp}/${eml-module}/style">
392
       <include name="**/*.xsl"/>
393
     </fileset>
394
     </copy>
395
   </target>
396

  
397
   <target name="dtdschemasql" depends="prepare">
397
   
398
   
399
   
400
   <target name="dtdschemasql" depends="prepare"
401
   description="Registers the DTDs with the new Metacat instance">
398 402
     <echo/>
399 403
     <echo>Registering the DTDs with the new Metacat instance...</echo>
400 404
     <sql driver="${dbDriver}"
......
405 409
          src="${build.src}/loaddtdschema.sql" />
406 410
   </target>
407 411

  
408
   <target name="schemasql" depends="prepare">
412
   <target name="schemasql" depends="prepare"
413
            description="Registers the Schema with the new Metacat instance">
409 414
     <echo/>
410
     <echo>Registering the DTDs with the new Metacat instance...</echo>
415
     <echo>Registering the Schema with the new Metacat instance...</echo>
411 416
     <sql driver="${dbDriver}"
412 417
          classpath="${jdbc}:${jdbc-add1}:${jdbc-add2}"
413 418
          url="${jdbc-connect}"
......
416 421
          src="${build.src}/loadschema.sql" />
417 422
   </target>
418 423
   
419
   <target name="installdb" depends="prepare">
424
   <target name="installdb" depends="prepare"
425
            description="Installs the database tables">
420 426
     <echo/>
421 427
     <echo>Installing the database tables...</echo>
422 428
     <sql driver="${dbDriver}"
......
427 433
          src="${build.src}/xmltables.sql" />
428 434
   </target>
429 435

  
430
   <target name="upgrade12" depends="prepare">
436
   <target name="upgrade12" depends="prepare"
437
            description="Updates the database tables to upgrade to version 1.2">
431 438
     <echo/>
432 439
     <echo>Updating the database tables to upgrade to version 1.2...</echo>
433 440
     <sql driver="${dbDriver}"
......
438 445
          src="${build.src}/upgrade-db-to-1.2.sql" />
439 446
   </target>
440 447

  
441
   <target name="upgrade13" depends="prepare">
448
   <target name="upgrade13" depends="prepare"
449
            description="Updates the database tables to upgrade to version 1.3">
442 450
     <echo/>
443 451
     <echo>Updating the database tables to upgrade to version 1.3...</echo>
444 452
     <sql driver="${dbDriver}"
......
449 457
          src="${build.src}/upgrade-db-to-1.3.sql" />
450 458
   </target>
451 459

  
452
   <target name="installCommon" depends="jar,clientjar">
460
   <target name="installCommon" depends="jar,clientjar"
461
            description="* basic metacat install for web-server files *">
453 462
       <mkdir dir="${datafilepath}" />
454 463
       <mkdir dir="${inlinedatafilepath}" />
455 464
       <chmod dir="${datafilepath}" perm="ug+w" />
......
517 526
        <echo> Install Other Database</echo>
518 527
   </target>
519 528
   
520
   <target name="install" depends="installMSSQL, installother">
521
     
522
   </target>
529
   <target name="install" depends="installMSSQL,installother" 
530
            description="* Full Install *" />
523 531
   
524
   <target name="install-registry" depends="init">
532
   <target name="install-registry" depends="init" 
533
            description="Install Registry">
534
            
525 535
      <copy file="${srcdir}/perl/register-dataset.cgi"
526 536
            todir="${inst.cgi.dir}" filtering="yes"/>
527 537
      <chmod file="${inst.cgi.dir}/register-dataset.cgi" perm="ugo+x" />
......
537 547
      <echo message="Install Registry completed." />
538 548
   </target>
539 549

  
540
   <target name="getBeta6ConversionStyles" depends="prepare">
550
   <target name="getBeta6ConversionStyles" depends="prepare"
551
            description="Gets the conversion stylesheets for eml2 beta 6 to eml 2.0.0">
541 552
     <echo>Enter CVS password: </echo>
542 553
     <cvs cvsRoot="${cvsroot-alternate}"
543 554
          package="${conversion-module}"
......
563 574
                includes="**/*.class" />
564 575
   </target>
565 576

  
566
   <target name="test" depends="testprep">
577
   <target name="test" depends="testprep"
578
            description="Uses the ant junit task to run all JUnit tests">
567 579

  
568 580
      <!-- use the ant "junit" task to run JUnit tests. -->
569 581
      <junit printsummary="yes" haltonfailure="no" fork="yes"
......
583 595
     </junit>
584 596
   </target>
585 597

  
586
    <target name="runonetest" depends="testprep">
587
      <echo>testtorun: ${testtorun}</echo>
598
    <target name="runonetest" depends="testprep"
599
            description="Uses the ant junit task to run a single JUnit test, defined by the ${testtorun} property">
588 600

  
601
              <echo>testtorun: ${testtorun}</echo>
602

  
589 603
      <!-- use the ant "junit" task to run JUnit tests. -->
590 604
      <junit printsummary="yes" haltonfailure="no" fork="yes"
591 605
             haltonerror="no">
......
604 618
     </junit>
605 619
   </target>
606 620

  
607
  <target name="gethttpclient" depends="prepare">
621
  <target name="gethttpclient" depends="prepare"
622
            description="checks out and compiles morpho httpclient code">
608 623
  <!--mkdir dir="${morphosourcedir}" -->
609 624
        <cvs cvsRoot="${cvsroot}"
610 625
             package="morpho"
......
613 628
   </target>
614 629

  
615 630
   <!-- run this target, we need to check out a another morpho souce dir was checked out. -->
616
   <target name="nettest" depends="install">
631
   <target name="nettest" depends="install"
632
            description="compiles and runs the metacatnettest code">
633
            
617 634
      <echo>***********************************
618 635
      Please run ant gethttpclient first!
619 636
      ***********************************
......
647 664
     </junit>
648 665
   </target>
649 666

  
650
   <target name="servletclean" depends="clean">
667
   <target name="cleanweb" depends="clean"
668
            description="deletes tomcat web context dir and all its contents">
651 669
     <delete dir="${installdir}" />
652 670
   </target>
653 671

  
654 672

  
655
   <target name="clean" depends="init">
673
   <target name="clean" depends="init"
674
            description="deletes build dir and any files copied to cvs sandbox by build process (jars, xsl) Currently *not* schema/DTDs">
656 675
       <delete dir="${build.dir}" />
657 676
       <delete file="lib/httpclient.jar" />
658 677
       <delete file="lib/utilities.jar" />
678
       <delete includeEmptyDirs="true" failonerror="false">
679
         <fileset dir="${style-common-cvsrelpath}">
680
           <include name="${eml-css}" />
681
           <include name="eml-*/*.xsl" />
682
           <include name="eml-*" />
683
         </fileset>
684
     </delete>
659 685
   </target>
660 686

  
661
   <target name="jdoc" depends="prepare">
687
   <target name="jdoc" depends="prepare"
688
            description="generates javadoc documentation">
662 689
       <javadoc packagenames="edu.ucsb.nceas.*"
663 690
           sourcepath="${build.src}"
664 691
           destdir="${build.javadocs}"
......
671 698
       />
672 699
   </target>
673 700

  
674
   <target name="dist" depends="jar,protocol,jdoc,getdtd,getschema">
701
   <target name="dist" depends="jar,protocol,jdoc,geteml"
702
            description="prepares a full release distribution">
675 703
      <mkdir dir="${dist.dir}"/>
676 704
      <delete dir="${ver.dir}" />
677 705
      <mkdir dir="${ver.dir}"/>
......
707 735
      <delete file="./${name}-${release}.tar" />
708 736
  </target>
709 737

  
710
  <target name="distsrc" depends="dist">
738
  <target name="distsrc" depends="dist"
739
            description="prepares a source distribution">
711 740
      <mkdir dir="${ver.src}"/>
712 741
      <copy todir="${ver.src}">
713 742
        <fileset dir="./src"/>
......
724 753
  </target>
725 754

  
726 755
   <target name="stylesheettest">
727
     <xslt in="${input}" out="eml.html" style="lib/style/common/eml-2.0.0/eml-2.0.0.xsl">
756
     <xslt in="${input}" out="eml.html" style="${style-common-cvsrelpath}/eml-2.0.0/eml-2.0.0.xsl">
728 757
      <param name="displaymodule" expression="${displaymodule}"/>
729 758
      <param name="docid" expression="${input}"/>
730 759
      <param name="entitytype" expression="${entitytype}"/>

Also available in: Unified diff