Bug 89938 - [refactoring] Some refactorings for Ant buildfiles
Summary: [refactoring] Some refactorings for Ant buildfiles
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-01 07:04 EST by Jan Matèrne CLA
Modified: 2019-11-27 07:02 EST (History)
7 users (show)

See Also:


Attachments
Fix bug wiht renaming properties. Also add support of renaming tasks/macrodefs/presetdefs/scriptdefs. (38.21 KB, patch)
2009-07-25 14:47 EDT, st.shadow CLA
no flags Details | Diff
Correct RenameInFile with testcases of new functionality, ExtractTaskAction (95.82 KB, patch)
2009-08-23 16:27 EDT, st.shadow CLA
no flags Details | Diff
First part of patch - just bugfix of existen RenameInFile action and tests for it. (77.45 KB, patch)
2009-09-19 06:49 EDT, st.shadow CLA
no flags Details | Diff
Correct RenameInFile with testcases of new functionality, ExtractTaskAction (93.65 KB, patch)
2009-09-19 07:14 EDT, st.shadow CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Matèrne CLA 2005-04-01 07:04:14 EST
It would be nice to have some refactorings while writing buildfiles:

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">
    <sequential>
        <echo message="Hello World"/>
    </sequential>
</macrodef>
<foo/>

would be

<macrodef name="foo">
    <attribute name="msg"/>
    <sequential>
        <echo message="@{msg}"/>
    </sequential>
</macrodef>
<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 build.properties file
- build.properties will be created and load into the build file
Comment 1 Darin Swanson CLA 2005-04-01 10:55:45 EST
In Eclipse M6 there is rudimentary support for renaming of properties and targets.
This is all that is planned for 3.1 due to time constraints and the 3.1 feature
window effectively closing with the release of M6.

Thanks for the great ideas though...
Comment 2 Jan Matèrne CLA 2005-04-01 10:58:13 EST
Ah - there is Ant. Havent found the right Product. Is there any possibility to 
search for that? Say searching with "Ant" and getting all products and 
components for Ant?
Comment 3 Darin Swanson CLA 2005-04-01 11:05:22 EST
From https://bugs.eclipse.org/bugs/query.cgi, set the "Product" to 
be "Platform" and the "Component" to be "Ant". This will produce all the bugs 
related to the Eclipse Ant integration.

Fill in the rest as desired to refine the search.
Comment 4 Jan Matèrne CLA 2005-05-12 07:34:05 EDT
Just another ideas:

7. Externalize/inline scripts
Script parts defined in <script> / <scriptdef> could be externalized into
a new file. That new file could then be opened with a registered editor to
get more IDE language support.

<script language="javascript">
    getProject().log("Hello World");
</script>

-----

<script language="javascript" src="helloWorld.js"/>

helloWorld.js:
getProject().log("Hello World");


(helloWorld.js is typed in by the user while refactoring)



7. support for nested languages
In <script> or <scriptdef> you use other languages like javascript,
jython, bsh, etc. It would be helpful to get the "usual" help from
the IDE as inside Java (starting with code formatting and syntaxhightlighting...)
That support could be available if there is the right lanaguage plugin is
registered.
Comment 5 Jan Matèrne CLA 2005-05-17 05:33:06 EDT
While reading all the "New & Noteworthy" pages (MS1-MS7) to get an idea for 
a "What´s new in 3.1" workshop, I got another idea:

9. 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.
Comment 6 Jan Matèrne CLA 2007-09-14 04:36:50 EDT
ping ;-)
Comment 7 Darin Swanson CLA 2007-09-17 18:10:36 EDT
Thanks for the ping Jan but limited features are planned for Ant in the 3.4 timeline and nothing of this scale.
Comment 8 st.shadow CLA 2009-03-26 05:42:35 EDT
I think, google summer of code perform new life for this ideas :)
Comment 9 st.shadow CLA 2009-03-30 03:02:24 EDT
I submit draft of proposal at 
http://wiki.eclipse.org/Ant_buildfile_refactorings
You free add comments to it!
Comment 10 Jan Matèrne CLA 2009-03-31 02:00:02 EDT
It was already listed on http://wiki.eclipse.org/Google_Summer_of_Code_2009_Ideas (5th 'real' entry). But I think the new wiki page is nice and should be linked from the ideas-page.
Comment 11 st.shadow CLA 2009-05-23 12:30:00 EDT
As you know - this year these refactorins ideas were posted to GSoC 2009 by me.
And I was accepted :) With Darin Swanson ( Hello :) ) as a mentor.
Comment 12 Remy Suen CLA 2009-07-11 19:42:21 EDT
(In reply to comment #11)
> As you know - this year these refactorins ideas were posted to GSoC 2009 by me.
> And I was accepted :) With Darin Swanson ( Hello :) ) as a mentor.

