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

Bug 322458

Summary: Allow builder object to implement it's own invokeMake
Product: [Tools] CDT Reporter: Doug Schaefer <cdtdoug>
Component: cdt-buildAssignee: Doug Schaefer <cdtdoug>
Status: RESOLVED FIXED QA Contact: Andrew Gvozdev <angvoz.dev>
Severity: enhancement    
Priority: P3 CC: recoskie, yevshif
Version: 8.0   
Target Milestone: 8.0   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 321443    
Attachments:
Description Flags
Proposed patch cdtdoug: iplog-, cdtdoug: review+

Description Doug Schaefer CLA 2010-08-11 22:23:19 EDT
I am coming around to focus on the builder object as the extensibility mechanism to customize the build process.

Currently, the CommonBuilder has an invokeBuilder method which then calls either the internal builder or an invokeMake method.

I'd like to add a attribute on builder in the build definition to allow extenders to provide their own implementation of invokeMake. The main benefit is to allow us to dynamically change the command based on toolchain settings and the environment. And to potentially sequence commands, like calling out to CMake and then invoking make or nmake.

To make things simple, the existing invokeMake functionality would be made available to allow builders to invoke external commands as is done now.
Comment 1 Doug Schaefer CLA 2010-08-11 22:36:02 EDT
BTW, this is essentially taking things up a level in the stack from the existing command launcher. The command launcher is fine for simple changes, but I need access to the configuration data and need the ability to run multiple commands as mentioned.
Comment 2 Chris Recoskie CLA 2010-08-12 09:46:32 EDT
Seems like a good idea to me.  For RDT I had to create RemoteMakefileBuilder so that I could basically change what invokeMake() was doing.  If this capability had existed at the time, I might not have needed to do that.
Comment 3 Doug Schaefer CLA 2010-08-12 22:33:48 EDT
Created attachment 176517 [details]
Proposed patch

Here's the patch I'm currently working on. It introduces a IBuildRunner as an attribute if IBuilder. I also pulled out the invokeMake and invokeInternalBuilder to ExternalBuildRunner and InternalBuildRunner.

The theory is that vendors can extend ExternalBuildRunner to override or extend the implementation of the make builder. That'll be my next step and may drive some restructuring inside ExternalBuildRunner.

Feedback appreciated.
Comment 4 Doug Schaefer CLA 2010-08-15 16:58:50 EDT
Committing this now with a few minor alterations. I have an extension on the commercial side to exercise this for now. Will add an open one when I get around to doing CMake.

I reserve the right to make further API changes as we give the extension a workout. Expecially in the ExternalBuildRunner which will like need changes as we expand into external makefile gen tools like CMake (my commercial extension is pretty simple right now). So please let me know if you start using it so I can give you a heads up.
Comment 5 CDT Genie CLA 2010-08-15 17:23:03 EDT
*** cdt cvs genie on behalf of dschaefer ***
Bug 322458 - Implemented extension to allow the CommonBuilder.invokeBuilder method to be overriden.

[+] IBuildRunner.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuildRunner.java?root=Tools_Project&revision=1.1&view=markup
[*] IBuilder.java 1.19 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java?root=Tools_Project&r1=1.18&r2=1.19
[+] InternalBuildRunner.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/InternalBuildRunner.java?root=Tools_Project&revision=1.1&view=markup
[+] ExternalBuildRunner.java  http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ExternalBuildRunner.java?root=Tools_Project&revision=1.1&view=markup

[*] buildDefinitions.exsd 1.45 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd?root=Tools_Project&r1=1.44&r2=1.45

[*] CommonBuilder.java 1.49 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java?root=Tools_Project&r1=1.48&r2=1.49
[*] Builder.java 1.47 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java?root=Tools_Project&r1=1.46&r2=1.47