Shibin Francis
Shibin Francis

Reputation: 542

How to extend existing cdt builder to make custom builder plugin?

I am trying to create a custom eclipse builder plugin to build a my customized C project. I want to run a list of python script before the build starts. I am able to run my python script using my custom builder, but I don't how to call an existing builder(such as cdt and jdt)from my plugin. i.e My builder must run the python script first, right after completing the the script execution it should start regular C build. I want these two should be in single builder plugin, not as two separate.

Any help would be appreciated.

Upvotes: 0

Views: 491

Answers (2)

Jonah Graham
Jonah Graham

Reputation: 7970

You can do this without writing any code if you want.

  1. Open project properties.
  2. Choose Builders and press New:

enter image description here

  1. Choose Program and press OK:

enter image description here

  1. Fill in everything to launch your Python:

enter image description here

  1. Make sure you "refresh" whatever you are generating:

enter image description here

  1. Press OK then move your new builder to the top, then Apply and Close:

enter image description here

  1. Build your project

You can add an additional builder in the same way to do the Clean by adding it to run during the "Clean" phase by editing settings in the Build Options:

enter image description here

In the Builders list this looks like:

enter image description here

Upvotes: 1

greg-449
greg-449

Reputation: 111142

You can use the IProject

public void build(int kind, String builderName, Map<String, String> args, IProgressMonitor monitor)

method to call a specific builder. args and monitor can be null.

kind is the build kind, something like IncrementalProjectBuilder.FULL_BUILD for a full build.

builderName is the id of the builder as defined in the >org.eclipse.core.resources.builders extension point.

Upvotes: 1

Related Questions