Changeset 52233 for trunk/dports/java


Ignore:
Timestamp:
Jun 12, 2009, 8:19:26 PM (11 years ago)
Author:
nox@…
Message:

junit:

  • Use ant.
  • Fix hamcrest 1.2 incompatibilites.
Location:
trunk/dports/java/junit
Files:
4 added
1 edited

Legend:

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

    r50010 r52233  
    66name            junit
    77version         4.6
     8revision        1
    89categories      java devel
    910platforms       darwin
     
    2526                rmd160  4f87024e91b7252af89ad925db5cda0e17128525
    2627
     28patchfiles      patch-build.xml.diff \
     29                patch-src-main-java-org-junit-matchers-package-info.java.diff \
     30                patch-hamcrest-1.2-upgrade.diff
     31
    2732post-extract {
    28     file mkdir ${worksrcpath}/src
    29     system "cd ${worksrcpath}/src && jar -xvf ../${name}-${version}-src.jar"
    30    
    31     eval delete ${worksrcpath}/javadoc ${worksrcpath}/temp.hamcrest.source \
    32         [glob -directory ${worksrcpath} *.jar]
    33    
    34     fs-traverse {f} ${worksrcpath} {
    35         if {[string match *.class ${f}]} {
    36             delete ${f}
    37         }
    38     }
     33    file mkdir ${worksrcpath}/src/main/java
     34    system "cd ${worksrcpath}/src/main/java && jar xvf ${worksrcpath}/${name}-${version}-src.jar"
    3935}
    4036
     37
     38depends_build   bin:ant:apache-ant
    4139depends_lib     port:hamcrest-core
    4240
    4341use_configure   no
    4442
     43build.cmd       ant
     44build.target    build
     45build.args      -Dprefix=${prefix} \
     46                -Dtestsrc=org/junit/tests \
     47                -Ddist=.
     48
    4549set docdir      ${prefix}/share/doc/${name}-${version}
    4650set javadir     ${prefix}/share/java
    47 set hamcrestpkg ${javadir}/hamcrest-core.jar
    4851set junitpkg    junit.jar
    49 set l           [string length ${worksrcpath}/]
    50 
    51 build {
    52     set sources {}
    53 
    54     fs-traverse {f} ${worksrcpath}/src {
    55         if {[string match *.java ${f}]} {
    56             lappend sources [string range ${f} ${l} end]
    57         }
    58     }
    59    
    60      file mkdir ${worksrcpath}/classes
    61      foreach {source} ${sources} {
    62          set cmdstring "cd ${worksrcpath} && javac -d classes -cp ${hamcrestpkg} -sourcepath src ${source}"
    63          ui_debug ${cmdstring}
    64          system ${cmdstring}
    65      }
    66 
    67     set cmdstring "cd ${worksrcpath} && jar -cf ${worksrcpath}/${junitpkg} -C classes ."
    68     ui_debug ${cmdstring}
    69     system ${cmdstring}
    70 }
    71 
    72 test {
    73     set sources {}
    74    
    75     fs-traverse {f} "${worksrcpath}/junit/tests ${worksrcpath}/org/junit/tests" {
    76         if {[string match *.java ${f}]} {
    77             lappend sources [string range ${f} ${l} end]
    78         }
    79     }
    80    
    81      file mkdir ${worksrcpath}/classes
    82      foreach {source} ${sources} {
    83          set cmdstring "cd ${worksrcpath} && javac -d classes -cp ${hamcrestpkg}:${junitpkg} -sourcepath . ${source}"
    84          ui_debug ${cmdstring}
    85          system ${cmdstring}
    86      }
    87 
    88     foreach {p} {junit org.junit} {
    89         set class ${p}.tests.AllTests
    90         set cmdstring "cd ${worksrcpath} && java -cp classes:${junitpkg}:${hamcrestpkg} org.junit.runner.JUnitCore ${class}"
    91         ui_debug ${cmdstring}
    92         system ${cmdstring}
    93     }
    94 }
    9552
    9653destroot {
     54    system "jar cvf ${worksrcpath}/${junitpkg} -C ${worksrcpath}/target/main ."
    9755    xinstall -d ${destroot}${javadir} ${destroot}${docdir}
    9856    xinstall -m 0644 ${worksrcpath}/${junitpkg} ${destroot}${javadir}
     
    10159
    10260variant doc description {Install extra documentation} {
    103     post-build {
    104         file mkdir ${worksrcpath}/javadoc
    105         set cmdstring "cd ${worksrcpath} && javadoc -d javadoc -sourcepath src -subpackages junit:org -classpath .:${hamcrestpkg}"
    106         ui_debug ${cmdstring}
    107         system ${cmdstring}
    108     }
     61    build.target-append javadoc
    10962   
    11063    post-destroot {
Note: See TracChangeset for help on using the changeset viewer.