[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Creating a new build configuration programmatically
|
On Mon, Feb 22, 2016 at 12:22 AM, Alena Laskavaia
<elaskavaia.cdt@xxxxxxxxx> wrote:
>> Configuration otherConfig = new Configuration(managedProject,
> newConfig, "OtherConfigID", true, false);
>
> What is the name of second configuration? Does it have same name as first?
Obviously, yes. I am sorry for my sloppiness. This code is actually
working. I only had to make sure that the names of the configurations
differed.
Thus making
8<=======================
....
Configuration newConfig = new Configuration(managedProject, null,
"MyConfigID", "MyConfigName");
Configuration otherConfig = new Configuration(managedProject,
newConfig, "OtherConfigID", true, false);
addConfiguration(originalProject, projectDescription, newConfig);
addConfiguration(originalProject, projectDescription, otherConfig);
...
8<=======================
into
8<=======================
...
Configuration newConfig = new Configuration(managedProject, null,
"MyConfigID", "MyConfigName");
Configuration otherConfig = new Configuration(managedProject, null,
"OtherConfigID", "OtherConfigName");
addConfiguration(originalProject, projectDescription, newConfig);
addConfiguration(originalProject, projectDescription, otherConfig);
...
8<=======================
saved my day. :-)
Thanks for your help! Regards,
Rainer
> On Sat, Feb 20, 2016 at 3:10 PM, Rainer Poisel <rainer.poisel@xxxxxxxxx>
> wrote:
>>
>> Hi,
>>
>> I am trying to add new build configurations after converting a "plain"
>> Eclipse project to a CDT project. This is the code I have so far:
>>
>> 8<================
>> @SuppressWarnings("restriction")
>> public void convertToCProject(final IProject originalProject)
>> throws CoreException
>> {
>> final IWorkspace workspace = ResourcesPlugin.getWorkspace();
>> final IWorkspaceRoot workspaceRoot = workspace.getRoot();
>> final IProject originalProjectHandle =
>> workspaceRoot.getProject(originalProject.getName());
>> final IProjectDescription newProjectDescription =
>> workspace.newProjectDescription(originalProjectHandle.getName());
>> CCorePlugin.getDefault().createCDTProject(newProjectDescription,
>> originalProjectHandle, new NullProgressMonitor());
>>
>> final ICProjectDescriptionManager descriptionManager =
>> CoreModel.getDefault().getProjectDescriptionManager();
>> final ICProjectDescription projectDescription =
>> descriptionManager.createProjectDescription(originalProject, false);
>> final ManagedProject managedProject = new
>> ManagedProject(projectDescription);
>>
>> Configuration newConfig = new Configuration(managedProject, null,
>> "MyConfigID", "MyConfigName");
>> Configuration otherConfig = new Configuration(managedProject,
>> newConfig, "OtherConfigID", true, false);
>>
>> addConfiguration(originalProject, projectDescription, newConfig);
>> addConfiguration(originalProject, projectDescription, otherConfig);
>>
>> CoreModel.getDefault().setProjectDescription(originalProject,
>> projectDescription);
>> }
>>
>> @SuppressWarnings("restriction")
>> private void addConfiguration(final IProject originalProject,
>> final ICProjectDescription projectDescription,
>> final Configuration managedProjectConfiguration)
>> throws CoreException
>> {
>> final IBuilder managedProjectBuilder =
>> managedProjectConfiguration.getEditableBuilder();
>> managedProjectBuilder.setManagedBuildOn(false);
>> managedProjectBuilder.setAutoBuildEnable(false);
>> managedProjectBuilder.setIncrementalBuildEnable(false);
>> managedProjectBuilder.setCleanBuildEnable(false);
>> final CConfigurationData managedProjectConfigData =
>> managedProjectConfiguration.getConfigurationData();
>>
>> projectDescription.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID,
>> managedProjectConfigData);
>> }
>> 8<================
>>
>> However, the only Build Configuration I am seeing after the conversion
>> (convertToCProject() method) is the "MyConfigName" configuration.
>>
>> Could someone please give me a hint what I am doing wrong here? As I
>> get some warnings regarding discouraged access to internal methods
>> (@SuppressWarnings("restriction")) I am feeling quite uncomfortable
>> with this code as well. Shall I use the CDT extension points
>>
>> (http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.isv%2Freference%2Fextension-points%2Findex.html)
>> to achieve my goal? If so, which one?
>>
>> Thanks for your help,
>> Rainer
>> _______________________________________________
>> cdt-dev mailing list
>> cdt-dev@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/cdt-dev