Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] A Builder Proposition

 We are trying to solve a few requirements leaving the rest for another day.
 - Passing Info from the UI to the builder:
    * setting of arguments
    * setting of Environment
    * working directory where to execute the build process
 - Providing a way for other components to extract information
   from the builder(say: include paths, library paths, ..)
 - allowing different configurations(say: Build in debug mode, for a particular architecture...)

The flow: a plugin implementing the extension point and the interface ICBuilderCommand,
will register itself has a BuilderCommand to the CDT BuildModel for project xx.  It
can also register itsef as info provider by implementing ICBuilderInfo for project xx.
This is usually done via the wizards when creating a project or via property pages etc ..
When the user invokes Eclipse IncrementalBuilder, for project xx, it will call the CDT
builder which in turn will call the register ICBuilderCommand for project xx.

The idea is to have a builder for the C/C++ Projects on the eclipse side, this
builder will serve as a proxy and call the "real" Builder providing relevant
information like arguments(calling "make clean", in Directory project/src;

	 * CBuilder is the CDT generic Eclipse builder it serves
	 * as a proxy calling the real builder since the Eclipse builder
	 * does not pass enough information.
	public class CBuilder extends IncrementalProjectBuilder {

		IProject[] build(int kind, Map args, IProgressMonitor) {

			// Retrieve the BuildModel from the CDT CorePlugin
			BuildModel model = CCorePlugin.getBuildModel();

			// Get The buildCommand for this project.
			ICBuildCommand command = model.getBuilderCommand(getProject());

			// Set the information: arguments/CWD/Environment/ etc ..
			command.setArguments( args );  // they ask for the argument "install"
			command.setWorkindDirectory( cwd ); // in "project/src"
			command.setEnviron(props);  // setting "PREFIX=/tmp/installation"

			// Invoke the register builder

public interface ICBuilderCommand extends ICCommand {
	IProject[] build(IncrementatlProjectBuilder eclipseBuilder);

public interface ICBuilderInfo {
	IPath[] getIncludePaths();
	IPath[] getSystemIncludePaths();
	IPath[] getLibaryPaths();
	String[] getLibaries();
	void setBuilderConfiguration(ICBuilderConfiguration config);

public interfave ICBuilderConfiguration {
	String getName();

public interface ICCommand {
	String[] getArguments();
	void setArguments(String[] args);
	IPath getWorkingDirectory();
	void setWorkingDirectory();
	Properties getEnvironment();
	void setEnvironment(Properties env);

Lots of details are missing here: the way a plugin registers a Builder for a specific
project, the persistency, the extension points.

Back to the top