Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Adding new Make Targets programmatically

That's how it works for me:

       IMakeBuilderInfo makeBuilderInfo = MakeCorePlugin.createBuildInfo(
           project, builderID);

IMakeTargetManager targetManager = MakeCorePlugin.getDefault().getTargetManager();
       IMakeTarget target =
           targetManager.createTarget(project, "build", builderID  );
target.setBuildAttribute(IMakeTarget.BUILD_TARGET, makeBuilderInfo.getIncrementalBuildTarget());

       targetManager.addTarget(project, target);




Tomas wrote:

Hi

So what I have so far, after diving for several hours though the CDT source code is:

----------------------------------------------------------------------------------------

IMakeTargetManager fTargetManager;
fTargetManager = MakeCorePlugin.getDefault().getTargetManager();

String[] id = fTargetManager.getTargetBuilders(getNewProject());
if (id.length == 0) {
throw new CoreException(new Status(IStatus.ERROR, MakeUIPlugin.getUniqueIdentifier(), -1, MakeUIPlugin.getResourceString("MakeTargetDialog.exception.noTargetBuilderOnProject"), null)); //$NON-NLS-1$
}
String targetBuildID = id[0];
IMakeTarget target = fTargetManager.createTarget(getNewProject(), "configure", targetBuildID);
fTargetManager.addTarget(getNewProject().getParent(), target);

----------------------------------------------------------------------------------------

Executing that raises an error dialog with a line containing the IMakeTargetManager class path, which I guess it means there is something wrong with my use of that class.
And for the IMakeBuilderInfo I have:

----------------------------------------------------------------------------------------

IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(getNewProject(),
fTargetManager.getBuilderID(targetBuildID));
info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "make"); //$NON-NLS-1$ info.setBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, ""); //$NON-NLS-1$
info.setUseDefaultBuildCmd(true);
info.setStopOnError(true);
info.setIncrementalBuildEnable(true);
info.setBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, "all");

----------------------------------------------------------------------------------------

Which I don´t know how to use it together with IMakeTarget, and I don´t know if I even need it. PLEASE help me with this. Is really difficult to guess how it works without any help...

Thank you in advance
Tomas

Tomas wrote:


Hi

I'm extending CDT to create an IDE platform for embedded projects. I'm using standard Make projects, Eclipse 3.1.2 and CDT 3.0.2. I have made a new project wizard that creates certain files when the "Finish" button is pressed. Additionally I need to add a make target to the new project I'm creating (also when the Finish button is pressed, in order to make it automatically). This make target should appear in the "Make targets" view, inside the node of the new project that is being created. I read somewhere that I should use IMakeBuilderInfo and IMakeTarget, but I have unsuccessfully searched on how to specifically do that.

Any help would be really appreciated
Best regards

Tomas
_______________________________________________
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