summaryrefslogtreecommitdiff
blob: 5cbdaa66520d68a397f201df738ebae2858fe9e0 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

JAVA_PKG_IUSE="doc source test"
MAVEN_ID="org.jdom:jdom2:2.0.6.1"
JAVA_TESTING_FRAMEWORKS="junit-4"

inherit java-pkg-2 java-pkg-simple

DESCRIPTION="Java-based solution for accessing, manipulating, and outputting XML data"
HOMEPAGE="http://www.jdom.org"
SRC_URI="https://github.com/hunterhacker/jdom/archive/${PN^^}-${PV}.tar.gz"

LICENSE="Apache-1.1"
SLOT="2"
KEYWORDS="amd64 ~arm arm64 ppc64 x86"

# FAILURES!!!
# Tests run: 1887,  Failures: 23
RESTRICT="test"

CP_DEPEND="
	dev-java/iso-relax:0
	dev-java/jaxen:1.2
	dev-java/xalan:0
"

DEPEND="
	>=virtual/jdk-1.8:*
	${CP_DEPEND}
	test? (
		dev-java/xerces:2
	)
"

RDEPEND="
	>=virtual/jre-1.8:*
	${CP_DEPEND}
"

S="${WORKDIR}/jdom-JDOM-${PV}"

JAVA_TEST_SRC_DIR="test/src/java"
JAVA_TEST_RESOURCE_DIRS="test/src/resources"
JAVA_TEST_GENTOO_CLASSPATH="junit-4,xerces-2"

src_prepare() {
	default
	java-pkg_clean

	# Remove Android stuff to avoid junit RDEPEND.
	rm -vr contrib/src/java/org/jdom2/contrib/android || die

	# There are resources in JAVA_TEST_SRC_DIR
	cp -r test/src/{java,resources}/org || die
	# Remove .java files from JAVA_TEST_RESOURCE_DIRS
	find test/src/resources -type f -name '*.java' -exec rm -rf {} + || die "deleting classes failed"
}

src_compile() {
	JAVA_SRC_DIR="core/src/java"
	JAVA_JAR_FILENAME="jdom.jar"
	java-pkg-simple_src_compile
	JAVA_GENTOO_CLASSPATH_EXTRA+=":jdom.jar"
	rm -rf target || die

	JAVA_SRC_DIR="contrib/src/java"
	JAVA_RESOURCE_DIRS="contrib/src/resources"
	JAVA_JAR_FILENAME="jdom-contrib.jar"
	java-pkg-simple_src_compile
	JAVA_GENTOO_CLASSPATH_EXTRA+=":jdom-contrib.jar"
	rm -rf target || die

	if use doc; then
		JAVA_SRC_DIR=()
		JAVA_SRC_DIR=(
			"core/src/java"
			"contrib/src/java"
		)
		JAVA_JAR_FILENAME="ignoreme.jar"
		java-pkg-simple_src_compile
	fi
}

src_install() {
	default # https://bugs.gentoo.org/789582
	java-pkg_dojar "jdom.jar"
	java-pkg_dojar "jdom-contrib.jar"
	if use doc; then
		java-pkg_dojavadoc target/api
	fi
	if use source; then
		java-pkg_dosrc "core/src/java/*" "contrib/src/java/*"
	fi
}