| 
| Can builder change delta? [message #335866] | Wed, 06 May 2009 18:08  |  | 
| Eclipse User  |  |  |  |  | My intention: 
 I'm planning to introduce an additional Builder in front of the normal
 build chain (CDT in our case, but that is not very relevant). This Builder
 needs to patch the source files, next the normal build chain should build
 as usual.
 
 My problems:
 * It doesn't feel 'right' to use a builder that takes a file, patches it
 and saves the same file. Typically you would expect a builder to take a
 source and generate a new artifact from it. Am I abusing the
 IncrementalProjectBuilder here? Should I handle the requirement of
 "in-place modification" in another way?
 
 * Moreover, my builder could need to go and change files that were not in
 the original delta. This means that Eclipse calls my builder with a
 certain delta, next my builder modifies some additional files.
 Unfortunately, the next builder seems to get the same delta as my own
 first builder. The delta is not adjusted "along the way". Is this normal?
 
 Thanks for your feedback,
 Johan
 |  |  |  | 
| 
| Re: Can builder change delta? [message #335895 is a reply to message #335866] | Fri, 08 May 2009 02:47   |  | 
| Eclipse User  |  |  |  |  | "Johan Van Noten" <johan@qootec.be> wrote in message news:7566a3ea46a0adc037386d5617ed6417$1@www.eclipse.org...
 > My intention:
 >
 > I'm planning to introduce an additional Builder in front of the normal
 > build chain (CDT in our case, but that is not very relevant). This Builder
 > needs to patch the source files, next the normal build chain should build
 > as usual.
 >
 > My problems:
 > * It doesn't feel 'right' to use a builder that takes a file, patches it
 > and saves the same file. Typically you would expect a builder to take a
 > source and generate a new artifact from it. Am I abusing the
 > IncrementalProjectBuilder here? Should I handle the requirement of
 > "in-place modification" in another way?
 >
 > * Moreover, my builder could need to go and change files that were not in
 > the original delta. This means that Eclipse calls my builder with a
 > certain delta, next my builder modifies some additional files.
 > Unfortunately, the next builder seems to get the same delta as my own
 > first builder. The delta is not adjusted "along the way". Is this normal?
 
 
 What will you do if the source files are read-only, as they might be in a
 "pessimistic" version control system such as Perforce?
 
 I don't think you can change resources during a build.  I think you may get
 a deadlock, as the builder has a lock on the workspace.  I'm not sure about
 that.  Regardless, I am pretty sure you won't be able to change deltas
 mid-build.
 
 Can you build your modified source files to an intermediate location,
 instead of trying to overwrite the existing ones?
 |  |  |  | 
|  | 
|  | 
|  | 
|  | 
| 
| Re: Can builder change delta? [message #335956 is a reply to message #335866] | Mon, 11 May 2009 10:54  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: eclipse-news.rizzoweb.com 
 Johan Van Noten wrote:
 > My intention:
 >
 > I'm planning to introduce an additional Builder in front of the normal
 > build chain (CDT in our case, but that is not very relevant). This
 > Builder needs to patch the source files, next the normal build chain
 > should build as usual.
 >
 > My problems:
 > * It doesn't feel 'right' to use a builder that takes a file, patches it
 > and saves the same file. Typically you would expect a builder to take a
 > source and generate a new artifact from it. Am I abusing the
 > IncrementalProjectBuilder here? Should I handle the requirement of
 > "in-place modification" in another way?
 
 The only other option I can think of would be to do the "patching"
 during save (as opposed to waiting until a build). If you have your own
 editor for thses files, that is pretty easy to do in its save method(s);
 if you're relying on a built-in editor it might not be so easy. I know
 the Java editor has the notion of "save actions" or "save participants"
 so perhaps that is a platform-general thing (as opposed to a
 JDT-specific thing) that you could investigate...
 
 
 >
 > * Moreover, my builder could need to go and change files that were not
 > in the original delta. This means that Eclipse calls my builder with a
 > certain delta, next my builder modifies some additional files.
 > Unfortunately, the next builder seems to get the same delta as my own
 > first builder. The delta is not adjusted "along the way". Is this normal?
 
 I don't know if altering the delta mid-stream would work or would be a
 good idea. But if you touch other resources, that should just generate
 another delta that will in turn trigger another build. You'd have to be
 careful to avoid infinite loops of builds continually modifying
 resources that trigger more builds.
 
 Hope this helps,
 Eric
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.04087 seconds