Diff jdom-1.1.3-r1 with a jdom-2.0.6.1

/usr/portage/dev-java/jdom/jdom-2.0.6.1.ebuild 2023-10-09 14:52:29.428368349 +0300
1
# Copyright 1999-2021 Gentoo Authors
1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6
JAVA_PKG_IUSE="doc examples source"
6
JAVA_PKG_IUSE="doc source test"
7
MAVEN_ID="org.jdom:jdom2:2.0.6.1"
8
JAVA_TESTING_FRAMEWORKS="junit-4"
7 9

  
8
inherit java-pkg-2 java-ant-2
10
inherit java-pkg-2 java-pkg-simple
9 11

  
10
DESCRIPTION="Java API to manipulate XML data"
11
SRC_URI="http://www.jdom.org/dist/binary/archive/${P}.tar.gz"
12
DESCRIPTION="Java-based solution for accessing, manipulating, and outputting XML data"
12 13
HOMEPAGE="http://www.jdom.org"
14
SRC_URI="https://github.com/hunterhacker/jdom/archive/${PN^^}-${PV}.tar.gz"
15
S="${WORKDIR}/jdom-JDOM-${PV}"
13 16

  
14
LICENSE="JDOM"
15
SLOT="0"
17
LICENSE="Apache-1.1"
18
SLOT="2"
16 19
KEYWORDS="amd64 ~arm arm64 ppc64 x86"
17 20

  
18
RDEPEND=">=virtual/jre-1.8:*"
19
DEPEND=">=virtual/jdk-1.8:*"
20

  
21
S="${WORKDIR}/${PN}"
21
CP_DEPEND="
22
	dev-java/iso-relax:0
23
	dev-java/jaxen:1.2
24
	dev-java/xalan:0
25
"
26

  
27
DEPEND="
28
	>=virtual/jdk-1.8:*
29
	${CP_DEPEND}
30
	test? (
31
		dev-java/xerces:2
32
	)
33
"
34

  
35
RDEPEND="
36
	>=virtual/jre-1.8:*
37
	${CP_DEPEND}
38
"
39

  
40
PATCHES=( "${FILESDIR}/jdom-2.0.6.1-skip-failing-tests.patch" )
41

  
42
JAVA_TEST_GENTOO_CLASSPATH="junit-4,xerces-2"
43
JAVA_TEST_RESOURCE_DIRS="test/src/resources"
44
JAVA_TEST_SRC_DIR="test/src/java"
22 45

  
23 46
src_prepare() {
24
	default
47
	java-pkg-2_src_prepare
48
	default # bug #780585
25 49
	java-pkg_clean
26 50

  
27
	rm -r build/apidocs || die
51
	mkdir core/resources || die
52
	cp -r core/{package,resources}/META-INF || die
28 53

  
29
	rm -v src/java/org/jdom/xpath/JaxenXPath.java \
30
		|| die "Unable to remove Jaxen Binding class."
54
	# Remove Android stuff to avoid junit RDEPEND.
55
	rm -vr contrib/src/java/org/jdom2/contrib/android || die
31 56

  
32
	sed -i -e 's|${name}-${version.impl}|${name}|g' \
33
		-e 's|<jar jarfile="${build.dir}/${name}-sources|<!-- <jar jarfile="${build.dir}/${name}-sources|' \
34
		-e 's|build.javadocs}" />|build.javadocs}" /> -->|' \
35
		"${S}"/build.xml || die
36

  
37
	if ! use doc; then
38
		sed -i -e 's|depends="compile,javadoc"|depends="compile"|' \
39
			"${S}"/build.xml || die
40
	fi
57
	cd test/src/java || die
58
	# java-pkg-simple.eclass expects test resources in JAVA_TEST_RESOURCE_DIRS
59
	find . -type f ! -name '*.java' \
60
		| xargs cp --parent -t ../resources || die
61

  
62
	# We skip testDocTypeDocument() from 3 test classes due to test failures,
63
	# see bug #901743. This requires changing also the line endings which would
64
	# lead to huge patches. Hence we do this with sed ( 's/\r$//g' ).
65
	sed \
66
		-e 's/\r$//g' \
67
		-e '/import org.junit.Test/a import org.junit.Ignore;' \
68
		-e '/testDocTypeDocument()/i @Ignore' \
69
		-i org/jdom2/test/cases/input/TestDOMBuilder.java \
70
		-i org/jdom2/test/cases/input/TestStAXEventBuilder.java \
71
		-i org/jdom2/test/cases/input/TestStAXStreamBuilder.java || die
41 72
}
42 73

  
43
EANT_BUILD_TARGET="package"
74
src_compile() {
75
	JAVA_JAR_FILENAME="jdom.jar"
76
	JAVA_RESOURCE_DIRS="core/resources"
77
	JAVA_SRC_DIR="core/src/java"
78
	java-pkg-simple_src_compile
79
	JAVA_GENTOO_CLASSPATH_EXTRA+=":jdom.jar"
80
	rm -rf target || die
81

  
82
	JAVA_JAR_FILENAME="jdom-contrib.jar"
83
	JAVA_RESOURCE_DIRS="contrib/src/resources"
84
	JAVA_SRC_DIR="contrib/src/java"
85
	java-pkg-simple_src_compile
86
	JAVA_GENTOO_CLASSPATH_EXTRA+=":jdom-contrib.jar"
87
	rm -rf target || die
88

  
89
	if use doc; then
90
		JAVA_SRC_DIR=()
91
		JAVA_SRC_DIR=(
92
			"core/src/java"
93
			"contrib/src/java"
94
		)
95
		JAVA_JAR_FILENAME="ignoreme.jar"
96
		java-pkg-simple_src_compile
97
	fi
98
}
44 99

  
45 100
src_install() {
46
	java-pkg_dojar build/*.jar
47
	dodoc CHANGES.txt COMMITTERS.txt README.txt TODO.txt
48
	use doc && java-pkg_dojavadoc build/apidocs
49
	use examples && java-pkg_doexamples samples
50
	use source && java-pkg_dosrc src/java/org
101
	default # install README
102
	java-pkg_dojar "jdom.jar"
103
	java-pkg_dojar "jdom-contrib.jar"
104
	if use doc; then
105
		java-pkg_dojavadoc target/api
106
	fi
107
	if use source; then
108
		java-pkg_dosrc "core/src/java/*" "contrib/src/java/*"
109
	fi
51 110
}
Thank you!