public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] java-pkg-simple.eclass: allow to compile with sources.lst empty
@ 2022-10-06  8:23 Volkmar W. Pogatzki
  0 siblings, 0 replies; only message in thread
From: Volkmar W. Pogatzki @ 2022-10-06  8:23 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 | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
index abac18ca03f..d3047296035 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
-- 
2.35.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-06  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-06  8:23 [gentoo-dev] [PATCH] 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