New function to rewrite build.xml: adds classpath.
authorKrzysztof Pawlik <nelchael@gentoo.org>
Sun, 6 Aug 2006 17:03:26 +0000 (17:03 +0000)
committerKrzysztof Pawlik <nelchael@gentoo.org>
Sun, 6 Aug 2006 17:03:26 +0000 (17:03 +0000)
eclass/java-ant-2.eclass

index 2751e9173bc7119aad89d045150184c4efada472..001f0bda442d8a14322e07d0afb8ae101b9fa271 100644 (file)
@@ -171,3 +171,31 @@ java-ant_bsfix_one() {
                fi
        fi
 }
+
+# ------------------------------------------------------------------------------
+# @public java-ant_rewrite-classpath
+#
+# Adds 'classpath="${gentoo.classpath}"' to specified build file.
+# ------------------------------------------------------------------------------
+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}"
+       echo "Adding gentoo.classpath to ${file}"
+       debug-print "java-ant_rewrite-classpath: ${file}"
+
+       cp "${file}" "${file}.orig" || die "failed to copy ${file}"
+
+       chmod u+w "${file}"
+
+       xml-rewrite.py -f "${file}" --change -e javac -e xjavac -a classpath -v '${gentoo.classpath}' || die "xml-rewrite failed: ${file}"
+
+       if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
+               diff -NurbB "${file}.orig" "${file}"
+       fi
+}