Bug 36270 - [PATCH] code to support browse task
Summary: [PATCH] code to support browse task
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.6.5
Hardware: Other other
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2005-08-19 06:22 UTC by Dave Brosius
Modified: 2009-07-31 06:13 UTC (History)
0 users



Attachments
[PATCH]Browse Task (1.60 KB, text/plain)
2005-08-19 06:23 UTC, Dave Brosius
Details
add the taskdef to the properties file (858 bytes, patch)
2005-08-19 06:25 UTC, Dave Brosius
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Brosius 2005-08-19 06:22:07 UTC
task allows showing a url in a browser (cross platform)

<project name="test">
	<target name="test">
		<browse url="http://www.google.com"/>
	</target>
</project>
Comment 1 Dave Brosius 2005-08-19 06:23:15 UTC
Created attachment 16110 [details]
[PATCH]Browse Task
Comment 2 Dave Brosius 2005-08-19 06:25:04 UTC
Created attachment 16111 [details]
add the taskdef to the properties file
Comment 3 Steve Loughran 2005-08-19 11:26:06 UTC
I'm not sure this an ideal solution

1. it makes assumptions about the order of browser in unix
2. it rejects all other platforms.
3. malformed urls should be turned into build exceptions at the time of setting,
for proper diagnostics
4. its not really the thing automated builds do, though test result display is a
good case for it.

I do occasionally open browsers in my build file for test results, but just
<exec>  "open", having a bit of code to open a browser on every os (on windows
an exe to calls ShellExecuteEx() on the path, linux a script to run mozilla).
This is the way to do x-platform, but only by relying on native code.
Comment 4 Antoine Levy-Lambert 2006-09-10 21:26:40 UTC
I like this one personally. It is true that the code is "rustic". It will always
be possible to make this task more complex by adding attributes or nested
elements to execute specific commands on specific operating systems. We are
using already something similar as a macro in a lot of our build files where I
work, in order to view various HTML reports in developer builds.
Comment 5 Jesse Glick 2006-09-15 21:10:11 UTC
FWIW, NetBeans actually defines a special task for in-VM scripts, <nbbrowse>.
Used for test results, Javadoc, and some other things (when you run the
'interactive' variant of the target). The NB version picks up the web browser as
defined in IDE settings but it would be nice for there to be a standard task to
do this.


The patch should be made to use JDK 6's java.awt.Desktop class if it is
available, which neatly bypasses all the platform-specific code and ought to
behave more accurately to boot.


String os = System.getProperty("os.name").toLowerCase();

will cause OS detection to fail for Turkish and Azeri users of Windows and misc.
Unix. Use toLowerCase(Locale.ENGLISH) instead.