Defining a Tool-chain for MBS
You provide a tool-chain definition by plugging into the MBS tool definition extension point, org.eclipse.cdt.managedbuilder.core.buildDefinitions. The extension point defines an XML schema that lets you describe the tools in your tool-chain. See Figure 1 for the object model used by the schema. If you have access to the CDT source code, see org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd.
The schema is used both by the MBS extension point and by the MBS-specific project file that stores the user's modifications to a project's properties. If you have an MBS project, examine the .CDtbuild file (see Listing Two for an example). MBS provides reference tool-chain definitions for GNU C/C++ on many different development platforms. If you have access to the CDT source code, see org.eclipse.cdt.managedbuilder.gnu.ui/plugin.xml.
<?xml version="1.0" encoding="UTF-8" ?>
<?fileVersion 3.0.0?>
<ManagedProjectBuildInfo>
<project
id="HelloWorld.cdt.managedbuild.target.gnu.cygwin.exe.554942561"
name="Executable (Gnu on Windows)"
projectType="cdt.managedbuild.target.gnu.cygwin.exe">
<configuration
id="cdt.managedbuild.config.gnu.cygwin.exe.debug.2090460160"
name="Debug"
parent="cdt.managedbuild.config.gnu.cygwin.exe.debug"
artifactName="HelloWorld"
errorParsers= "org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParse r;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParse r"
artifactExtension="exe"
cleanCommand="rm -rf">
<toolChain
superClass="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug"
id="cdt.managedbuild.toolchain.gnu.cygwin.exe.debug.273781351"
name="GCC Tool Chain">
<tool
superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug"
id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.exe.debug. 1350170342"
name="GCC C Compiler">
<option
superClass="gnu.c.compiler.option.preprocessor.def.symbols"
id="gnu.c.compiler.option.preprocessor.def.symbols. 228974839"
valueType="definedSymbols">
<listOptionValue
value="DEBUG"
builtIn="false" />
</option>
</tool>
<tool
superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug"
id="cdt.managedbuild.tool.gnu.c.linker.cygwin.exe.debug. 686918536"
name="GCC C Linker" />
<tool
superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug"
id="cdt.managedbuild.tool.gnu.assembler.cygwin.exe.debug. 416825853"
name="GCC Assembler" />
</toolChain>
</configuration>
</project>
</ManagedProjectBuildInfo>
You define the majority of your tool-chain integration statically in your XML implementation of the schema. MBS defines a number of attributes in the schema where you can specify a Java class that provides dynamic behavior for your tool-chain. You don't have to implement any of the dynamic behavior, but some may be desirable to your users. For instance, you could implement a Java class that defines the environment variables that must be set up in order to run the tools in your tool-chain. This relieves users from having to set up your tool environment before invoking Eclipse.


