eclass/java-utils-2: Sync with Gentoo

It's from Gentoo commit cb202546d81ed4e591c366d192e7b15d4c184ffa.
This commit is contained in:
Flatcar Buildbot 2024-01-15 07:12:57 +00:00 committed by Krzesimir Nowak
parent 41aa584899
commit 4606105051

View File

@ -218,6 +218,46 @@ JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="/etc/java-config-2/build/com
# ebuild foo.ebuild compile # ebuild foo.ebuild compile
# @CODE # @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 # TODO document me
JAVA_PKG_QA_VIOLATIONS=0 JAVA_PKG_QA_VIOLATIONS=0
@ -2152,9 +2192,27 @@ ejavadoc() {
einfo "javadoc ${javadoc_args} ${@}" einfo "javadoc ${javadoc_args} ${@}"
fi fi
local args=( javadoc ${javadoc_args} "${@}" ) if [[ "${JAVADOC_SRC_DIRS[@]}" ]]; then
echo "${args[@]}" >&2 mkdir -p target/api || die "cannot create target/api"
"${args[@]}" || die "ejavadoc failed" 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 # @FUNCTION: java-pkg_filter-compiler