blob: be6ed0e4a65e320b89797e5e2f6b669ccca97f74 (
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
JAVA_PKG_IUSE="source test doc"
inherit java-pkg-2 java-pkg-simple
DESCRIPTION="Java API to manipulate XML data"
SRC_URI="http://www.jdom.org/dist/binary/${P}.zip"
HOMEPAGE="http://www.jdom.org"
LICENSE="JDOM"
SLOT="2"
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
CDEPEND="
test? (
dev-java/junit:4
)
dev-java/xalan:0
dev-java/jaxen:1.1
dev-java/iso-relax:0
dev-java/xml-commons-external:1.4"
RDEPEND=">=virtual/jre-1.6
${CDEPEND}"
DEPEND=">=virtual/jdk-1.6
app-arch/unzip
${CDEPEND}"
IUSE=""
S="${WORKDIR}"
JAVA_GENTOO_CLASSPATH="xalan,jaxen-1.1,iso-relax,xml-commons-external-1.4"
JAVA_SRC_DIR="org"
# Dubious tests:
# They either do not pass or don't have runnable methods (i.e. tests)
UNIT_TESTS=(
org/jdom2/test/cases/input/sax/TestXMLReaderSAX2Factory.java
org/jdom2/test/cases/input/sax/TestXMLReaderSingletons.java
org/jdom2/test/cases/input/sax/TestXMLReaderXSDFactory.java
org/jdom2/test/cases/input/sax/TestXMLReaderJAXPFactory.java
org/jdom2/test/cases/input/sax/TestXMLReaderSchemaFactory.java
org/jdom2/test/cases/input/TestSAXComplexSchema.java
org/jdom2/test/cases/input/TestSAXBuilder.java
org/jdom2/test/cases/input/TestSAXHandler.java
org/jdom2/test/cases/input/TestDOMBuilder.java
org/jdom2/test/cases/input/TestDTDParser.java
org/jdom2/test/cases/input/TestJDOMParseExceptn.java
org/jdom2/test/cases/input/TestStAXEventBuilder.java
org/jdom2/test/cases/input/TestBuilderErrorHandler.java
org/jdom2/test/cases/input/TestStAXStreamBuilder.java
org/jdom2/test/cases/input/HelpTestDOMBuilder.java
org/jdom2/test/cases/special/TestIssue008ExpandEntity.java
org/jdom2/test/cases/located/TestLocatedJDOMFactory.java
org/jdom2/test/cases/xpath/TestJaxenXPathHelper.java
org/jdom2/test/cases/xpath/TestDefaultXPathHelper.java
)
src_unpack() {
default
cd "${S}"
unpack ./"${P}-sources".jar
}
java_prepare() {
find "${S}"/lib -type f -delete || die
if use test; then
JAVA_GENTOO_CLASSPATH+=",junit-4"
else
# Override the array with different files.
UNIT_TESTS=(
org/jdom2/test
org/jdom2/Test*.java
org/jdom2/contrib/android/TranslateTests.java
org/jdom2/input/sax/TestTextBuffer.java
)
fi
rm -rf "${UNIT_TESTS[@]}" || die
}
src_compile() {
java-pkg-simple_src_compile
}
src_install() {
java-pkg-simple_src_install
use source && java-pkg_dosrc org
}
src_test() {
local DIR="org/jdom2/test"
local CP="${DIR}:${PN}.jar:$(java-pkg_getjars junit-4,${JAVA_GENTOO_CLASSPATH})"
local TESTS=()
while read -d $'\0' -r file; do
basefile=$(basename ${file})
{
# Skip if starts with Abstract
[[ ${basefile} =~ ^Abstract ]] || \
# Skip if doesn't starts with Test
[[ ! ${basefile} =~ ^Test ]] || \
# Skip if doesn't end with the .java extension
[[ ! ${basefile} =~ \.java$ ]]
} && continue
TESTS+=(${file})
done < <(find "${DIR}" -type f -print0)
# Turn ${TESTS[@}} array into a string
TESTS="${TESTS[@]}"
TESTS="${TESTS//src\/test\/java\/}"
TESTS="${TESTS//.java}"
TESTS="${TESTS//\//.}"
ejunit4 -classpath "${CP}" ${TESTS}
}
|