public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-java] A new rewriter helper.
@ 2007-01-11 18:42 Petteri Räty
  0 siblings, 0 replies; only message in thread
From: Petteri Räty @ 2007-01-11 18:42 UTC (permalink / raw
  To: gentoo-java


[-- Attachment #1.1: Type: text/plain, Size: 95 bytes --]

Will commit the attached later today or tomorrow unless someone objects.

Regards,
Petteri

[-- Attachment #1.2: java-ant_ignore-system-classes.patch --]
[-- Type: text/plain, Size: 2595 bytes --]

Index: java-ant-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v
retrieving revision 1.11
diff -u -r1.11 java-ant-2.eclass
--- java-ant-2.eclass	6 Jan 2007 19:45:27 -0000	1.11
+++ java-ant-2.eclass	11 Jan 2007 12:41:18 -0000
@@ -245,16 +245,14 @@
 # @public java-ant_rewrite-classpath
 #
 # Adds 'classpath="${gentoo.classpath}"' to specified build file.
+# @param $1 - the file to rewrite (defaults to build.xml)
 # ------------------------------------------------------------------------------
 java-ant_rewrite-classpath() {
 	debug-print-function ${FUNCNAME} $*
 
-	if [ -z "${1}" ]; then
-		eerror "java-ant_rewrite-classpath needs one argument"
-		die "java-ant_rewrite-classpath needs one argument"
-	fi
-
 	local file="${1}"
+	[[ -z "${1}" ]] && file=build.xml
+
 	echo "Adding gentoo.classpath to ${file}"
 	debug-print "java-ant_rewrite-classpath: ${file}"
 
@@ -262,9 +260,42 @@
 
 	chmod u+w "${file}"
 
-	xml-rewrite.py -f "${file}" --change -e javac -e xjavac -a classpath -v '${gentoo.classpath}' || die "xml-rewrite failed: ${file}"
+	java-ant_xml-rewrite -f "${file}" --change -e javac -e xjavac -a classpath -v '${gentoo.classpath}'
 
 	if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
 		diff -NurbB "${file}.orig" "${file}"
 	fi
 }
+
+# ------------------------------------------------------------------------------
+# @public java-ant_ignore-system-classes
+#
+# Makes the available task ignore classes in the system classpath
+# ------------------------------------------------------------------------------
+java-ant_ignore-system-classes() {
+	debug-print-function ${FUNCNAME} $*
+	local file="${1}"
+	[[ -z "${1}" ]] && file=build.xml
+	echo "Changing ignoresystemclasses to true for available tasks"
+	java-ant_xml-rewrite -f "${file}" --change \
+		-e available -a ignoresystemclasses -v "true"
+}
+
+# ------------------------------------------------------------------------------
+# @public java-ant_xml-rewrite
+# Run the right xml-rewrite binary with the given arguments
+# ------------------------------------------------------------------------------
+java-ant_xml-rewrite() {
+	local bindir="${ROOT}/usr/bin/"
+	local gen2="${bindir}/xml-rewrite-2.py"
+	local gen1="${bindir}/xml-rewrite.py"
+	if [[ -x "${gen2}" ]]; then
+		${gen2} "${@}" || die "${gen2} failed"
+	elif [[ -x "${gen1}" ]]; then
+		${gen1} "${@}" || die "${gen1} failed"
+	else
+		eerror "No binary for rewriting found."
+		eerror "Do you have dev-java/javatoolkit installed?"
+		die "xml-rewrite not found"
+	fi
+}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-11 12:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-11 18:42 [gentoo-java] A new rewriter helper Petteri Räty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox