ejavac enhancement proposal
Vlastimil Babka <[email protected]>
| Newsgroups | gmane.linux.gentoo.java |
|---|---|
| Message-ID | <[email protected]> |
I think this would be useful, many ebuilds do that manually. RFC. VB
ejavac.patch
(text/x-patch, 1.9 KB)
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
}
# ------------------------------------------------------------------------------