Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 34757

Summary: Support for other repository
Product: [Eclipse Project] PDE Reporter: Pascal Rapicault <pascal>
Component: BuildAssignee: Pascal Rapicault <pascal>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: benjamin.booth, bugzilla, carsten.pfeiffer, David.Olsen, fg, gunnar, kcoleman, Matthew_Hatem, rainer, ryanman, tlroche
Version: 2.1Keywords: helpwanted
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Patch to add support for pluggable fetch script bulder
none
[patch] pluggable fetch script builder
none
34757_pluggable_fetch_script_builder.patch.txt
none
34757_pluggable_fetch_script_builder.patch.txt
none
34757_pluggable_fetch_script_builder.patch.txt
none
34757_pluggable_fetch_script_builder.patch.txt
none
34757_pluggable_fetch_script_builder.patch.txt
none
34757_pluggable_fetch_script_builder.patch.txt
none
34757_copy_extension.patch.txt
none
34757_fetchTag_fix.patch.txt
none
34757_copy_extension.patch.txt
none
34757_copy_extension.patch.txt none

Description Pascal Rapicault CLA 2003-03-11 17:41:27 EST
The fetch script generator used in the builder should be able to handle several 
repositories to fetch from.

Jeff proposed the following solutions:
- build and skip the fetch step so assume that everything required has been 
fetched by some other means
- replace the entire fetch portion in the customtargets.xml
- make the fetch generator pluggable so support different repos and update the 
map file format to put different values for the repo-specific slots.  The 
generator would then generate script content depending on the repo involved.

The last one seems to be the most clean.
Comment 1 DJ Houghton CLA 2003-11-20 13:15:52 EST
Changing bug assignment to pde-build-inbox. (pde-core-inbox is obsolete)
Comment 2 Gunnar Wagenknecht CLA 2004-06-21 10:10:03 EDT
Hello,

I started implementing a patch to make the fetch file generation pluggable. so 
far I've extracted the CVS specific part into it's own implementation and 
added a simple fetch script builder for fetching files from a specific 
location. The location is splitted into ROOT and PATH to allow a custom 
overwrite of the root via the "fetchTag" property.

The only difference is the "cvsPassFile" argument which cannot be supported 
anymore in the fetch task. But I don't think this is a problem because it 
wasn't used inside the basebuilder and the eclipsebuilder. It can now be 
specified inside the MAP files. Not sure if this is a suitable solution or if 
this should be changed to an overwritable mechanism (like "fetchTag").

I'm also thinking of writing an URL fetch builder that will fetch a zip from a 
specified URL and extract it into the destination. This might be usefull for 
tools building against a base Eclipse. Currently they have to write this into 
the customTargets.xml

The current "pluggable" mechanism is not yet implemented by extension points 
which is still a TODO item.

The map file format will not change significantly. Instead the is just an 
additional entry which must be in front of all other repository specific 
arguments. It's the repository identifyer.

Example
feature@org.eclipse.platform=CVS,....
feature@my.custom.feature=PATH,/specificView/vobs/,myVob/features/my.custom.fea
ture-feature

The simple PATH repository allows a basic support for our ClearCase 
environment. 

I just want to let you know, that I'm working on the base support for this.

Cu, Gunnar
Comment 3 Pascal Rapicault CLA 2004-06-21 18:12:19 EDT
Gunnar, I am really glad to hear that you are starting tackling this problem.

I'm not sure I understand what you are doing regarding the fetchTag. But 
fetchTag should only be used to describe the tag of the things you are getting 
from the repo (like for example v20040621), although the value is then passed 
to the script 'as is'.

Will the change you are proposing for the map file will allow to keep the 
eclipse map files unchanged?

