summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorVlastimil Babka <caster@gentoo.org>2009-11-08 20:39:30 +0000
committerVlastimil Babka <caster@gentoo.org>2009-11-08 20:39:30 +0000
commit9d5ae26db3b9e33f4ad0ba92cdeebda7eec1412c (patch)
tree90f35e21e51277126a09e89b5f66dd558f892326 /eclass
parentUpdate HOMEPAGE. (diff)
downloadhistorical-9d5ae26db3b9e33f4ad0ba92cdeebda7eec1412c.tar.gz
historical-9d5ae26db3b9e33f4ad0ba92cdeebda7eec1412c.tar.bz2
historical-9d5ae26db3b9e33f4ad0ba92cdeebda7eec1412c.zip
Add support for rewriting bootclasspath in build.xml and JAVA_PKG_WANT_BOOTCLASSPATH variable.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/java-ant-2.eclass48
-rw-r--r--eclass/java-utils-2.eclass19
2 files changed, 65 insertions, 2 deletions
diff --git a/eclass/java-ant-2.eclass b/eclass/java-ant-2.eclass
index 376e52f83f90..124fc201788a 100644
--- a/eclass/java-ant-2.eclass
+++ b/eclass/java-ant-2.eclass
@@ -14,7 +14,7 @@
#
# Licensed under the GNU General Public License, v2
#
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.45 2009/02/15 01:24:59 betelgeuse Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.46 2009/11/08 20:39:30 caster Exp $
inherit java-utils-2
@@ -451,3 +451,49 @@ java-ant_xml-rewrite() {
die "xml-rewrite not found"
fi
}
+
+# ------------------------------------------------------------------------------
+# @public java-ant_rewrite-bootclasspath
+#
+# Adds bootclasspath to javac-like tasks in build.xml filled with jars of a
+# bootclasspath package of given version.
+#
+# Affected by:
+# JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks
+#
+# @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
+# of the current JDK
+# @param $2 - path to desired build.xml file, defaults to 'build.xml'
+# @param $3 - (optional) what to prepend the bootclasspath with (to override)
+# @param $4 - (optional) what to append to the bootclasspath
+# ------------------------------------------------------------------------------
+
+java-ant_rewrite-bootclasspath() {
+ local version="${1}"
+ local file="${2-build.xml}"
+ local extra_before="${3}"
+ local extra_after="${4}"
+
+ local bcp
+ case "${version}" in
+ auto)
+ bcp="$(java-config -g BOOTCLASSPATH)"
+ ;;
+ 1.5)
+ bcp="$(java-pkg_getjars --build-only gnu-classpath-0.98)"
+ ;;
+ *)
+ eerror "unknown parameter of java-ant_rewrite-bootclasspath"
+ die "unknown parameter of java-ant_rewrite-bootclasspath"
+ ;;
+ esac
+ if [[ -n "${extra_before}" ]]; then
+ bcp="${extra_before}:${bcp}"
+ fi
+ if [[ -n "${extra_after}" ]]; then
+ bcp="${bcp}:${extra_after}"
+ fi
+
+ java-ant_xml-rewrite -f "${file}" -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
+ -a bootclasspath -v "${bcp}"
+}
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 3f6a2ddf27a2..b4157d6148da 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -6,7 +6,7 @@
#
# Licensed under the GNU General Public License, v2
#
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.129 2009/06/07 08:22:42 ali_bush Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.130 2009/11/08 20:39:30 caster Exp $
# -----------------------------------------------------------------------------
# @eclass-begin
@@ -76,6 +76,23 @@ JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.1.6 ${JAVA_PKG_PORTAGE_DEP}"
hasq source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
# -----------------------------------------------------------------------------
+# @variable-preinherit JAVA_PKG_WANT_BOOTCLASSPATH
+#
+# The version of bootclasspath the package needs to work. Translates to a proper
+# dependency. The bootclasspath has to be obtained by java-ant_rewrite-bootclasspath
+# -----------------------------------------------------------------------------
+
+if [[ -n "${JAVA_PKG_WANT_BOOTCLASSPATH}" ]]; then
+ if [[ "${JAVA_PKG_WANT_BOOTCLASSPATH}" == "1.5" ]]; then
+ JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} >=dev-java/gnu-classpath-0.98-r1:0.98"
+ else
+ eerror "Unknown value of JAVA_PKG_WANT_BOOTCLASSPATH"
+ # since die in global scope doesn't work, this will make repoman fail
+ JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} BAD_JAVA_PKG_WANT_BOOTCLASSPATH"
+ fi
+fi
+
+# -----------------------------------------------------------------------------
# @variable-external JAVA_PKG_ALLOW_VM_CHANGE
# @variable-default yes
#