From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/prefix:master commit in: eclass/
Date: Sun, 21 Jan 2024 13:47:05 +0000 (UTC) [thread overview]
Message-ID: <1705844812.42766d37044e2479bee6c9e885238bc9703eddd6.grobian@gentoo> (raw)
commit: 42766d37044e2479bee6c9e885238bc9703eddd6
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 13:46:52 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 13:46:52 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=42766d37
eclass/java-utils-2: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/java-utils-2.eclass | 158 +++++++++++++++++++++++++++++++++------------
1 file changed, 116 insertions(+), 42 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index fa46b72b3d..a84f7c3002 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2022 Gentoo Authors
+# Copyright 2004-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-utils-2.eclass
@@ -6,7 +6,7 @@
# java@gentoo.org
# @AUTHOR:
# Thomas Matthijs <axxo@gentoo.org>, Karl Trygve Kalleberg <karltk@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7 8
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: Base eclass for Java packages
# @DESCRIPTION:
# This eclass provides functionality which is used by java-pkg-2.eclass,
@@ -17,17 +17,17 @@
# that have optional Java support. In addition you can inherit java-ant-2 for
# Ant-based packages.
-case ${EAPI:-0} in
- [5678]) ;;
+case ${EAPI} in
+ 6|7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_JAVA_UTILS_2_ECLASS} ]] ; then
_JAVA_UTILS_2_ECLASS=1
-# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier eclasses.
+# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier EAPIs.
# Keep versionator inheritance in case consumers are using it implicitly.
-[[ ${EAPI} == [56] ]] && inherit eapi7-ver eutils multilib versionator
+[[ ${EAPI} == 6 ]] && inherit eapi7-ver eqawarn multilib versionator
# Make sure we use java-config-2
export WANT_JAVA_CONFIG="2"
@@ -37,7 +37,7 @@ has test ${JAVA_PKG_IUSE} && RESTRICT+=" !test? ( test )"
# @VARIABLE: JAVA_PKG_E_DEPEND
# @INTERNAL
# @DESCRIPTION:
-# This is a convience variable to be used from the other java eclasses. This is
+# This is a convenience variable to be used from the other java eclasses. This is
# the version of java-config we want to use. Usually the latest stable version
# so that ebuilds can use new features without depending on specific versions.
JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.2.0-r3"
@@ -66,6 +66,21 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# JAVA_PKG_FORCE_VM=openjdk-11 emerge foo
# @CODE
+# @ECLASS_VARIABLE: JAVA_PKG_NO_CLEAN
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array of expressions to match *.class or *.jar files in order to protect
+# them against deletion by java-pkg_clean.
+#
+# @CODE
+# JAVA_PKG_NO_CLEAN=(
+# "*/standard.jar"
+# "*/launch4j.jar"
+# "*/apps/jetty/apache-tomcat*"
+# "*/lib/jetty*"
+# )
+# @CODE
+
# @ECLASS_VARIABLE: JAVA_PKG_WANT_BUILD_VM
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -124,7 +139,7 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# )
# @CODE
-# @ECLASS-VARIABLE: JAVA_TEST_RUNNER_EXTRA_ARGS
+# @ECLASS_VARIABLE: JAVA_TEST_RUNNER_EXTRA_ARGS
# @DEFAULT_UNSET
# @DESCRIPTION:
# Array of extra arguments that should be passed to the test runner when running tests.
@@ -203,6 +218,46 @@ JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="${EPREFIX}/etc/java-config-2
# 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
@@ -316,7 +371,6 @@ java-pkg_rm_files() {
[[ ! -f "${filename}" ]] && die "${filename} is not a regular file. Aborting."
einfo "Removing unneeded file ${filename}"
rm -f "${S}/${filename}" || die "cannot remove ${filename}"
- eend $?
done
}
@@ -769,7 +823,7 @@ java-pkg_dosrc() {
# @FUNCTION: java-pkg_dolauncher
# @USAGE: <filename> [options]
# @DESCRIPTION:
-# Make a wrapper script to lauch/start this package
+# Make a wrapper script to launch/start this package
# If necessary, the wrapper will switch to the appropriate VM.
#
# Can be called without parameters if the package installs only one jar
@@ -939,7 +993,7 @@ java-pkg_recordjavadoc()
# Example: get a specific jar from xerces slot 2
# java-pkg_jar-from xerces-2 xml-apis.jar
#
-# Example: get a specific jar from xerces slot 2, and name it diffrently
+# Example: get a specific jar from xerces slot 2, and name it differently
# java-pkg_jar-from xerces-2 xml-apis.jar xml.jar
#
# Example: get junit.jar which is needed only for building
@@ -1350,7 +1404,7 @@ java-pkg_register-optional-dependency() {
# @DESCRIPTION:
# Register an arbitrary environment variable into package.env. The gjl launcher
# for this package or any package depending on this will export it into
-# environement before executing java command.
+# environment before executing java command.
# Must only be called in src_install phase.
JAVA_PKG_EXTRA_ENV="${T}/java-pkg-extra-env"
JAVA_PKG_EXTRA_ENV_VARS=""
@@ -1696,16 +1750,6 @@ java-pkg_get-jni-cflags() {
echo ${flags}
}
-java-pkg_ensure-gcj() {
- # was enforcing sys-devel/gcc[gcj]
- die "${FUNCNAME} was removed. Use use-deps available as of EAPI 2 instead. #261562"
-}
-
-java-pkg_ensure-test() {
- # was enforcing USE=test if FEATURES=test
- die "${FUNCNAME} was removed. Package mangers handle this already. #278965"
-}
-
# @FUNCTION: java-pkg_register-ant-task
# @USAGE: [--version x.y] [<name>]
# @DESCRIPTION:
@@ -1879,13 +1923,17 @@ ejunit4() {
# @CODE
# $1 - -cp or -classpath
# $2 - the classpath passed to it
-# $@ - test classes for testng to run.
+# $@ - test classes or testng.xml for testng to run.
# @CODE
etestng() {
debug-print-function ${FUNCNAME} $*
local runner=org.testng.TestNG
- local cp=$(java-pkg_getjars --with-dependencies testng)
+ if [[ ${PN} != testng ]]; then
+ local cp=$(java-pkg_getjars --with-dependencies testng)
+ else
+ local cp=testng.jar
+ fi
local tests
if [[ ${1} = -cp || ${1} = -classpath ]]; then
@@ -1903,14 +1951,24 @@ etestng() {
-cp ${cp}
-Djava.io.tmpdir="${T}"
-Djava.awt.headless=true
+ -Dtest.resources.dir="${JAVA_TEST_RESOURCE_DIRS}"
${JAVA_TEST_EXTRA_ARGS[@]}
${runner}
${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
)
- [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]] && args+=( -usedefaultlisteners false )
+ if [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]]; then
+ args+=(
+ -verbose 3
+ -usedefaultlisteners true
+ )
+ fi
- args+=( -testclass ${tests} )
+ if [[ "${test%.xml}" == "${test}" ]]; then
+ args+=( -testclass ${tests} )
+ else
+ args+=( ${tests%,} )
+ fi
debug-print "java ${args[@]}"
java ${args[@]} || die "Running TestNG failed."
@@ -1921,13 +1979,9 @@ etestng() {
# src_prepare Searches for bundled jars
# Don't call directly, but via java-pkg-2_src_prepare!
java-utils-2_src_prepare() {
- case ${EAPI:-0} in
- 5)
- java-pkg_func-exists java_prepare && java_prepare ;;
- *)
- java-pkg_func-exists java_prepare &&
- eqawarn "java_prepare is no longer called, define src_prepare instead."
- eapply_user ;;
+ case ${EAPI} in
+ [678]) eapply_user ;;
+ *) default_src_prepare ;;
esac
# Check for files in JAVA_RM_FILES array.
@@ -2148,9 +2202,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
@@ -2378,7 +2450,7 @@ java-pkg_init-compiler_() {
}
-# @FUNCTION: init_paths_
+# @FUNCTION: java-pkg_init_paths_
# @INTERNAL
# @DESCRIPTION:
# Initializes some variables that will be used. These variables are mostly used
@@ -2628,7 +2700,7 @@ java-pkg_get-vm-version() {
# @RETURN: VM handle of an available JDK
# @DESCRIPTION:
# Selects a build vm from a list of vm handles. First checks for the system-vm
-# beeing usable, then steps through the listed handles till a suitable vm is
+# being usable, then steps through the listed handles till a suitable vm is
# found.
#
java-pkg_build-vm-from-handle() {
@@ -2931,11 +3003,13 @@ is-java-strict() {
# @FUNCTION: java-pkg_clean
# @DESCRIPTION:
# Java package cleaner function. This will remove all *.class and *.jar
-# files, removing any bundled dependencies.
+# files, except those specified by expressions in JAVA_PKG_NO_CLEAN.
java-pkg_clean() {
- if [[ -z "${JAVA_PKG_NO_CLEAN}" ]]; then
- find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die
- fi
+ NO_DELETE=()
+ for keep in ${JAVA_PKG_NO_CLEAN[@]}; do
+ NO_DELETE+=( '!' '-path' ${keep} )
+ done
+ find "${@}" '(' -name '*.class' -o -name '*.jar' ${NO_DELETE[@]} ')' -type f -delete -print || die
}
# @FUNCTION: java-pkg_gen-cp
next reply other threads:[~2024-01-21 13:47 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-21 13:47 Fabian Groffen [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-30 9:08 [gentoo-commits] repo/proj/prefix:master commit in: eclass/ Fabian Groffen
2024-09-23 18:25 Fabian Groffen
2024-08-11 16:19 Fabian Groffen
2024-08-10 14:43 Fabian Groffen
2024-08-10 14:24 Fabian Groffen
2024-08-10 14:24 Fabian Groffen
2024-08-10 10:48 Fabian Groffen
2024-08-09 9:25 Fabian Groffen
2024-08-07 17:08 Fabian Groffen
2024-08-07 17:03 Fabian Groffen
2024-07-25 6:25 Fabian Groffen
2024-07-17 12:01 Fabian Groffen
2024-05-09 7:14 Fabian Groffen
2024-01-21 13:43 Fabian Groffen
2024-01-21 13:40 Fabian Groffen
2023-12-16 15:36 Fabian Groffen
2023-09-11 23:33 Sam James
2023-09-04 6:36 Fabian Groffen
2023-09-03 19:39 Fabian Groffen
2023-05-24 7:55 Fabian Groffen
2023-05-24 6:19 Fabian Groffen
2022-06-29 14:53 Sam James
2022-06-29 14:05 Sam James
2022-06-07 17:01 Fabian Groffen
2022-06-07 12:35 Fabian Groffen
2022-06-06 16:51 Fabian Groffen
2022-06-06 9:07 Fabian Groffen
2022-06-06 8:42 Fabian Groffen
2022-05-10 6:22 Fabian Groffen
2022-02-17 0:12 Sam James
2022-02-10 8:54 Fabian Groffen
2022-01-31 1:07 Sam James
2022-01-23 2:27 Sam James
2022-01-23 1:21 Sam James
2021-12-03 10:03 Fabian Groffen
2021-10-21 6:39 Fabian Groffen
2021-10-14 6:15 Sam James
2021-10-14 6:15 Sam James
2021-10-13 4:05 Sam James
2021-07-13 9:02 Fabian Groffen
2021-06-29 6:48 Fabian Groffen
2021-06-29 6:23 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:09 Fabian Groffen
2021-04-10 7:15 Sam James
2021-04-10 7:15 Sam James
2021-04-10 7:15 Sam James
2021-04-10 7:09 Sam James
2021-03-13 9:54 Fabian Groffen
2021-02-07 19:23 Fabian Groffen
2021-01-24 9:47 Fabian Groffen
2021-01-14 8:02 Fabian Groffen
2021-01-12 13:32 Fabian Groffen
2021-01-11 19:53 Fabian Groffen
2020-12-15 7:48 Fabian Groffen
2020-11-29 14:24 Fabian Groffen
2020-11-29 13:41 Fabian Groffen
2020-08-09 8:14 Fabian Groffen
2020-06-22 18:28 Fabian Groffen
2020-06-22 13:56 Fabian Groffen
2020-05-26 6:44 Fabian Groffen
2020-03-26 7:56 Fabian Groffen
2020-03-22 9:25 Fabian Groffen
2020-03-16 17:23 Michael Haubenwallner
2020-03-13 7:51 Fabian Groffen
2019-12-11 9:47 Fabian Groffen
2019-11-14 6:36 Fabian Groffen
2019-05-30 8:25 Fabian Groffen
2019-03-25 14:20 Michael Haubenwallner
2018-12-17 9:55 Fabian Groffen
2018-07-17 8:45 Fabian Groffen
2018-07-03 8:52 Michael Haubenwallner
2018-06-22 13:16 Michael Haubenwallner
2018-06-20 7:32 Fabian Groffen
2018-06-06 12:48 Fabian Groffen
2017-12-12 18:53 Fabian Groffen
2017-12-12 18:53 Fabian Groffen
2017-10-17 8:39 Fabian Groffen
2017-10-16 13:54 Fabian Groffen
2017-10-03 7:38 Michael Haubenwallner
2016-07-08 11:17 Fabian Groffen
2016-06-15 11:32 [gentoo-commits] repo/proj/prefix:rap0 " Benda XU
2016-06-15 11:05 ` [gentoo-commits] repo/proj/prefix:master " Benda XU
2016-04-18 8:07 Michael Haubenwallner
2016-03-20 18:22 Fabian Groffen
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=1705844812.42766d37044e2479bee6c9e885238bc9703eddd6.grobian@gentoo \
--to=grobian@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--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