public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <caster@gentoo.org>
To: gentoo-java@lists.gentoo.org
Subject: [gentoo-java] ejavac enhancement proposal
Date: Sat, 05 Jan 2008 15:20:15 +0100	[thread overview]
Message-ID: <477F921F.9010507@gentoo.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 70 bytes --]

I think this would be useful, many ebuilds do that manually. RFC.

VB

[-- Attachment #2: ejavac.patch --]
[-- Type: text/x-patch, Size: 1907 bytes --]

Index: java-utils-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v
retrieving revision 1.100
@@ -1975,13 +1930,27 @@
 # @ebuild-function ejavac
 #
 # Javac wrapper function. Will use the appropriate compiler, based on
-# /etc/java-config/compilers.conf
+# /etc/java-config/compilers.conf. Dies on compiler errors.
 #
+# @example
+#	ejavac -classpath . foo/*.java -d classes
+#	ejavac --srcdir src -d classes
+#
+# @param --srcdir $dir - Specifies a dir that will be recursively searched for
+#		.java files (via find) to pass as to the compiler, instead of passing
+#		a list of files manually. Uses temporary file to store the list, to
+#		prevent too long command line. The list is passed as the last argument.
 # @param $@ - Arguments to be passed to the compiler
 # ------------------------------------------------------------------------------
 ejavac() {
 	debug-print-function ${FUNCNAME} $*
 
+	local srcdir=""
+	if [[ ${1} == --srcdir ]]; then
+		srcdir="${2}"
+		shift 2
+	fi
+
 	java-pkg_init-compiler_
 
 	local compiler_executable
@@ -1998,8 +1967,15 @@
 		die "java-pkg_javac-args failed"
 	fi
 
-	[[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}"
-	${compiler_executable} ${javac_args} "${@}" || die "ejavac failed"
+	if [[ -n ${srcdir} ]]; then
+		local list="${T}/ejavac.list"
+		find "${srcdir}" -name "*.java" > "${list}" || die "find failed"
+		[[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}" "@${list}"
+		${compiler_executable} ${javac_args} "${@}" "@${list}" || die "ejavac failed"
+	else
+		[[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}"
+		${compiler_executable} ${javac_args} "${@}" || die "ejavac failed"
+	fi
 }
 
 # ------------------------------------------------------------------------------

                 reply	other threads:[~2008-01-05 14:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=477F921F.9010507@gentoo.org \
    --to=caster@gentoo.org \
    --cc=gentoo-java@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