# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ JAVA_PKG_IUSE="doc source test" inherit java-pkg-2 java-ant-2 DESCRIPTION="Library of matchers for building test expressions." HOMEPAGE="http://code.google.com/p/hamcrest/" SRC_URI="http://${PN}.googlecode.com/files/${P}.tgz" LICENSE="BSD-2" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="" CDEPEND=">=dev-java/easymock-2.2 >=dev-java/jmock-1.0 =dev-java/qdox-1.6.3" DEPEND=">=virtual/jdk-1.5 test? ( dev-java/ant-junit =dev-java/junit-3.8* ) >=dev-java/jarjar-0.9 ${CDEPEND}" RDEPEND=">=virtual/jre-1.5 ${CDEPEND}" src_unpack() { unpack ${A} cd ${S} find -name "*.jar" | xargs rm -v java-ant_rewrite-classpath # These jars must be symlinked as specifying them using gentoo.classpath # does not work and both compilation and test fail java-pkg_jar-from --into lib/generator qdox-1.6 qdox.jar qdox-1.6.1.jar java-pkg_jar-from --into lib/integration easymock-2 easymock.jar easymock-2.2.jar java-pkg_jar-from --into lib/integration jmock-1.0 jmock.jar jmock-1.10RC1.jar if use gcj ; then # Needed to make hamcrest compile with current gcj as jdk (cmuelle8 says hello) # Pattern.LITERAL mising from gnu classpath sed -i -e 's/\.\.\.", Pattern\.LITERAL/\\\\.\\\\.\\\\."/' \ hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java # Most weird thing here: Type.toString implementations differ (sun # returns without class prepended, gnu classpath with (.. strange) sed -i -e '/return type.toString();/ s/type.toString()/\0.replaceFirst("class ", "")/' \ hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java # Pattern.quote mising from gnu classpath sed -i -e '/Pattern.quote/ s/Pattern.quote(\("[^"]*"\|[^)]*\))/"\\\\Q" + \1 + "\\\\E"/' \ hamcrest-text/src/main/java/org/hamcrest/text/pattern/internal/ast/Literal.java fi } src_compile() { # javadoc fails if these files and directories do not exist # gjdoc does not work with sources >= java 1.5 yet (templates, etc.) if use doc && ! use gcj ; then mkdir -p ${S}/build/generated-code echo "" > ${S}/overview.html JAVADOC=javadoc fi ANT_TASKS="jarjar-1" eant bigjar $JAVADOC -Dversion=${PV} } src_test() { ANT_TASKS="ant-junit jarjar-1" eant unit-test \ -Dgentoo.classpath=$(java-pkg_getjars --build-only junit) } src_install() { for name in all core generator integration library text ; do java-pkg_newjar build/${PN}-${name}-${PV}.jar ${PN}-${name}.jar done use doc && ! use gcj && java-pkg_dojavadoc build/javadoc use source && java-pkg_dosrc ${PN}-core/src/main/java/org ${PN}-generator/src/main/java/org \ ${PN}-integration/src/main/java/org ${PN}-library/src/main/java/org \ ${PN}-text/src/main/java/org }