Bug 36270

Summary: [PATCH] code to support browse task
Product: Ant Reporter: Dave Brosius <dbrosius>
Component: Optional TasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: enhancement Keywords: PatchAvailable
Priority: P2    
Version: 1.6.5   
Target Milestone: ---   
Hardware: Other   
OS: other   
Attachments: [PATCH]Browse Task
add the taskdef to the properties file

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.