public inbox for gentoo-java@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Petteri Räty" <betelgeuse@gentoo.org>
To: gentoo-java@lists.gentoo.org
Subject: [gentoo-java] A new rewriter helper.
Date: Thu, 11 Jan 2007 20:42:16 +0200	[thread overview]
Message-ID: <45A68508.3030703@gentoo.org> (raw)


[-- 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 --]

                 reply	other threads:[~2007-01-11 12:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45A68508.3030703@gentoo.org \
    --to=betelgeuse@gentoo.org \
    --cc=gentoo-java@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox