summaryrefslogtreecommitdiff
blob: 0cf9f87085cce4fa728b911e983b53359e8da0e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

JAVA_PKG_IUSE="doc source"

inherit java-pkg-2 java-pkg-simple

DESCRIPTION="HTML parser written in Java that can be used as a tool, library or Ant task"
HOMEPAGE="http://htmlcleaner.sourceforge.net/"
SRC_URI="mirror://sourceforge/htmlcleaner/files/${P}-src.zip"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"

CDEPEND="dev-java/jdom:2"

RDEPEND="
	${CDEPEND}
	>=virtual/jre-1.5"

DEPEND="
	${CDEPEND}
	app-arch/unzip
	dev-java/ant-core:0
	test? ( dev-java/junit:4 )
	>=virtual/jdk-1.5"

JAVA_SRC_DIR="src/main/java"
JAVA_GENTOO_CLASSPATH="jdom-2"

src_prepare() {
	# Don't require default.xml to be in the current directory.
	sed -i "s:\"default\.xml\":\"${JAVA_PKG_SHAREPATH}/default.xml\":g" \
		src/main/java/org/htmlcleaner/ConfigFileTagProvider.java || die
}

src_configure() {
	JAVA_GENTOO_CLASSPATH_EXTRA=$(java-pkg_getjars --build-only ant-core)
}

src_install() {
	java-pkg-simple_src_install
	java-pkg_register-ant-task
	java-pkg_dolauncher ${PN} --main org.${PN}.CommandLine

	insinto "${JAVA_PKG_SHAREPATH}"
	newins example.xml default.xml
}

src_test() {
	local DIR="src/test/java"
	local CP="${DIR}:${PN}.jar:$(java-pkg_getjars junit-4,${JAVA_GENTOO_CLASSPATH})"

	local TESTS=$(find "${DIR}" -name "*Test.java" ! -name "Abstract*")
	TESTS="${TESTS//src\/test\/java\/}"
	TESTS="${TESTS//.java}"
	TESTS="${TESTS//\//.}"

	ejavac -classpath "${CP}" -d "${DIR}" $(find "${DIR}" -name "*.java")
	ejunit4 -classpath "${CP}" ${TESTS}
}