JAVA_ANT_ENCODING

Petteri Räty <[email protected]> Tue, 01 Jul 2008 22:02:40 +0300
Newsgroups gmane.linux.gentoo.java
Message-ID <[email protected]>
Most of the time when Java files have !ascii characters they don't 
specify the used encoding in build.xml (usually ISO-8859-1) and 
javac/javadoc split out warnings about this (Many Gentoo machines are 
probably running with UTF8 locales). For this reason you can add 
JAVA_ANT_ENCODING="ISO-8859-1" to the ebuild and with the latest 
javatoolkit the build.xml will get modified to specify the proper encoding.

Regards,
Petteri
java-ant-encoding.patch (text/plain, 1.8 KB)
Index: java-ant-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v
retrieving revision 1.35
diff -u -r1.35 java-ant-2.eclass
--- java-ant-2.eclass	20 Jun 2008 10:32:15 -0000	1.35
+++ java-ant-2.eclass	1 Jul 2008 18:56:49 -0000
@@ -240,12 +245,22 @@
 
 		# for javadoc target and all in one pass, we need the new rewriter.
 		local rewriter3="/usr/share/javatoolkit/xml-rewrite-3.py"
-
 		if [[ ! -f ${rewriter3} ]]; then
 			rewriter3="/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-3.py"
 		fi
 
-		if [[ ! -f ${rewriter3} ]]; then
+		local rewriter4="/usr/$(get_libdir)/javatoolkit/bin/build-xml-rewrite"
+
+		if [[ -x ${rewriter4} && ${JAVA_ANT_ENCODING} ]]; then
+			[[ ${JAVA_ANT_REWRITE_CLASSPATH} ]] && local gcp="-g"
+			[[ ${JAVA_ANT_ENCODING} ]] && local enc="-e ${JAVA_ANT_ENCODING}"
+			eval echo "cElementTree rewriter" ${output}
+			debug-print "${rewriter4} extra args: ${gcp} ${enc}"
+			${rewriter4} ${gcp} ${enc} \
+				-c "${JAVA_PKG_BSFIX_SOURCE_TAGS}" source ${want_source} \
+				-c "${JAVA_PKG_BSFIX_TARGET_TAGS}" target ${want_target} \
+				"${@}" || die "build-xml-rewrite failed"
+		elif [[ ! -f ${rewriter3} ]]; then
 			debug-print "Using second generation rewriter"
 			eval echo "Rewriting source attributes" ${output}
 			eval xml-rewrite-2.py ${files} \
@@ -392,9 +431,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, 260 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhqf1MACgkQcxLzpIGCsLScHACfVeXphqe9aZAvbU09ciTOs+tB
7RAAn1Pw06+3524/Rs1Z9rbYqqayt7/G
=4gSO
-----END PGP SIGNATURE-----