From: "Volkmar W. Pogatzki" <gentoo@pogatzki.net>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH v2] java-pkg-simple.eclass: allow java-pkg-opt-2
Date: Tue, 2 Jul 2024 09:15:41 +0200 [thread overview]
Message-ID: <20240702071552.19895-1-gentoo@pogatzki.net> (raw)
Presently, "java-pkg-simple eclass can only be inherited AFTER java-pkg-2".
This prevents packages with optional Java like dev-lang/cxprolog to be
built with java-pkg-simple. This patch allows to inherit java-pkg-simple
after any of java-pkg-2 and java-pkg-opt-2.
Poposed by Alfred Wingate on #gentoo-dev-help on 2024-04-25
Closes: https://bugs.gentoo.org/930550
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
eclass/java-pkg-simple.eclass | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
index 6b473ed768ed..5ed7e3e5b78e 100644
--- a/eclass/java-pkg-simple.eclass
+++ b/eclass/java-pkg-simple.eclass
@@ -26,8 +26,12 @@ _JAVA_PKG_SIMPLE_ECLASS=1
inherit java-utils-2
-if ! has java-pkg-2 ${INHERITED}; then
- eerror "java-pkg-simple eclass can only be inherited AFTER java-pkg-2"
+if has java-pkg-2 ${INHERITED}; then
+ JAVA_PKG_OPT=0
+elif has java-pkg-opt-2 ${INHERITED}; then
+ JAVA_PKG_OPT=1
+else
+ eerror "java-pkg-simple eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2"
fi
# We are only interested in finding all java source files, wherever they may be.
@@ -50,7 +54,12 @@ if has test ${JAVA_PKG_IUSE}; then
test_deps+=" dev-java/testng:0";;
esac
done
- [[ ${test_deps} ]] && DEPEND="test? ( ${test_deps} )"
+ if [[ ${JAVA_PKG_OPT} == 1 ]]; then
+ [[ ${test_deps} ]] && DEPEND="test? ( ${JAVA_PKG_OPT_USE}? ( ${test_deps} ) )"
+ else
+ [[ ${test_deps} ]] && DEPEND="test? ( ${test_deps} )"
+ fi
+
unset test_deps
fi
@@ -347,6 +356,7 @@ java-pkg-simple_prepend_resources() {
# If USE FLAG 'binary' exists and is set, it will just copy
# ${JAVA_BINJAR_FILENAME} to ${S} and skip the rest of src_compile.
java-pkg-simple_src_compile() {
+ [[ ${JAVA_PKG_OPT} == 1 ]] && ! use ${JAVA_PKG_OPT_USE} && return
local sources=sources.lst classes=target/classes apidoc=target/api moduleinfo
# do not compile if we decide to install binary jar
@@ -461,6 +471,7 @@ java-pkg-simple_src_compile() {
# ${JAVA_JAR_FILENAME}. It will also install a launcher if
# ${JAVA_MAIN_CLASS} is set. Also invokes einstalldocs.
java-pkg-simple_src_install() {
+ [[ ${JAVA_PKG_OPT} == 1 ]] && ! use ${JAVA_PKG_OPT_USE} && return
local sources=sources.lst classes=target/classes apidoc=target/api
# install the jar file that we need
@@ -503,6 +514,7 @@ java-pkg-simple_src_install() {
# in the "generated-test" directory as content of this directory is preserved,
# whereas content of target/test-classes is removed.
java-pkg-simple_src_test() {
+ [[ ${JAVA_PKG_OPT} == 1 ]] && ! use ${JAVA_PKG_OPT_USE} && return
local test_sources=test_sources.lst classes=target/test-classes moduleinfo
local tests_to_run classpath
--
2.41.0
reply other threads:[~2024-07-02 7:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240702071552.19895-1-gentoo@pogatzki.net \
--to=gentoo@pogatzki.net \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox