Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Language settings Provider for compiler(gcc) built ins

Be aware that in UI there is a special configuration all pages are supposed to work with. After a user hits OK that configuration is "applied" to the project. If your page extends AbstractCPropertyTab you get that configuration using this->getResDesc().getConfiguration() call. You can modify that configuration and the changes will appear on other pages (when they use the same method, we may have one or two that do not comply). The changes to the configuration are saved to project description internally on pressing OK, you don't need to code that.

Andrew


On Wed, Apr 3, 2013 at 12:00 PM, Amol Deshpande <Amol.Deshpande@xxxxxxxxxxxxxxx> wrote:

Hi Andrew,

 

>>First you need to understand that language settings providers can be global (and so shared between many projects) or a configuration can keep its own copy of a provider.

I want to have each configuration its own copy of provider as compiler options can be set differently for each configuration and I want the provider to be updated based on configuration options.

 

>>You can instantiate a copy of a provider with LanguageSettingsManager.getExtensionProviderCopy(String id, boolean deep) method.

Using this and the code from LanguageSettingsPersistenceProjectTests.testProjectDescription_ReadWriteDescription() saves the provider command correctly. However I am still facing some issues - when user modifies the option in UI, user's option settings are not saved as we are saving the project description for provider changes.

 

I want to set the command based on option changes. I can do these code changes in value handler of that option based on which I want to customize the provider command. But since we have to save the project description, we cannot do it in value handler, otherwise we will not get the correct value of the option which is modified by the user. At what place in the code, should we add our code for customizing the provider command for option changes?

 

 

Regards,

Amol

 

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of scalpel4k


Sent: Wednesday, April 03, 2013 11:19 AM
To: cdt-dev@xxxxxxxxxxx
Subject: Re: [cdt-dev] Language settings Provider for compiler(gcc) built ins

 

Hi Andrew & ...,

 

I recently asked some question about versioned gcc, however, I had especially the language settings provider in mind. The problem I see is that there are currently too many places where one has to twiddle with the settings when not using the standard system compiler.

Things that I'm currently aware of are in particular:

- versioned gcc (where does $(COMMAND) come from?)

- and in the "-std=" parameter from the build settings.

These two obviously influence the outcome of the settings provider a lot. I think generally the $(COMMAND) variable should come from the build settings rather than using some (potentially unrelated) workspace default.

 

Is there some awareness of these issues? And are there plans to synchronize the settings "ambiguity"?

 

thx Michi


On Tuesday 02 Apr 2013 10:46:41 Andrew Gvozdev wrote:

Hi Amol,

First you need to understand that language settings providers can be global (and so shared between many projects) or a configuration can keep its own copy of a provider. Providers for built-in settings are normally global/shared by default. If you want  to change it depending on some option you want to assign a modified copy to your configuration. You can instantiate a copy of a provider with LanguageSettingsManager.getExtensionProviderCopy(String id, boolean deep) method.

Second, in your example you got a hold of a copy of project description and configurations. You can modify it but to take effect you need to save it with mngr.setProjectDescription(..).

 

You can take a look at test cases in org.eclipse.cdt.core.tests/org.eclipse.cdt.core.language.settings.providers. LanguageSettingsPersistenceProjectTests.testProjectDescription_ReadWriteDescription() can be instructive about how to manipulate configuration description.

 

Thanks,

Andrew

 

On Tue, Apr 2, 2013 at 2:41 AM, Amol Deshpande <Amol.Deshpande@xxxxxxxxxxxxxxx> wrote:

Hi,

Below is my query :

 

 

I want to modify the command for LanguageSettingsProvider for compiler (gcc) built in settings.

e.g. I want to modify the command specified in plugin.xml i.e.  gcc -E -P -v -dD ${INPUTS} to gcc -E -P -v -dD ${INPUTS} –option1 –option2 programmatically based on some options.

I tried using the following code, but its not updating the command in ‘Preprocessor Include Paths, Macros -> 'Providers' tab:

 

ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();

                                                            if (currentConfig.getOwner().getProject() != null){

                                                                      ICProjectDescription projectDescription =

                                                            mngr.getProjectDescription(currentConfig.getOwner().getProject(), true);

                                                                       

                                                                     List<ILanguageSettingsProvider> providers;

                                                                      ICConfigurationDescription cfgDescription =

                                                            projectDescription.getDefaultSettingConfiguration();

                                                                     if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {

                                                                         providers = new

                                                            ArrayList<ILanguageSettingsProvider>(((ILanguageSettingsProvidersKeeper)

                                                            cfgDescription).getLanguageSettingProviders());

                                                                         for (ILanguageSettingsProvider provider : providers) {

                                                                             if ((provider instanceof  AbstractBuiltinSpecsDetector)) {

                                                                                    String cmd = ((AbstractBuiltinSpecsDetector) provider).getCommand();

                                                                                    cmd = cmd + Constants.SPACE + option1

                                                                                    (( AbstractBuiltinSpecsDetector) provider).setCommand(cmd);

                                                                                                                       

Can anyone give me inputs regarding how to update the command programmatically?

 

 

Regards,

Amol Deshpande

P Please consider the environment before printing this e-mail

SSG| KPIT Cummins Infosystems Ltd.| Direct: +91 20 6652 2341| Board: +91 20 6652 5000 Amol.Deshpande @kpitcummins.com| www.kpitcummins.com

 

 


This message contains information that may be privileged or confidential and is the property of the KPIT Cummins Infosystems Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Cummins Infosystems Ltd. does not accept any liability for virus infected mails.
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

 

 


This message contains information that may be privileged or confidential and is the property of the KPIT Cummins Infosystems Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Cummins Infosystems Ltd. does not accept any liability for virus infected mails.

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top