RFC: java-ant_remove-taskdefs
Petteri Räty <[email protected]> Mon, 10 Mar 2008 01:05:53 +0200
| Newsgroups | gmane.linux.gentoo.java |
|---|---|
| Message-ID | <[email protected]> |
xml-rewrite-N.py only works on attributes so I think it's easiest to just have some inline python for this. Regards, Petteri
remove-taskdefs.patch
(text/plain, 1.7 KB)
Index: java-ant-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v
retrieving revision 1.30
diff -u -r1.30 java-ant-2.eclass
--- java-ant-2.eclass 5 Mar 2008 19:30:29 -0000 1.30
+++ java-ant-2.eclass 9 Mar 2008 23:01:32 -0000
@@ -380,6 +380,31 @@
}
# ------------------------------------------------------------------------------
+# @public java-ant_remove-taskdefs
+#
+# Removes taskdef elements from the file
+# @param $1 - the file to rewrite (defaults to build.xml)
+# ------------------------------------------------------------------------------
+java-ant_remove-taskdefs() {
+ debug-print-function ${FUNCNAME} $*
+ local file=${1:-build.xml}
+ echo "Removing taskdefs from ${file}"
+ python <<EOF
+import sys
+from xml.dom.minidom import parse
+dom = parse("${file}")
+for elem in dom.getElementsByTagName('taskdef'):
+ elem.parentNode.removeChild(elem)
+ elem.unlink()
+f = open("${file}", "w")
+dom.writexml(f)
+f.close()
+EOF
+ [[ $? != 0 ]] && die "Removing taskdefs failed"
+}
+
+
+# ------------------------------------------------------------------------------
# @public java-ant_ignore-system-classes
#
# Makes the available task ignore classes in the system classpath
@@ -387,9 +412,8 @@
# ------------------------------------------------------------------------------
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"
+ local file=${1:-build.xml}
+ echo "Changing ignoresystemclasses to true for available tasks in ${file}"
java-ant_xml-rewrite -f "${file}" --change \
-e available -a ignoresystemclasses -v "true"
}
signature.asc
(application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFH1G1UcxLzpIGCsLQRAq2UAJ0aP9/aE4hdrukCr5UvDKHd+h4MtgCfcNfa 4enCq/ohIwny9FQSJKvIQgg= =+ukM -----END PGP SIGNATURE-----