Why wouldn't we introduce a tag directly in the beginning of the line 
representing the type of the repository. This way we could say: if there is a 
tag then use the repo indicated (this would be matched against the available 
extensions), if not use CVS (this way people using CVS and that already have 
map files don't have to change anything). This solution would allow to define 
the map file format to be totally different from a repo to another if necessary.
What do you think?

Regarding fetching the files from a URL, there is already such a support in the 
FetchFileGenerator (and FetchFileGeneratorTask) that relies on the map file 
format from the packager (see bug #32242).

Again, I looking forward to see your contribution !
Comment 4 Gunnar Wagenknecht CLA 2004-06-21 23:57:29 EDT
Yes, it's possible to keep the Eclipse map files unchanged (backward 
compatibility).

How can I use the packager? I couldn't find it in the eclipsebuilder or 
gefbuilder.

Comment 5 Gunnar Wagenknecht CLA 2004-06-22 03:07:58 EDT
Created attachment 12626 [details]
Patch to add support for pluggable fetch script bulder

This is a first version of the patch providing the extension point
"org.eclipse.pde.build.fetchScriptBuilder" and two inital builds for fetching
from CVS an from a local PATH (works also with local mapped network shares)
Comment 6 Gunnar Wagenknecht CLA 2004-06-22 03:17:54 EDT
TODO: finalize API in IFetchScriptBuilder and move it into a public package to 
allow other repository providers start contributing.

Backward compatibility is retained. Current Eclipse map files should still 
work.

In general, the new format is:
type@element=<BUILDERID>,otherArgs,..

Example:

feature@my.feature=PATH,D:/snapshot_views/stable,clearcase_vob/features/my.feat
ure-feature

Will fetch feature "my.feature" 
from "D:/snapshot_views/stable/clearcase_vob/features/my.feature-feature".

Property "fetchTag" is also supported to define another location. 
If "fetchTag" is set to "D:\snapshot_views\latest" the effective path would 
be "D:/snapshot_views/latest/clearcase_vob/features/my.feature-feature".


Also supported:
plugin@org.eclipse.draw2d=I20040619,:pserver:anon...
and
plugin@org.eclipse.draw2d=CVS,I20040619,:pserver:anon...


----------
Example extension:
----------
<extension
   point="org.eclipse.pde.build.fetchScriptBuilder">
  <builder
    class="org.eclipse.pde.internal.build.PATHFetchScriptBuilder"
    id="PATH"/>
  <builder
    class="org.eclipse.pde.internal.build.CVSFetchScriptBuilder"
    id="CVS"/>
</extension>
----------
Comment 7 DJ Houghton CLA 2004-07-15 14:37:15 EDT
Thanks for the patch. We will investigate this for inclusion in 3.1.
Comment 8 Pascal Rapicault CLA 2005-03-28 16:09:18 EST
*** Bug 89284 has been marked as a duplicate of this bug. ***
Comment 9 DJ Houghton CLA 2005-04-01 14:07:44 EST
Unable to release patch due to backwards compatibility issues.

Deferring bug to post-3.1.
Comment 10 Pascal Rapicault CLA 2005-04-08 09:15:18 EDT
David Olsen wrote:

1. There are too many variations on fetching source from ClearCase: UCM vs.
base-CC, copy from view vs. build directly in view, snapshot view vs. dynamic
view, reuse an existing view vs. create a new view with each build. 
Incorporating that into PDE build would mean either supporting just a couple
options, which wouldn't work for all users, or supporting all variations, which
would be difficult to control.  It also seems like a core Eclipse plugin
shouldn't be burdened with all the intricacies of ClearCase.

2. ClearCase just isn't compatible with the existing map files structure.  In
ClearCase it isn't possible to specify different labels or tags for individual
plugins.  The unit of labelling is the VOB, which would be at least an entire
Eclipse feature, probably a set of related features.  So if PDE build were
changed to support ClearCase, I think the map files would have to be thrown out
all together in favor of some other way of specifying how to fetch the source.

So now I am thinking the best approach is to change PDE build so it is easy to
disable the entire fetch step, such as by putting noFetch=true in
build.properties.  Users who disable the fetch would be expected to set up the
source directory correctly before invoking PDE build.
Comment 11 Pascal Rapicault CLA 2005-04-08 09:20:11 EDT
I'm fine with disabling the fetch step. This is necessary for other people
anyway. However the problem is that by doing it you are opting out of the
automatic generation of version numbers (unless of course your fetch task
creates the expected file for pde to later reconsume).
Moreover if the product you are trying to build is spread across various repo (a
CVS, CC, etc.), then the fetch task that takes care of following the dependency
will not be useful.

I was thinking that PDE FetchScriptGenerator task could provide an extension
point, thus allowing various repositories to be plugged in and still leveraging
the existing code base. As for the map file, it is fine if you have a specific
format for CC as long as you can find if it contains a given plugin or feature.
Comment 12 Gunnar Wagenknecht CLA 2005-04-08 14:08:53 EDT
(In reply to comment #9)
> Unable to release patch due to backwards compatibility issues.

Mhm. The patch is backwards compatible. You don't have to change your map files.

I'm working with a generic "copy" fetch extension using this patch and
ClearCase. Thus, we don't care about labeling etc. All ClearCase related stuff
is done before (setting configSpec, updating view) and after (labeling) invoking
PDE build. The map files are only used to copy the features and plugins from the
ClearCase view to the build directory.

We havn't switched to M6 yet but I'm planning to do this soon. Thus, I need to
update the patch anyway.
Comment 13 Gunnar Wagenknecht CLA 2005-06-02 02:06:28 EDT
Created attachment 22206 [details]
[patch] pluggable fetch script builder

New version updated to latest changes in org.eclipse.pde.build.

This patch adds an extension point for registering fetch script builds than can
be used during fetch script generation. It comes with two fetch script builders
included: a CVS fetcher and a COPY fetcher.

The current map files used within Eclipse.org continue to work. They do not
need to be updated. They will use the CVS fetcher by default.

To use another fetcher you need to prefix the map file entries with the fetcher
id.

Example:
feature@my.feature=COPY,d:/myrepository,features/my.feature-feature

Will generate a script that copies the feature from
d:/myrepository/features/my.feature-feature. 

The 'fetchTag' property can be used to replace 'd:/myrepository' with another
path (for example, on another build machine or to fetch from another repository
with a different version).
Comment 14 Gunnar Wagenknecht CLA 2005-06-02 02:14:34 EDT
(In reply to comment #13)
> To use another fetcher you need to prefix the map file entries with the fetcher
> id.

If the fetcher id is unknown (not found) it will default to the CVS fetcher.
Comment 15 Gunnar Wagenknecht CLA 2005-11-29 04:15:58 EST
Created attachment 30757 [details]
34757_pluggable_fetch_script_builder.patch.txt

New version of the patch against current HEAD
- changed from interface IFetchScriptBuilder to abstract class FetchScriptBuilder
Comment 16 Gunnar Wagenknecht CLA 2005-11-29 04:22:55 EST
(In reply to comment #15)
> Created an attachment (id=30757) [edit]
> 34757_pluggable_fetch_script_builder.patch.txt

Todo: 

This patch adds new API to PDE Build and requires some classes/interfaces that are currently internal. These classes needs to be refactored into public packages. 

- org.eclipse.pde.internal.build.ant.ITask
- org.eclipse.pde.internal.build.ant.AntScript

Should this be tracked in a separate bug entry?
Comment 17 Pascal Rapicault CLA 2006-01-10 18:05:00 EST
Will consider for 3.2.
Comment 18 Benjamin Booth CLA 2006-01-11 15:37:03 EST
All,

Gunnar, thank you for these changes!  Seeing as how they're being considered for 3.2...

I've implemented a Perforce P4FetchScriptGenerator that plugs into Gunnar's changes.  With help from Luis de la Rosa, our automated builds now run hourly with it.

We believe the webMethods' legal hurdle to contributing this back will be minimal.  In the meantime, I'm cleaning my changes and javadoc'ing stuff.  

In addition, the P4FetchScriptGenerator depends on different semantics when using Perforce-style map files.  This will need some documentation (or updates to documentation) which I'll be happy to provide.

Not being an Eclipse committer, I suppose I'll need to send a patch file for someone to review.  Not sure what next...

Cheers,
Ben
Comment 19 Pascal Rapicault CLA 2006-01-18 16:54:35 EST
The patch looks promising. 

A few comments:
- AntScript and ITask are not API. Do we really want to make those two classes API, can't we restrict what is exposed?
- FetchScriptBuilder is not an ideal name.
- Needs to specify the wellknown keys that will be part of the map that is being passed around.
- How do I specify the final location where I want to thing to be downloaded / put
- Code style should use http://www.eclipse.org/eclipse/platform-core/documents/coding_conventions.html 

Comment 20 Gunnar Wagenknecht CLA 2006-01-19 05:27:29 EST
(In reply to comment #19)
> The patch looks promising. 

Thanks for your review.

> A few comments:
> - AntScript and ITask are not API. Do we really want to make those two classes
> API, can't we restrict what is exposed?

That's one of the open issus. I'll try to create a proposal (patch) for this.

> - FetchScriptBuilder is not an ideal name.

I'm open for any suggestions.

> - Needs to specify the wellknown keys that will be part of the map that is
> being passed around.

Do you think of documenting the keys? The map isn't currently documented in the main Eclipse documentation.

> - How do I specify the final location where I want to thing to be downloaded /
> put

AFAIK the property ${destination} is set by PDE Build before the fetch script is called. I agree that this should be better documented.

> - Code style should use
> http://www.eclipse.org/eclipse/platform-core/documents/coding_conventions.html 

Ok. I will try to rework the patch next week.

Comment 21 Gunnar Wagenknecht CLA 2006-01-30 05:42:11 EST
(In reply to comment #19)
> - FetchScriptBuilder is not an ideal name.

Any suggestions for a better naming? FetchScriptGenerator is already used by the main generator class.

After thinking a while about it, the real task of the FetchScriptBuilder is to create Ant Tasks for the fetch scripts. Thus, it's not really a fetch script builder but a fetch task factory.

Possible candidates are:
FetchTaskFactory
FetchScriptTaskFactory

I'm ok with both names but would use the larger one for a better clarity and conformity with existing classes. This will also change the name of the extension point.

Any opinions/objections/other proposals?

Comment 22 Benjamin Booth CLA 2006-01-30 12:01:21 EST
(In reply to comment #21)
> (In reply to comment #19)
> > - FetchScriptBuilder is not an ideal name.
> 
> Any suggestions for a better naming? FetchScriptGenerator is already used by
> the main generator class.
> 
> After thinking a while about it, the real task of the FetchScriptBuilder is to
> create Ant Tasks for the fetch scripts. Thus, it's not really a fetch script
> builder but a fetch task factory.
> 
> Possible candidates are:
> FetchTaskFactory
> FetchScriptTaskFactory
> 
> I'm ok with both names but would use the larger one for a better clarity and
> conformity with existing classes. This will also change the name of the
> extension point.
> 
> Any opinions/objections/other proposals?
> 


Gunnar,

You could also do FetchTaskCreator.  

For whatever this is worth, I like FetchTaskFactory though; "factory" is a more standard term.  FetchScriptTaskFactory is unecessarily verbose.

-ben
Comment 23 Pascal Rapicault CLA 2006-01-30 16:36:28 EST
Gunnar, sorry for the late reply.
I'm fine with either FetchTaskFactory or FetchTaskCreator. It is your choice.

>keys in the map
When I'm talking about the keys in the map. I'm not referring to the actual format of the map files, but to the object that is being passed to the factories and back to the generator. 

Do you think you can have the patch ready by the end of the week?
Comment 24 Pascal Rapicault CLA 2006-01-30 16:39:48 EST
Benjamin, does your perforce factory use the standard perforce ANT tasks?
Are you still ok to provide us with a patch once Gunnar will be done with his (this can wait after M5).
Comment 25 Benjamin Booth CLA 2006-01-30 17:07:40 EST
(In reply to comment #24)
> Benjamin, does your perforce factory use the standard perforce ANT tasks?
> Are you still ok to provide us with a patch once Gunnar will be done with his
> (this can wait after M5).
> 

Yes, it uses standard perforce Ant tasks.  My plugin to Gunnar's code also uses a Perforce-specific modification I made to AntScript.  Imo, AntScript should be public API with minor extensibility improvements to keep from putting every SCM's Ant creation code in AntScript.java.

Here are the requirements to use the Perforce Ant commands: http://ant.apache.org/manual/OptionalTasks/perforce.html

Of importance, it requires the jakarta-oro JAR.

Yes, I'm very interested in providing a patch.  Just say where and when.
Comment 26 Gunnar Wagenknecht CLA 2006-01-31 03:02:22 EST
Created attachment 33845 [details]
34757_pluggable_fetch_script_builder.patch.txt

Here is the new patch.

- Renamed FetchScriptBuilder to FetchTaskFactory
- Renamed extenion point to "org.eclipse.pde.build.fetchTaskFactories"
FetchTaskFactory
- Modified FetchTaskFactory to return CharSequence objects (eg. String, StringBuffer), i.e. no need to make AntScript and ITask API
- Added constansts + JavaDoc for well known (common) map keys to 
- Reformated to Platform Core style conventions (hopefully)

Pascal, please review.
Comment 27 Gunnar Wagenknecht CLA 2006-01-31 03:10:47 EST
Created attachment 33847 [details]
34757_pluggable_fetch_script_builder.patch.txt

reformated FetchTaskFactoriesRegistry
Comment 28 Pascal Rapicault CLA 2006-02-02 12:36:10 EST
Comments on the last patch. Once those will be fixed I will likely integrate.

FetchTaskFactoriesRegistry
- Need to use the PDE Build constant
- The synchronization is not correct. For example in getFactory(String id) the initializeRegitry() code can return, another thread can invoke the registry changed event, which will then cause the line IConfigurationElement extension = (IConfigurationElement) factories.get(id) to NPE. 

FetchScriptGenerator:
- updates the comment to talk in terms of factory and not builder

Does CVS factory fails gracefully if given something bogus to parse (I haven't dug in the code)?

AntScript / ITask:
The code still uses ITask to then transform it in a CharSequence?
Maybe we should just make AntScript and ITask API, pass the script to the factory and tell people to use AntScript#print(ITask)

I have not reviewed in details the other changes to AntScript, FetchScriptGenerator as the diff was impossible because the methods have been sorted. In the next patch you provide make sure you don't sort the methods. Thx.
Comment 29 Gunnar Wagenknecht CLA 2006-02-06 02:07:03 EST
Created attachment 34178 [details]
34757_pluggable_fetch_script_builder.patch.txt

(In reply to comment #28)
> Comments on the last patch. Once those will be fixed I will likely integrate.

Great. :)

> FetchTaskFactoriesRegistry
> - Need to use the PDE Build constant

Done.

> - The synchronization is not correct. For example in getFactory(String id) the
> initializeRegitry() code can return, another thread can invoke the registry
> changed event, which will then cause the line IConfigurationElement extension =
> (IConfigurationElement) factories.get(id) to NPE. 

I see the problem. Do you think we need synchronization at all? I thought a bit about this. Usually PDE Build is invoked from the command line only for building. Usually, this is a single process with no registry updates through installing and removing bundles. It looks like we don't even need to support the dynamic registry.

What do you think? Should I use a synchronized HashMap? IMHO performance is not critical at this stage of PDE Build.

> FetchScriptGenerator:
> - updates the comment to talk in terms of factory and not builder

Done.

> Does CVS factory fails gracefully if given something bogus to parse (I haven't
> dug in the code)?

It's the same code that was used before in FetchScriptGenerator. See below.

> AntScript / ITask:
> The code still uses ITask to then transform it in a CharSequence?

Yes, but that's only internal code. I did this to avoid a rewrite of the CVS fetch code and to not make AntScript/ITask API.

> Maybe we should just make AntScript and ITask API, pass the script to the
> factory and tell people to use AntScript#print(ITask)

Do we really want to make this API? In this case we should make the whole package API. I think a lot people will love us because it's a great API to write build scripts. The package API is mature and proven to be stable and useful. I don't know your process in detail. Should I open a new bug report to let the PMC decide about this?

If yes I'm ready to contribute a patch for this and update this patch.

> FetchScriptGenerator as the diff was impossible because the methods have been
> sorted. In the next patch you provide make sure you don't sort the methods.

Fixed. I accidentally hit the sort action.
Comment 30 Gunnar Wagenknecht CLA 2006-02-06 02:23:03 EST
Created attachment 34179 [details]
34757_pluggable_fetch_script_builder.patch.txt

updated to HEAD and fixed JavaDoc
Comment 31 Pascal Rapicault CLA 2006-02-07 09:20:25 EST
The problem I see with making AntScript API is that it will limit our ability to change it (historically I've evolved the class doing wild renaming or method signature change), it does not contain all the ant tasks  (and will never) and finally for a given task it does not have all the parameters.
On the other side not making AntScript API is annoying as I don't find the manipulation of CharSequence to be very elegant.
Maybe should we:
- create a new API interface named IAntScript that has a printTask(ITask) method
- make AntScript implements this interface.

> I think a lot people will love us because it's a great API to write build scripts. 
  As mentionned earlier we are not complete and we can not really be as Ant is open-ended and evolve. Moreover I don't think there is that many people generating AntScripts, and would they be interested in requiring PDE Build (and all its prereqs?). I think a better owner for that might be Platform / Ant. I discussed it with the eclipse ant lead a year ago but we never went forward with it.

I'm fine with not tracking the extension registry while we are running. However it would be good to clean the cache at the end of the run of the fetchScriptGenerator and initialize on startup.
Comment 32 Andrew Niefer CLA 2006-02-07 15:24:58 EST
It might be usefull to give the FetchTaskFactory a place where it can write arbitrary content to the ant script.  In particular, to write a target that might be used by the fetch, retrieveFile & authentication tasks. 
   public CharSequence getCustomTargets();
FetchScriptGenerator would write this to the script before the generateEpilogue() call.

Also, the AntScript file is still sorted.
Comment 33 Gunnar Wagenknecht CLA 2006-02-08 03:01:32 EST
Created attachment 34327 [details]
34757_pluggable_fetch_script_builder.patch.txt

(In reply to comment #31)
> Maybe should we:
> - create a new API interface named IAntScript that has a printTask(ITask)
> method
> - make AntScript implements this interface.

Done. There is now an interface IAntScript with basic print methods. This interface is passed to an AntTask (former ITask interface). The AntTask uses the IAntScript for printing content to the Ant script.

I change the interface ITask to an abstract class AntTask. This allows us to introduce additional methods later while maintaining backwards compatibility.

IAntScript and AntTask are now API (updated MANIFEST.MF).

> I think a better owner for that might be Platform / Ant. I
> discussed it with the eclipse ant lead a year ago but we never went forward
> with it.

I agree. Ant tooling is the better owner. We might have a full AST one day that we can use for creating build files. :)

> I'm fine with not tracking the extension registry while we are running. However
> it would be good to clean the cache at the end of the run of the
> fetchScriptGenerator and initialize on startup.

Done. The registry is no longer tracked. I also added a call in FetchScriptGenerator #generate to close/clean up the factories registry.

(In reply to comment #32)
> It might be usefull to give the FetchTaskFactory a place where it can write
> arbitrary content to the ant script.  In particular, to write a target that
> might be used by the fetch, retrieveFile & authentication tasks. 
>    public CharSequence getCustomTargets();
> FetchScriptGenerator would write this to the script before the
> generateEpilogue() call.

Done. I also updated the JavaDoc in the methods of FetchTaskFactory to indicate wheter implementors are expected to create Ant targets themself or if it's prohibited.

> Also, the AntScript file is still sorted.

Ah, thanks, I always wondered why the patch was still that large. Fixed now.
 
@all
Sorry for any inconvenience while changing the API in this patch so often. If there are any adopters, please test this now. I feel pretty comfortable with the API right now. We use the integrated COPY fetcher in our ClearCase environment.
Comment 34 Gunnar Wagenknecht CLA 2006-02-10 00:34:47 EST
Moving to Pascal for review comments. :)
Comment 35 Gunnar Wagenknecht CLA 2006-02-10 09:43:19 EST
Today is the last day before the API freeze. Any chance that we can get this patch in?
Comment 36 Tom Roche CLA 2006-02-10 09:57:09 EST
Gunnar Wagenknecht  2006-02-10 09:43
> Today is the last day before the API freeze. Any chance that we can
> get this patch in?

PLEASE DO! even if it's not _absolutely_ perfect, suitable for
engraving on stone tablets for eternity ...
Comment 37 Pascal Rapicault CLA 2006-02-10 09:58:44 EST
Harrassing me by email or bug report does not help. Instead it allienates me.
Currently I'm working with Oleg on some other issues related to the registry that have a bigger impact since it is a much more visible API.

This bug will be fixed on time, I know my priorities.
Comment 38 Pascal Rapicault CLA 2006-02-13 15:18:35 EST
Thanks to Gunnar's help, this bug is now fixed. I just released the code in HEAD (it is also tagged as post_34757 and the code without the change is tagged before_34757).

The final version of the code is slightly different from the last patch to address some limitations and simplify / cleanup the APIs.
Any feedback on the new API is greatly appreciated.

I did not release the copy extension because I did not convert it to the new APIs. Gunnar, it would be great if you could update it so I can integrate it post M5?

Comment 39 Gunnar Wagenknecht CLA 2006-02-13 16:50:40 EST
(In reply to comment #38)
> Any feedback on the new API is greatly appreciated.

I like the API. I have two questions on the implementation. 

Some tasks moved from AntScript to CVSFetchTaskFactory and one was duplicated. I agree that it's much more cleaner to keep the CVS specific tasks out of AntScript. But isn't it easier to keep the printAvailable task in AntScript and simply cast do the internal AntScript? Or did you duplicate it to have a cleaner example code? I wonder how to handle this in the copy extension (duplicate or cast to AntScript).

The second question is related to the overriding of the fetch tag. The OVERRIDE_TAG is specified in lower case. But the comment in build.properties specifies it uppercase. Isn't java.util.Properties case sensitive? Another thing that should be document or changed is in FetchScriptGenerator#setFetchTagAsString. If the fetchTag is set to "SVN=trunk" it's interpreted as an overwrite for CVS (because entries.length == 1 evaluates to true). Thus, one has to specify at least two entries (eg. "SVN=trunk, CVS=HEAD")

> I did not release the copy extension because I did not convert it to the new
> APIs. Gunnar, it would be great if you could update it so I can integrate it
> post M5?

I converted it but will verify it tomorrow in our build before attaching it.
Comment 40 Pascal Rapicault CLA 2006-02-13 21:53:34 EST
In the antscript I removed the cvs tasks because they are only used by the CVS factory. As for the available task I copied it in order to have a clean example.
I think you should do the same in the copy task.

You are right about the value for the override. I tested it and then renamed :-). This has been fixed in HEAD.
Comment 41 Gunnar Wagenknecht CLA 2006-02-14 02:48:19 EST
Created attachment 34649 [details]
34757_copy_extension.patch.txt

Here is the copy extension adapted to the new API.
Comment 42 Gunnar Wagenknecht CLA 2006-02-14 02:49:20 EST
Created attachment 34650 [details]
34757_fetchTag_fix.patch.txt

This patch fixed an issue with fetchTag backwards compatibility.
Comment 43 Gunnar Wagenknecht CLA 2006-02-14 03:12:54 EST
Created attachment 34651 [details]
34757_copy_extension.patch.txt

Just a small change to beatify the generated fetch script. :)
Comment 44 Pascal Rapicault CLA 2006-02-14 15:11:44 EST
I don't think the copy factory should worry about checking if the various descriptor files are here since the copy task will only copy files if the source is newer than the destination. In the CVS case this check is only done because we don't do a checkout, but an export and we therefore don't have the cvs info to skip uncessary downloads.
If you remove the check of the copy factory, then I suggest that you remove FetchFromDisc target and directly inline the calls to the copy task.
This would have the added benefit of making the code more straightforward and also showing another example very different from the CVS factory.
Comment 45 Pascal Rapicault CLA 2006-02-14 15:13:26 EST
Thanks for the fetchTag patch and the catching other typos. They are already fixed in HEAD.
Comment 46 Gunnar Wagenknecht CLA 2006-02-15 01:52:40 EST
Created attachment 34743 [details]
34757_copy_extension.patch.txt

I agree. It's good to have a different example.
Comment 47 Pascal Rapicault CLA 2006-02-17 17:35:02 EST
I've just released the patch for the copy task in HEAD. It will be part of M6.
I don't think we should make it "API" for people using it in their map files as there are still some issues that are left unanswered (for example what is the "tag"). I have opened the bug #128487.
Comment 48 DJ Houghton CLA 2006-04-18 15:54:37 EDT
[contributed patch applied]