Changeset 32814 for trunk/dports/java


Ignore:
Timestamp:
Jan 14, 2008, 1:22:30 AM (12 years ago)
Author:
nox@…
Message:

junit:

  • Updated to 4.4.
  • Removed kaffe lib dependency.
  • apache-ant is now a port-type build dependency.
  • Now depends on hamcrest-core from r32813.
  • Added test support.
  • Added doc variant, which installs API documentation.
  • Disabled universal variant.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/java/junit/Portfile

    r30233 r32814  
    11# $Id$
    22
    3 PortSystem 1.0
     3PortSystem      1.0
    44
    5 name            junit
    6 version         3.8.1
    7 revision        1
    8 categories      java devel
    9 platforms       darwin
    10 maintainers     nomaintainer
    11 description     Java framework for repeatable tests
    12 long_description        JUnit is a simple framework to write repeatable tests. \
    13                         It is an instance of the xUnit architecture for unit \
    14                         testing frameworks.
     5name            junit
     6version         4.4
     7categories      java devel
     8platforms       darwin
     9maintainers     nox
     10description     Java framework for repeatable tests
    1511
    16 homepage        http://www.junit.org/
    17 master_sites    sourceforge
    18 distname        ${name}${version}
    19 use_zip         yes
    20 checksums       md5 5110326e4b7f7497dfa60ede4b626751
     12long_description \
     13    JUnit is a simple framework to write repeatable tests. \
     14    It is an instance of the xUnit architecture for unit \
     15    testing frameworks.
    2116
    22 depends_lib     bin:java:kaffe
    23 depends_build   bin:ant:apache-ant
     17homepage        http://www.junit.org/
     18master_sites    sourceforge
     19distname        ${name}${version}
     20use_zip         yes
    2421
    25 post-extract    {
    26         system "cd ${worksrcpath} && ${extract.cmd} src.jar"
     22checksums       md5 4755aa0af58a834bedce1f0119dc9514 \
     23                sha1 83be34288bf8e595a6eb5a1de9c6cd96042d8c32 \
     24                rmd160 915d20222030f5678a2d74cf07080a305c0c1407
     25
     26post-extract {
     27    file mkdir ${worksrcpath}/src
     28    system "cd ${worksrcpath}/src && jar -xvf ../${name}-${version}-src.jar"
     29   
     30    eval delete ${worksrcpath}/javadoc ${worksrcpath}/temp.hamcrest.source \
     31        [glob -directory ${worksrcpath} *.jar]
     32   
     33    fs-traverse {f} ${worksrcpath} {
     34        if {[string match *.class ${f}]} {
     35            delete ${f}
     36        }
     37    }
    2738}
    2839
    29 use_configure   no
     40depends_lib     port:hamcrest-core
    3041
    31 build.cmd       ant
    32 build.target    dist
     42use_configure   no
    3343
    34 destroot        {
    35         xinstall -d -m 755 ${destroot}${prefix}/share/java/apache-ant/lib \
    36                 ${destroot}${prefix}/share/doc
    37         xinstall -m 644 ${worksrcpath}/${name}${version}/junit.jar \
    38                 ${destroot}${prefix}/share/java/
    39         file copy ${worksrcpath}/javadoc ${destroot}${prefix}/share/doc/${name}
    40         system "cd ${destroot}${prefix}/share/java/apache-ant/lib/ && \
    41                 ln -sf ../../junit.jar"
     44set docdir      ${prefix}/share/doc/${name}-${version}
     45set javadir     ${prefix}/share/java
     46set hamcrestpkg ${javadir}/hamcrest-all-1.1.jar
     47set junitpkg    junit.jar
     48set l           [string length ${worksrcpath}/]
     49
     50build {
     51    set sources {}
     52
     53    fs-traverse {f} ${worksrcpath}/src {
     54        if {[string match *.java ${f}]} {
     55            lappend sources [string range ${f} ${l} end]
     56        }
     57    }
     58   
     59     file mkdir ${worksrcpath}/classes
     60     foreach {source} ${sources} {
     61         set cmdstring "cd ${worksrcpath} && javac -d classes -cp ${hamcrestpkg} -sourcepath src ${source}"
     62         ui_debug ${cmdstring}
     63         system ${cmdstring}
     64     }
     65
     66    set cmdstring "cd ${worksrcpath} && jar -cf ${worksrcpath}/${junitpkg} -C classes ."
     67    ui_debug ${cmdstring}
     68    system ${cmdstring}
    4269}
     70
     71test {
     72    set sources {}
     73   
     74    fs-traverse {f} "${worksrcpath}/junit/tests ${worksrcpath}/org/junit/tests" {
     75        if {[string match *.java ${f}]} {
     76            lappend sources [string range ${f} ${l} end]
     77        }
     78    }
     79   
     80     file mkdir ${worksrcpath}/classes
     81     foreach {source} ${sources} {
     82         set cmdstring "cd ${worksrcpath} && javac -d classes -cp ${hamcrestpkg}:${junitpkg} -sourcepath . ${source}"
     83         ui_debug ${cmdstring}
     84         system ${cmdstring}
     85     }
     86
     87    foreach {p} {junit org.junit} {
     88        set class ${p}.tests.AllTests
     89        set cmdstring "cd ${worksrcpath} && java -cp classes:${junitpkg}:${hamcrestpkg} org.junit.runner.JUnitCore ${class}"
     90        ui_debug ${cmdstring}
     91        system ${cmdstring}
     92    }
     93}
     94
     95destroot {
     96    xinstall -d ${destroot}${javadir} ${destroot}${docdir}
     97    xinstall -m 0644 ${worksrcpath}/${junitpkg} ${destroot}${javadir}
     98    copy ${worksrcpath}/doc ${destroot}${docdir}/html
     99}
     100
     101variant doc description {Install extra documentation} {
     102    post-build {
     103        file mkdir ${worksrcpath}/javadoc
     104        set cmdstring "cd ${worksrcpath} && javadoc -d javadoc -sourcepath src -subpackages junit:org -classpath .:${hamcrestpkg}"
     105        ui_debug ${cmdstring}
     106        system ${cmdstring}
     107    }
     108   
     109    post-destroot {
     110        file copy ${worksrcpath}/javadoc ${destroot}${docdir}/
     111    }
     112}
     113
     114universal_variant   no
Note: See TracChangeset for help on using the changeset viewer.