commit:     14aef16e0d785ec9f16650dd4f70969cda87863b
Author:     Yuan Liao <liaoyuan <AT> gmail <DOT> com>
AuthorDate: Sat Jan  8 18:01:46 2022 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Sun Jan  9 09:05:04 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=14aef16e

dev-java/jackrabbit-webdav: Fix tests and use HTTPS HOMEPAGE for 2.10.1

The test failure bug being fixed by this commit is caused by
servlet-api-4.0 being added to the classpath earlier than
servlet-api-2.3 by java-ant-2.eclass.  servlet-api-4.0 is present in the
classpath because it is a transitive dependency of this package
introduced by dev-java/bndlib, but it is incompatible with the test
sources.  The tests are supposed to be compiled with servlet-api-2.3,
but javac will choose servlet-api-4.0 because it appears earlier in the
classpath.

java-ant-2.eclass constructs the classpath by traversing the dependency
tree using depth-first search, so transitive dependencies like
servlet-api-4.0 can appear earlier than direct dependencies like
servlet-api-2.3.  java-pkg-simple.eclass, on the other hand, uses
breadth-first search, which ensures that all direct dependencies will be
visited earlier than any transitive dependencies in the traversal.

Therefore, simply switching to java-pkg-simple.eclass resolves this bug.
However, by doing this, this ebuild now relies on the undocumented
implementation detail of java-pkg-simple.eclass, that the dependency
tree is traversed with BFS.

If java-pkg-simple.eclass switches to DFS for classpath construction in
the future, the same bug might resurface!

Yet there are still benefits of using java-pkg-simple.eclass even if it
were not done merely for the bug.  The upstream uses Maven instead of
Ant to build the project -- the build.xml used by java-ant-2.eclass is a
Gentoo custom one.  Switching to java-pkg-simple.eclass means that there
is no more maintenance burden of this package caused by the custom
build.xml.  As of this commit, ebuilds for slot 2 of this package also
use java-pkg-simple.eclass, so the eclass switch fosters consistency.

Closes: https://bugs.gentoo.org/804594
Signed-off-by: Yuan Liao <liaoyuan <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/23705
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../jackrabbit-webdav-2.10.1-r2.ebuild             | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/dev-java/jackrabbit-webdav/jackrabbit-webdav-2.10.1-r2.ebuild 
b/dev-java/jackrabbit-webdav/jackrabbit-webdav-2.10.1-r2.ebuild
new file mode 100644
index 000000000000..c45c8b6d3bb0
--- /dev/null
+++ b/dev-java/jackrabbit-webdav/jackrabbit-webdav-2.10.1-r2.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+JAVA_PKG_IUSE="doc source test"
+JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple
+
+MY_PN="${PN/-*/}"
+
+DESCRIPTION="Fully conforming implementation of the JRC API (specified in JSR 
170 and 283)"
+HOMEPAGE="https://jackrabbit.apache.org/";
+SRC_URI="mirror://apache/${MY_PN}/${PV}/${MY_PN}-${PV}-src.zip"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+
+S="${WORKDIR}/${MY_PN}-${PV}/${PN}"
+
+CP_DEPEND="dev-java/bndlib:0
+       dev-java/slf4j-api:0
+       dev-java/slf4j-nop:0
+       dev-java/commons-httpclient:3
+       java-virtuals/servlet-api:2.3"
+
+DEPEND=">=virtual/jdk-1.8:*
+       ${CP_DEPEND}"
+
+RDEPEND=">=virtual/jre-1.8:*
+       ${CP_DEPEND}"
+
+BDEPEND="app-arch/unzip"
+
+JAVA_SRC_DIR="src/main/java"
+JAVA_RESOURCE_DIRS=( "src/main/resources" )
+
+JAVA_TEST_GENTOO_CLASSPATH="junit-4"
+JAVA_TEST_SRC_DIR="src/test/java"
+JAVA_TEST_RESOURCE_DIRS=( "src/test/resources" )
+
+src_test() {
+       # Run only tests that would be executed by Maven as in ${S}/pom.xml:79
+       JAVA_TEST_RUN_ONLY=$(find "${JAVA_TEST_SRC_DIR}" -name "*TestAll.java" \
+               -exec realpath --relative-to="${JAVA_TEST_SRC_DIR}" {} \;)
+       JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//.java}"
+       JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//\//.}"
+       java-pkg-simple_src_test
+}

Reply via email to