Ant/Ant buildfile refactorings

From Eclipsepedia

Jump to: navigation, search
Ant buildfile refactorings
Possible mentors: Darin Swanson
Related Project: Platform Ant
Description: Ant buildfiles can become large and complex and would benefit from refactoring. Currently there is no support beyond renaming within a buildfile to allow the developer to efficiently refactor Ant buildfiles. The goals would be to implement an infrastructure to support refactorings in Ant buildfiles, participate in other components refactorings and provide a starter set of Ant buildfile refactorings.
Further information


Of course, eclipse support ant. But now, in mdern project ant build files became to difficult to maintaine and refactor. Goal of this proposal - to implement an infrastructure to support refactorings for ant files, provide more clear and visual tool for working with ant tasks ant targets.

Planned List of Ideas for this summer (taken from eclipse bug db)

1. Something like "extract method" - You one task and could generate a <presetdef>. - You select multiple tasks and could generate a <macrodef>. - You select a <script> and could generate a <scriptdef>. (2) could be used inside

2. Introduce attributes (see "introduce parameters" on methods)

<macrodef name="foo">
        <echo message="Hello World"/>

would be

<macrodef name="foo">
    <attribute name="msg"/>
        <echo message="@{msg}"/>
<foo msg="Hello World"/>

3. Convert <presetdef> to <macrodef> Rename <presetdef> to <macrodef> and include the <sequential> container.

4. Rename - rename of properties (dont know if it works already) - definitions by <*def>

 -- change the value in the name-attribute
 -- change the value in "tasks"
 -- example (from 2):
    foo --> myecho
    --- <macrodef name="myecho">...
    --- <myecho msg="...

5. Extract property - Select an attribute value and it will introduce a property with that value.

  <echo message="Hello World"/>
 converted to
  <property name="msg" value="Hello World"/>
  <echo message="${msg}"/>

6. Property bundle (see I18N-stuff) - gives a list with all properties - you select the properties to put into the new file - will be created and load into the build file

7. Pull up / push down In Java code this means moving between a class and itДs parent. Here it would move between the actual buildfile and an <import>ed one. Could also be done with Drag&Drop in the Outline View (drag target on <import>) or Package Explorer.

For future period

If all previous ideas would been realized, I`m planning extend them with ant dependency grafic representation.