* [gentoo-dev] [PATCH v2] java-pkg-simple.eclass: allow to compile with sources.lst empty
@ 2022-10-06 11:22 Volkmar W. Pogatzki
0 siblings, 0 replies; only message in thread
From: Volkmar W. Pogatzki @ 2022-10-06 11:22 UTC (permalink / raw
To: gentoo-dev
Compilation of ${sources} fails with error if ${sources} is empty.
This is the case when a package (or a module in case of a multi-jar
package) has only module-info.java to get compiled.
Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
---
eclass/java-pkg-simple.eclass | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
index abac18ca03f..dddee3a9610 100644
--- a/eclass/java-pkg-simple.eclass
+++ b/eclass/java-pkg-simple.eclass
@@ -377,13 +377,15 @@ java-pkg-simple_src_compile() {
java-pkg-simple_getclasspath
java-pkg-simple_prepend_resources ${classes} "${JAVA_RESOURCE_DIRS[@]}"
- if [[ -n ${moduleinfo} ]] || [[ java-pkg_get-target -lt 9 ]]; then
- ejavac -d ${classes} -encoding ${JAVA_ENCODING}\
- ${classpath:+-classpath ${classpath}} ${JAVAC_ARGS} @${sources}
- else
- ejavac -d ${classes} -encoding ${JAVA_ENCODING}\
- ${classpath:+--module-path ${classpath}} --module-version ${PV}\
- ${JAVAC_ARGS} @${sources}
+ if [[ -s "${sources}" ]]; then
+ if [[ -n ${moduleinfo} ]] || [[ java-pkg_get-target -lt 9 ]]; then
+ ejavac -d ${classes} -encoding ${JAVA_ENCODING}\
+ ${classpath:+-classpath ${classpath}} ${JAVAC_ARGS} @${sources}
+ else
+ ejavac -d ${classes} -encoding ${JAVA_ENCODING}\
+ ${classpath:+--module-path ${classpath}} --module-version ${PV}\
+ ${JAVAC_ARGS} @${sources}
+ fi
fi
# handle module-info.java separately as it needs at least JDK 9
@@ -407,11 +409,13 @@ 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 [[ -s "${sources}" ]]; 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"
+ fi
fi
# package
--
2.35.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-06 11:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-06 11:22 [gentoo-dev] [PATCH v2] java-pkg-simple.eclass: allow to compile with sources.lst empty Volkmar W. Pogatzki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox