* [gentoo-java] ejavac enhancement proposal
@ 2008-01-05 14:20 Vlastimil Babka
0 siblings, 0 replies; only message in thread
From: Vlastimil Babka @ 2008-01-05 14:20 UTC (permalink / raw
To: gentoo-java
[-- 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
}
# ------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-01-05 14:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-05 14:20 [gentoo-java] ejavac enhancement proposal Vlastimil Babka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox