Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Modifying the build command in CDT

> The build command being used depends on the tool-chain being used.
> So you would need to change the extension builder information for the
> required tool-chains to make it workspace-wide.
>
> To implement that you could e.g. specify a buildDefinitionStartup
> element via the org.eclipse.cdt.managedbuilder.core.buildDefinitions
> extension point.

Thanks for the solution. I tried it out and it mostly works, but the
new build command I inserted does not show up in the C/C++ Build
properties page under Build Command. Here is a snippet of code from my
implementation of IManagedBuildDefinitionsStartup:

	public void buildDefsResolved() {
		Map builders = ManagedBuildManager.getExtensionBuilderMap();
		
		for (Iterator i = builders.entrySet().iterator(); i.hasNext(); ) {
			((IBuilder)i.next()).setCommand("oge");
		}
	}

I am basically trying to change the build command of the GNU Make
builder to a string "oge" (but in the snippet, I'm changing the
commands of all the builders). I thought of calling
ManagedBuildManager.saveBuildInfo(project, info) afterwards but that
takes an IProject as a parameter and my changes are not project
specific.

Anyone know why my changes are not showing up in the preferences page?

Thanks,

Oge.

On 8/10/07, Sennikovsky, Mikhail <mikhail.sennikovsky@xxxxxxxxx> wrote:
> The build command being used depends on the tool-chain being used.
> So you would need to change the extension builder information for the
> required tool-chains to make it workspace-wide.
>
> To implement that you could e.g. specify a buildDefinitionStartup
> element via the org.eclipse.cdt.managedbuilder.core.buildDefinitions
> extension point.
> You would need to provide an implementation of the
> org.eclipse.cdt.managedbuilder.core.ImanagedBuildDefinitionsStartup
> interface and in its buildDefsResolved() method perform necessary
> extension builder modifications, e.g.
>
> IBuilder builder = obtain the builder that requires changing e.g. via
> ManagedBuildManager.getExtensionBuilder(String id) or searching the
> builder map retirned by ManagedBuildManager.getExtensionBuilderMap(),
> etc.
>
> Use the builder.get/setCommand() and builder.get/setArguments() for
> assessing/changing the build command and build arguments respectively.
>
> Mikhail
>
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Ogechi Nnadi
> Sent: Tuesday, August 07, 2007 8:25 PM
> To: CDT General developers list.
> Subject: Re: [cdt-dev] Modifying the build command in CDT
>
> > Here is an example of how the build command could be accessed/changed
> > given a specified project:
> >
>
> Thanks, Mikhail.
>
> However, is it possible to change the global build command or is it
> only changeable on a per-project basis?
>
> Oge.
>
> On 8/3/07, Sennikovsky, Mikhail <mikhail.sennikovsky@xxxxxxxxx> wrote:
> > Hi Oge,
> >
> > Here is an example of how the build command could be accessed/changed
> > given a specified project:
> >
> > IProject project = ... the project you need
> >
> > ImanagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
> > IManagedProject mProj = info.getManagedProject();
> >
> > IConfiguration cfg = ..obtain the configuration using one of the
> > mProj.getConfiguration*() methods;
> >
> > Ibuilder builder = cfg.getEditableBuilder();
> > //Use the builder.get/setCommand() and builder.get/setArguments() for
> > assessing/changing the build command and build arguments respectively.
> >
> > In case the builder settings are modified you need to apply them using
> > the
> > ManagedBuildManager.saveBuildInfo(project, info);
> >
> > Regards,
> > Mikhail
> >
> > -----Original Message-----
> > From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> > On Behalf Of Ogechi Nnadi
> > Sent: Thursday, August 02, 2007 8:53 PM
> > To: CDT General developers list.
> > Subject: Re: [cdt-dev] Modifying the build command in CDT
> >
> > > What CDT version are you using?
> >
> > I'm using, and developing for, CDT v. 4.0.0.200706261300.
> >
> > Oge.
> >
> > On 8/2/07, Sennikovsky, Mikhail <mikhail.sennikovsky@xxxxxxxxx> wrote:
> > > Hi Oge,
> > >
> > > What CDT version are you using?
> > >
> > > Mikhail
> > >
> > > -----Original Message-----
> > > From: cdt-dev-bounces@xxxxxxxxxxx
> [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> > > On Behalf Of Ogechi Nnadi
> > > Sent: Thursday, August 02, 2007 8:10 PM
> > > To: cdt-dev@xxxxxxxxxxx
> > > Subject: [cdt-dev] Modifying the build command in CDT
> > >
> > > Hi,
> > >
> > > I am working on an Eclipse plug-in that heuristically finds all
> > > installations of Make on  a system and adds them to the CDT's
> > > preferences, perhaps to the "Build Command" textbox in  the "C/C++
> > > Build" preference page. What class contains the contents of the
> "Build
> > > Command" textbox? Is there an API for modifying that value?
> > >
> > > Thanks,
> > >
> > > Oge.
> > > _______________________________________________
> > > cdt-dev mailing list
> > > cdt-dev@xxxxxxxxxxx
> > > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> > > _______________________________________________
> > > cdt-dev mailing list
> > > cdt-dev@xxxxxxxxxxx
> > > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> > >
> > _______________________________________________
> > cdt-dev mailing list
> > cdt-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> > _______________________________________________
> > cdt-dev mailing list
> > cdt-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> >
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>


Back to the top