source: trunk/dports/java/junit/Portfile @ 41789

Last change on this file since 41789 was 41789, checked in by nox@…, 11 years ago

junit: Updated to 4.5.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 41789 2008-11-10 18:37:07Z nox@macports.org $
3
4PortSystem      1.0
5
6name            junit
7version         4.5
8categories      java devel
9platforms       darwin
10maintainers     nox
11description     Java framework for repeatable tests
12
13long_description \
14    JUnit is a simple framework to write repeatable tests. \
15    It is an instance of the xUnit architecture for unit \
16    testing frameworks.
17
18homepage        http://www.junit.org/
19master_sites    sourceforge
20distname        ${name}${version}
21use_zip         yes
22
23checksums       md5     6d534ce2169e26cc3b6ac36072ce2f5f \
24                sha1    75d642adaf15091c7ca9ed54f0f2f058bd9ec653 \
25                rmd160  3c5900d6f7d854be2648ee705f95e090dc44f6b0
26
27post-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    }
39}
40
41depends_lib     port:hamcrest-core
42
43use_configure   no
44
45set docdir      ${prefix}/share/doc/${name}-${version}
46set javadir     ${prefix}/share/java
47set hamcrestpkg ${javadir}/hamcrest-core.jar
48set junitpkg    junit.jar
49set l           [string length ${worksrcpath}/]
50
51build {
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
72test {
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}
95
96destroot {
97    xinstall -d ${destroot}${javadir} ${destroot}${docdir}
98    xinstall -m 0644 ${worksrcpath}/${junitpkg} ${destroot}${javadir}
99    copy ${worksrcpath}/doc ${destroot}${docdir}/html
100}
101
102variant 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    }
109   
110    post-destroot {
111        file copy ${worksrcpath}/javadoc ${destroot}${docdir}/
112    }
113}
114
115universal_variant   no
Note: See TracBrowser for help on using the repository browser.