[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-ant-dev] new Ant tasks
|
In the spirit of better Eclipse/Ant integration, I am proposing additional
Eclipse specific Ant tasks similar to the few existing Eclipse specific Ant
tasks that I found. If you all approve, I'll propose these enhancements on
the newsgroup next to see what others are thinking. Hopefully some folks
out there (eclipse.org folks, users, etc, in addition to myself) will
contribute time to make this all happen. Obviously if eclipse.org already
has a plan in place I'll happily drop this one. All thoughts are most welcome.
Existing: (from the org.eclipse.core.resources plugin)
- eclipse.convertPath
- eclipse.incrementalBuild
- eclipse.refreshLocal
Proposed:
- eclipse.prompt
Prompt the user for one or more property values via simple one line text
fields. The current property value(s) appears as the default value(s) in
the prompter if one is not specified. A number of seconds to wait can be
specified, after which the dialog closes and either automatically accepts
the current values or throws a build exception indicating that no input was
received. If any input is received (e.g. the user pressed a key to modify
a current property value), then the countdown is stopped.
<eclipse.prompt
title="My prompt title"
message="My prompt message">
<property name="myPropertyA"/>
<property name="myPropertyB" value="a default value"/>
</eclipse.prompt>
Prompts the user for two property values
- eclipse.getWorkspaceLocation
Place the current workspace location into a property. (Perhaps this is
already or should be available as a pre-defined eclipse/ant property?)
<eclipse.getWorkspaceLocation property="aPropertyName"/>
Places the current workspace location into the property named
"aPropertyName"
- eclipse.getProjectLocation
Place the current location for the specified project into a property.
<eclipse.getProjectLocation project="MyProject"
property="aPropertyName"/>
Places the current location of "MyProject" into the property named
"aPropertyName"
- eclipse.getClasspathVariable
Places the current content for the specified classpath variable into a property
<eclipse.getClasspathVariable classpathVariable="ECLIPSE_HOME"
property="aPropertyName"/>
Places the current location of the classpath variable named
"ECLIPSE_HOME"
into the property named "aPropertyName"
- eclipse.getClasspath
Places the entire classpath for the specified project into a property. Any
references to classpath variables in the classpath will be replaced with
the current values for those classpath variables before the string is
placed into the property.
<eclipse.getClasspath project="MyProject" property="aPropertyName"/>
Places the current classpath of the project named "MyProject"
into the property named "aPropertyName"
- eclipse.getXML
Retrieves a value from an XML file and places it into a property. We
(Instantiations) use a simplified version of this internally in our build
process to retrieve the value of a top level XML element's attribute. This
is a first attempt to generalize this functionality, so feedback its form
and even on whether this should be part of the eclipse base is most welcome.
<eclipse.getXML
file="MyProject/aFile.xml"
attribute="version"
property="aPropertyName"/>
Parses the specified XML file and retrieves the value of the
specified attribute,
placing the value found into the property named "aPropertyName".
If the attribute is not found, then a build exception is thrown.
<eclipse.getXML
file="MyProject/aFile.xml"
attribute="version"
defaultValue="aDefaultValue"
property="aPropertyName"/>
Parses the specified XML file and retrieves the value of the
specified attribute,
placing the value found into the property named "aPropertyName".
If the attribute is not found, then "aDefaultValue" is used instead.
In the examples above, the specified attribute could be a path to an
attribute nested several levels deep in the XML structure. For example
attribute="foo/bar/attributeName"
Retrieves the specified attribute of the first element
with tag name bar
inside the first element with a tag name foo
attribute="foo[3]/bar[5]/attributeName"
Retrieves the specified attribute of the third element
with tag name bar
inside the fifth element with a tag name foo
- eclipse.setXML
Identical to eclipse.getXML, except modifies an attribute value rather than
retrieving its value.
Of course the above eclipse.getXML and eclipse.setXML tasks above might not
be the right approach at all to a build process. Perhaps imbedding
@VERSION@ in the plugin.xml and using ANT's Copy task with a filterset as
shown below would be a better approach.
<copy file="plugin.xml" todir="../output_dir" >
<filterset>
<filter token="VERSION" value="1.0.0" />
</filterset>
</copy>
The problem with this approach is that the runtime-workbench rejects this
in the plugin.xml, posting the following error message in the error log...
"!MESSAGE Error while processing
"file:C:/Dev/eclipse20020612/workspace/MyProject/plugin.xml: assertion
failed: The major (1st) component of plug-in version identifier,
"@VERSION@", must be numeric."."
... but perhaps the code for the runtime-workbench should be modified
instead of introducing eclipse.getXML and eclipse.setXML. All ideas are
welcome.
- Dan Rubel
Principal Member of Technical Staff
Instantiations, Inc.
412-492-9536 (land line)
412-400-7567 (cell)