Hi all,
Below is a patch for the Ant bundle. It fixes up the htmlization of the Ant output (escapes the output correctly so that, for example, generics display correctly). It also turns htmlization back on, so that you can click on error messages to jump to the appropriate line again. Finally, it adds source.java to the scope of the build command so you can build from a source file, not just from the build file.
I haven't turned column parsing back on... yet.
Be well,
Will :-}
Index: Commands/Build.tmCommand =================================================================== --- Commands/Build.tmCommand (revision 11139) +++ Commands/Build.tmCommand (working copy) @@ -13,7 +13,7 @@
TM_PROJECT_DIR=`dirname "$TM_PROJECT_FILEPATH"`;
-#TM_ANT_BUILD_PARSER=htmlize_ant.py +TM_ANT_BUILD_PARSER=htmlize_ant.py
if [[ "$TM_ANT_BUILD_PARSER" == "" ]]; then TM_ANT_BUILD_PARSER=pre @@ -42,7 +42,7 @@ <key>output</key> <string>showAsHTML</string> <key>scope</key> - <string>text.xml.ant</string> + <string>source.java, text.xml.ant</string> <key>uuid</key> <string>C7888301-C304-4EF2-A15F-5681A7D6D13C</string> </dict> Index: Support/bin/htmlize_ant.py =================================================================== --- Support/bin/htmlize_ant.py (revision 11139) +++ Support/bin/htmlize_ant.py (working copy) @@ -1,6 +1,6 @@ #!/usr/bin/python
-import sys, os.path, re, os +import sys, os.path, re, os, cgi
matcher = re.compile( r'(/.*?):(\d+):\s*(.*)$' @@ -20,6 +20,8 @@
sys.stdout.flush()
+print "<pre>" + ## read all data from stdin lastLine = None line = sys.stdin.readline() @@ -33,15 +35,13 @@
match = matcher.search(line)
- print "<pre>" - if not match: - print line + print cgi.escape(line) else: fn = match.group(1)
if proj_dir and fn.startswith(proj_dir): - short_name = fn[len(proj_dir):] + short_name = '/.../' + fn[len(proj_dir):] else: short_name = fn
@@ -56,19 +56,21 @@ ## # print lastLine[(brktInd + 2):], colInd
- print line[:match.start()].rstrip(), - print '<a href="txmt://open?url=file://%s&line=%s&column=%d"> %s:%s: %s</a>' % ( - fn, match.group(2), colInd, short_name, match.group(2), match.group(3) + print cgi.escape(line[:match.start()].rstrip()), + print '<a href="txmt://open?url=file://%s&line=%s&column=%d"> %s:%s</a>: %s' % ( + cgi.escape(fn), match.group(2), colInd, cgi.escape(short_name), + match.group(2), cgi.escape(match.group(3)) ), - print line[match.end():] + print cgi.escape(line[match.end():])
- print "</pre>" sys.stdout.flush()
## read next line lastLine = line line = sys.stdin.readline()
+print "</pre>" + print """ </body> </html>
On 23/01/2009, at 3:31 PM, William Uther wrote:
Below is a patch for the Ant bundle. It fixes up the htmlization of the Ant output (escapes the output correctly so that, for example, generics display correctly). It also turns htmlization back on, so that you can click on error messages to jump to the appropriate line again. Finally, it adds source.java to the scope of the build command so you can build from a source file, not just from the build file.
Can you please send this patch to me directly as an attachment.
It's being wrapped which makes it impossible to apply.
Below is a patch for the Ant bundle. It fixes up the htmlization of the Ant output (escapes the output correctly so that, for example, generics display correctly). It also turns htmlization back on, so that you can click on error messages to jump to the appropriate line again. Finally, it adds source.java to the scope of the build command so you can build from a source file, not just from the build file.
Can you please send this patch to me directly as an attachment.
Can you cc me in on this too - and thanks for the patch :)
I intentionally made the Build.tmCommand generic so it copes with any output, so as long the changes to htmlize_ant.py cope with this then all's good. I'm expecting that it's tailored to Java compiler output and a comment/tip explaining how to customise the command would be more appropriate.
That said if the majority of people are using the Ant bundle for Java development then maybe it should work out of the box for those users? I use it for ActionScript/Flex so I'm biased in the other direction...
Cheers, Simon
is this added into the next or latest version of the ant bundle? sorry, i'm not used to patching things like this
On Wed, Jan 28, 2009 at 3:02 PM, Simon Gregory simon@helvector.org wrote:
Below is a patch for the Ant bundle. It fixes up the htmlization of the Ant output (escapes the output correctly so that, for example, generics display correctly). It also turns htmlization back on, so that you can click on error messages to jump to the appropriate line again. Finally, it adds source.java to the scope of the build command so you can build from a source file, not just from the build file.
Can you please send this patch to me directly as an attachment.
Can you cc me in on this too - and thanks for the patch :)
I intentionally made the Build.tmCommand generic so it copes with any output, so as long the changes to htmlize_ant.py cope with this then all's good. I'm expecting that it's tailored to Java compiler output and a comment/tip explaining how to customise the command would be more appropriate.
That said if the majority of people are using the Ant bundle for Java development then maybe it should work out of the box for those users? I use it for ActionScript/Flex so I'm biased in the other direction...
Cheers, Simon
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate