Package: javatools
Version: 0.53

Tags: patch

Maximum length of command line that xargs (which jh_build uses to call javac) 
is allowed to produce
may be too low when there are hundreds of files in a source directory. Please 
consider increasing this
limit (see the attached patch). I've found 512000 B to be a reasonable value 
when building
org.eclipse.ui.workbench bundle (circa 1300 java sources).

Regards,

Jakub

From f83951bd33b405426c3f758c563cc50982acb398 Mon Sep 17 00:00:00 2001
From: Jakub Adam <jakub.a...@ktknet.cz>
Date: Fri, 18 Sep 2015 14:40:06 +0200
Subject: [PATCH 2/2] jh_build: Increase allowed command line length for xargs

Fixes build of source directories with many files.
---
 jh_build | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/jh_build b/jh_build
index cd5834c..3ac2d7c 100755
--- a/jh_build
+++ b/jh_build
@@ -110,17 +110,17 @@ function dobuild()
 	if [ -n "$srcdirs" ]; then
 
 		if [ -z "`getarg q quiet`" ]; then
-			echo find "${srcdirs[@]}" -name '*.java' -and -type f -print0 '|' xargs -0 $JAVAC -g -cp $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.$ext $JH_JAVAC_OPTS "${srcfiles[@]}"
+			echo find "${srcdirs[@]}" -name '*.java' -and -type f -print0 '|' xargs -s 512000 -0 $JAVAC -g -cp $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.$ext $JH_JAVAC_OPTS "${srcfiles[@]}"
 		fi
 
-		find "${srcdirs[@]}" -name '*.java' -and -type f -print0 | xargs -0 $JAVAC -g -cp $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.$ext $JH_JAVAC_OPTS "${srcfiles[@]}"
+		find "${srcdirs[@]}" -name '*.java' -and -type f -print0 | xargs -s 512000 -0 $JAVAC -g -cp $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.$ext $JH_JAVAC_OPTS "${srcfiles[@]}"
 
 		if [ -n "`getarg J javadoc`" ] || [ -z "`getarg N no-javadoc`" ]; then
 			if [ -z "`getarg q quiet`" ]; then
-				echo find "${srcdirs[@]}" -name '*.java' -and -type f -print0 '|' xargs -0 $JAVADOC $CLASSPATHDOCS -classpath $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS "${srcfiles[@]}"
+				echo find "${srcdirs[@]}" -name '*.java' -and -type f -print0 '|' xargs -s 512000 -0 $JAVADOC $CLASSPATHDOCS -classpath $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS "${srcfiles[@]}"
 			fi
 
-			find "${srcdirs[@]}" -name '*.java' -and -type f -print0 | xargs -0 $JAVADOC $CLASSPATHDOCS -classpath $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS "${srcfiles[@]}"
+			find "${srcdirs[@]}" -name '*.java' -and -type f -print0 | xargs -s 512000 -0 $JAVADOC $CLASSPATHDOCS -classpath $CLASSPATH:debian/_jh_build.$ext -d debian/_jh_build.javadoc/api -quiet $JH_JAVADOC_OPTS "${srcfiles[@]}"
 		fi
 
 	elif [ -n "$srcfiles" ]; then
-- 
2.5.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to