public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Volkmar W. Pogatzki" <gentoo@pogatzki.net>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH 3/3] java-utils-2.eclass: enhance ejavadoc
Date: Sun, 31 Dec 2023 17:26:02 +0100	[thread overview]
Message-ID: <20231231162632.10228-3-gentoo@pogatzki.net> (raw)
In-Reply-To: <20231231162632.10228-1-gentoo@pogatzki.net>

This patch enhances the ejavadoc function so that it can be called
without arguments if the JAVADOC_SRC_DIRS array is set in the ebuild.

Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
 eclass/java-utils-2.eclass | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 814b4957d52c..31f7932a16fd 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -2192,9 +2192,27 @@ ejavadoc() {
 		einfo "javadoc ${javadoc_args} ${@}"
 	fi
 
-	local args=( javadoc ${javadoc_args} "${@}" )
-	echo "${args[@]}" >&2
-	"${args[@]}" || die "ejavadoc failed"
+	if [[ "${JAVADOC_SRC_DIRS[@]}" ]]; then
+		mkdir -p target/api || die "cannot create target/api"
+		local dependency
+		for dependency in ${JAVADOC_CLASSPATH}; do
+			classpath="${classpath}:$(java-pkg_getjars \
+				--build-only \
+				--with-dependencies \
+				${dependency})"
+		done
+		find "${JAVADOC_SRC_DIRS[@]}" -name '*.java' > sources
+		javadoc \
+			"${javadoc_args}" \
+			-d target/api \
+			-cp "${classpath}" \
+			-quiet \
+			@sources || die "ejavadoc failed"
+	else
+		local args=( javadoc ${javadoc_args} "${@}" )
+		echo "${args[@]}" >&2
+		"${args[@]}" || die "ejavadoc failed"
+	fi
 }
 
 # @FUNCTION: java-pkg_filter-compiler
-- 
2.41.0



      parent reply	other threads:[~2023-12-31 16:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-31 16:26 [gentoo-dev] [PATCH 1/3] java-utils-2.eclass: new JAVADOC_CLASSPATH, JAVADOC_SRC_DIRS Volkmar W. Pogatzki
2023-12-31 16:26 ` [gentoo-dev] [PATCH 2/3] java-pkg-simple.eclass: respect JAVADOC_SRC_DIRS Volkmar W. Pogatzki
2023-12-31 16:26 ` Volkmar W. Pogatzki [this message]

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=20231231162632.10228-3-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