From eb72a69c0109ff53b8c18b2f6c3b160489376e2e Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 11 Jan 2024 13:07:07 +0000 Subject: gentoo auto-resync : 11:01:2024 - 13:07:07 --- eclass/Manifest.gz | Bin 38921 -> 38928 bytes eclass/java-pkg-simple.eclass | 14 +++++---- eclass/java-utils-2.eclass | 64 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 70 insertions(+), 8 deletions(-) (limited to 'eclass') diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz index 837551c99298..925cddec0652 100644 Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz differ diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass index 143efa707751..97bad414afb7 100644 --- a/eclass/java-pkg-simple.eclass +++ b/eclass/java-pkg-simple.eclass @@ -412,11 +412,15 @@ java-pkg-simple_src_compile() { # javadoc if has doc ${JAVA_PKG_IUSE} && use doc; then - mkdir -p ${apidoc} - ejavadoc -d ${apidoc} \ - -encoding ${JAVA_ENCODING} -docencoding UTF-8 -charset UTF-8 \ - ${classpath:+-classpath ${classpath}} ${JAVADOC_ARGS:- -quiet} \ - @${sources} || die "javadoc failed" + if [[ ${JAVADOC_SRC_DIRS} ]]; then + einfo "JAVADOC_SRC_DIRS exists, you need to call ejavadoc separately" + else + mkdir -p ${apidoc} + ejavadoc -d ${apidoc} \ + -encoding ${JAVA_ENCODING} -docencoding UTF-8 -charset UTF-8 \ + ${classpath:+-classpath ${classpath}} ${JAVADOC_ARGS:- -quiet} \ + @${sources} || die "javadoc failed" + fi fi # package diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index 31b8ab8df60a..31f7932a16fd 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -218,6 +218,46 @@ JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="/etc/java-config-2/build/com # ebuild foo.ebuild compile # @CODE +# @ECLASS_VARIABLE: JAVADOC_CLASSPATH +# @DEFAULT_UNSET +# @DESCRIPTION: +# Comma or space separated list of java packages that are needed for generating +# javadocs. Can be used to avoid overloading the compile classpath in multi-jar +# packages if there are jar files which have different dependencies. +# +# @CODE +# Example: +# JAVADOC_CLASSPATH=" +# jna-4 +# jsch +# " +# @CODE + +# @ECLASS_VARIABLE: JAVADOC_SRC_DIRS +# @DEFAULT_UNSET +# @DESCRIPTION: +# An array of directories relative to ${S} which contain the sources of +# the application. It needs to sit in global scope; if put in src_compile() +# it would not work. +# It is needed by the java-pkg-simple.eclass to decide whether to call ejavadoc +# or not. If this variable is defined then java-pkg-simple_src_compile will not +# call ejavadoc automatically. ejavadoc has then to be called explicitly from +# the ebuild. It is meant for usage in multi-jar packages in order to avoid an +# extra compilation run only for producing the javadocs. +# +# @CODE +# Example: +# JAVADOC_SRC_DIRS=( +# "${PN}-core" +# "${PN}-jsch" +# "${PN}-pageant" +# "${PN}-sshagent" +# "${PN}-usocket-jna" +# "${PN}-usocket-nc" +# "${PN}-connector-factory" +# ) +# @CODE + # TODO document me JAVA_PKG_QA_VIOLATIONS=0 @@ -2152,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 -- cgit v1.2.3