summaryrefslogtreecommitdiff
path: root/eclass/java-utils-2.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-01-11 13:07:07 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-01-11 13:07:07 +0000
commiteb72a69c0109ff53b8c18b2f6c3b160489376e2e (patch)
tree6b1a11b63d1fa5f16537a183ee1800b8f0682d1b /eclass/java-utils-2.eclass
parentafa7f3d7b9d6af29760049c9711a24821c77c8ec (diff)
gentoo auto-resync : 11:01:2024 - 13:07:07
Diffstat (limited to 'eclass/java-utils-2.eclass')
-rw-r--r--eclass/java-utils-2.eclass64
1 files changed, 61 insertions, 3 deletions
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