[32814] trunk/dports/java/junit/Portfile

nox at macports.org nox at macports.org
Sun Jan 13 17:22:31 PST 2008


Revision: 32814
          http://trac.macosforge.org/projects/macports/changeset/32814
Author:   nox at macports.org
Date:     2008-01-13 17:22:30 -0800 (Sun, 13 Jan 2008)

Log 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.

Modified Paths:
--------------
    trunk/dports/java/junit/Portfile

Modified: trunk/dports/java/junit/Portfile
===================================================================
--- trunk/dports/java/junit/Portfile	2008-01-14 01:16:14 UTC (rev 32813)
+++ trunk/dports/java/junit/Portfile	2008-01-14 01:22:30 UTC (rev 32814)
@@ -1,42 +1,114 @@
 # $Id$
 
-PortSystem 1.0
+PortSystem      1.0
 
-name		junit
-version		3.8.1
-revision	1
-categories	java devel
-platforms	darwin
-maintainers	nomaintainer
-description	Java framework for repeatable tests
-long_description	JUnit is a simple framework to write repeatable tests. \
-			It is an instance of the xUnit architecture for unit \
-			testing frameworks.
+name            junit
+version         4.4
+categories      java devel
+platforms       darwin
+maintainers     nox
+description     Java framework for repeatable tests
 
-homepage	http://www.junit.org/
-master_sites	sourceforge
-distname	${name}${version}
-use_zip		yes
-checksums	md5 5110326e4b7f7497dfa60ede4b626751
+long_description \
+    JUnit is a simple framework to write repeatable tests. \
+    It is an instance of the xUnit architecture for unit \
+    testing frameworks.
 
-depends_lib	bin:java:kaffe
-depends_build	bin:ant:apache-ant
+homepage        http://www.junit.org/
+master_sites    sourceforge
+distname        ${name}${version}
+use_zip         yes
 
-post-extract	{
-	system "cd ${worksrcpath} && ${extract.cmd} src.jar"
+checksums       md5 4755aa0af58a834bedce1f0119dc9514 \
+                sha1 83be34288bf8e595a6eb5a1de9c6cd96042d8c32 \
+                rmd160 915d20222030f5678a2d74cf07080a305c0c1407
+
+post-extract {
+    file mkdir ${worksrcpath}/src
+    system "cd ${worksrcpath}/src && jar -xvf ../${name}-${version}-src.jar"
+    
+    eval delete ${worksrcpath}/javadoc ${worksrcpath}/temp.hamcrest.source \
+        [glob -directory ${worksrcpath} *.jar]
+    
+    fs-traverse {f} ${worksrcpath} {
+        if {[string match *.class ${f}]} {
+            delete ${f}
+        }
+    }
 }
 
-use_configure	no
+depends_lib     port:hamcrest-core
 
-build.cmd	ant
-build.target	dist
+use_configure   no
 
-destroot	{
-	xinstall -d -m 755 ${destroot}${prefix}/share/java/apache-ant/lib \
-		${destroot}${prefix}/share/doc
-	xinstall -m 644 ${worksrcpath}/${name}${version}/junit.jar \
-		${destroot}${prefix}/share/java/
-	file copy ${worksrcpath}/javadoc ${destroot}${prefix}/share/doc/${name}
-	system "cd ${destroot}${prefix}/share/java/apache-ant/lib/ && \
-		ln -sf ../../junit.jar"
+set docdir      ${prefix}/share/doc/${name}-${version}
+set javadir     ${prefix}/share/java
+set hamcrestpkg ${javadir}/hamcrest-all-1.1.jar
+set junitpkg    junit.jar
+set l           [string length ${worksrcpath}/]
+
+build {
+    set sources {}
+
+    fs-traverse {f} ${worksrcpath}/src {
+        if {[string match *.java ${f}]} {
+            lappend sources [string range ${f} ${l} end]
+        }
+    }
+    
+     file mkdir ${worksrcpath}/classes
+     foreach {source} ${sources} {
+         set cmdstring "cd ${worksrcpath} && javac -d classes -cp ${hamcrestpkg} -sourcepath src ${source}"
+         ui_debug ${cmdstring}
+         system ${cmdstring}
+     }
+
+    set cmdstring "cd ${worksrcpath} && jar -cf ${worksrcpath}/${junitpkg} -C classes ."
+    ui_debug ${cmdstring}
+    system ${cmdstring}
 }
+
+test {
+    set sources {}
+    
+    fs-traverse {f} "${worksrcpath}/junit/tests ${worksrcpath}/org/junit/tests" {
+        if {[string match *.java ${f}]} {
+            lappend sources [string range ${f} ${l} end]
+        }
+    }
+    
+     file mkdir ${worksrcpath}/classes
+     foreach {source} ${sources} {
+         set cmdstring "cd ${worksrcpath} && javac -d classes -cp ${hamcrestpkg}:${junitpkg} -sourcepath . ${source}"
+         ui_debug ${cmdstring}
+         system ${cmdstring}
+     }
+
+    foreach {p} {junit org.junit} {
+        set class ${p}.tests.AllTests
+        set cmdstring "cd ${worksrcpath} && java -cp classes:${junitpkg}:${hamcrestpkg} org.junit.runner.JUnitCore ${class}"
+        ui_debug ${cmdstring}
+        system ${cmdstring}
+    }
+}
+
+destroot {
+    xinstall -d ${destroot}${javadir} ${destroot}${docdir}
+    xinstall -m 0644 ${worksrcpath}/${junitpkg} ${destroot}${javadir}
+    copy ${worksrcpath}/doc ${destroot}${docdir}/html
+}
+
+variant doc description {Install extra documentation} {
+    post-build {
+        file mkdir ${worksrcpath}/javadoc
+        set cmdstring "cd ${worksrcpath} && javadoc -d javadoc -sourcepath src -subpackages junit:org -classpath .:${hamcrestpkg}"
+        ui_debug ${cmdstring}
+        system ${cmdstring}
+    }
+    
+    post-destroot {
+        file copy ${worksrcpath}/javadoc ${destroot}${docdir}/
+    }
+}
+
+universal_variant   no

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080113/68429bee/attachment.html


More information about the macports-changes mailing list