How is this coming along?
Comment 13 st.shadow CLA 2009-07-14 15:52:33 EDT
Hi!
I would like a little report on the work done. Now almost finished 4 features.
Honestly, I had to fix an existing bug in order to implement this one. But now I really like the results.
Comment 14 st.shadow CLA 2009-07-25 14:47:38 EDT
Created attachment 142587 [details]
Fix bug wiht renaming properties. Also add support of renaming tasks/macrodefs/presetdefs/scriptdefs.

This patch fixes:
bug, when Rename In File work incorrectly on properties or tasks with similar names. 
Also add support of renaming:
macrodefs (including calls to them)
macrodef`s attributes (inluding names at calls to mactodefs)
correct renaming ts with the same name, but different namespace.
Comment 15 st.shadow CLA 2009-08-23 16:27:54 EDT
Created attachment 145358 [details]
Correct RenameInFile with testcases of new functionality, ExtractTaskAction

Add tests for new functionality at RenameInFileAction.
Also move refactoring items to new submenu "Refactoring"
Add ExtractTaskAction, but still unfixed bug with final step, when editor after refactoing start blinking.
Comment 16 st.shadow CLA 2009-09-19 06:49:59 EDT
Created attachment 147631 [details]
First part of patch - just bugfix of existen RenameInFile action and tests for it.

As I was asked - I devide my summer work on bugfix of RenameInfFile and new Exrtact task.
Comment 17 st.shadow CLA 2009-09-19 07:14:41 EDT
Created attachment 147632 [details]
Correct RenameInFile with testcases of new functionality, ExtractTaskAction

Add tests for new functionality at RenameInFileAction.
Also move refactoring items to new submenu "Refactoring"
Add ExtractTaskAction, but still unfixed bug with final step, when editor after
refactoing start blinking.
Removed unnessesary trash from pugins.xml
Comment 18 David Carver CLA 2009-11-24 10:56:24 EST
Any more movement on this?
Comment 19 st.shadow CLA 2009-11-24 14:17:11 EST
First part of patch is tested, but it just fix (and improve :) ) existen bugs with renaming action.
Second - new functionality, but still with bug: some problems with refreshing of editor after extracting task.
Comment 20 Remy Suen CLA 2010-01-20 16:12:18 EST
Is this going to be in for 3.6? :o
Comment 21 Michael Rennie CLA 2010-03-01 14:40:36 EST
(In reply to comment #20)
> Is this going to be in for 3.6? :o

No this is not going to be 3.6
Comment 22 Jan Matèrne CLA 2010-11-07 18:42:49 EST
Chances for 3.7?
Comment 23 st.shadow CLA 2010-11-08 02:17:54 EST
(In reply to comment #22)
> Chances for 3.7?

No chances
Comment 24 Per Arnold Blaasmo CLA 2013-02-11 08:25:43 EST
Anything happening in this area?
I currently started using Antunit for doing unit tests of build scripts, and would love to have re-factoring as part of working TDD with build scripts.
Comment 25 Michael Rennie CLA 2013-02-11 10:16:01 EST
(In reply to comment #24)
> Anything happening in this area?
> I currently started using Antunit for doing unit tests of build scripts, and
> would love to have re-factoring as part of working TDD with build scripts.

Sadly, no. There are no committer resources to work on this.
Comment 26 Lars Vogel CLA 2019-11-27 07:02:48 EST
This bug hasn't had any activity in quite some time. Maybe the problem got
resolved, was a duplicate of something else, or became less pressing for some
reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it.
The information can be, for example, that the problem still occurs, that you
still want the feature, that more information is needed, or that the bug is
(for whatever reason) no longer relevant.

If the bug is still relevant, please remove the stalebug whiteboard tag.