Quantcast

回复: Re: Programmatically adding additional include paths for indexer

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

回复: Re: Programmatically adding additional include paths for indexer

Mike
hi, Jantje
its good to hear you have a custom language settings provider options. i was tried to do the samething sometimes ago but failed by change the dest packages cus i was tried of changes options every time i build a new project.
would you please tell me how you did this.
regards mike.

send from my pad


2017-03-31 08:49 上午 <[hidden email]>写到:

I modify the language settings provider options (in my case arduino compiler settings but any standard CDT provided language provider will do) by adding a environment variable.

By setting the environment variable to what you want to add to the command (like -I[A path add to the indexer ] ) and triggering an invalidation of the language provider (don't recall how to do this but assign a console and you'll see wether it works) your include files will be found.

Wierdly enough when testing here this way the file is found when doing #include but the content of the include was not found by the indexer. But that may have been a glitch or something in the notepad created files.


Good luck

Jantje


Op 27/03/2017 om 20:40 schreef Memory, Richard:

Hi Jan,


That sounds promising ...


Can you kindly elaborate on how to accomplish that programmatically?


Did you use the code listed in this email thread? Is the "indexing command" issued in the context of that code?


Thanks,

Richard



From: [hidden email] [hidden email] on behalf of Jan Baeyens [hidden email]
Sent: Monday, March 27, 2017 12:37 PM
To: [hidden email]
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer
 

I have added the -I command to the indexing command and that works fine.


Op 27/03/2017 om 20:25 schreef Doug Schaefer:
I think the main issue is that there are a few places where these settings are set. And I’m not sure which one gets used where. Not only is there the Paths and Symbols as you  are using, there’s also the Preprocessor Include Paths, … entry. I’m not sure how they’re related if at all. You might need to debug down all the way to the scanner info provider. Yuck.

Doug.

From: <[hidden email]> on behalf of "Memory, Richard" <[hidden email]>
Reply-To: "CDT General developers list." <[hidden email]>
Date: Monday, March 27, 2017 at 1:37 PM
To: "CDT General developers list." <[hidden email]>
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer

Hi Doug,


The answer to both appears to be "no".


I probably should mention, that after running the code mentioned in my original email on this thread, despite it appearing to be successful, I don't see the added paths in the UI.


With that said, if i manually add them to the UI (which prompts me for a reindex), the "Unresolved inclusion" marker still shows up in the source file.


I should also note that I am adding the paths as absolute paths, even though in this case they point to directories that are in the workspace (to other projects). Possibly an interesting observation is when I add one of the paths, I am seeing a "warning" icon next to it. I don't see the same icon on the other path. I haven't yet determined what the warning is trying to tell me. Both paths exist.


Thanks,

Richard



From: [hidden email] <[hidden email]> on behalf of Doug Schaefer <[hidden email]>
Sent: Monday, March 27, 2017 10:08 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer
 
Hey Richard, does it work if you add the paths in the UI? Does a project Reindex help?

Doug.

From: <[hidden email]> on behalf of "Memory, Richard" <[hidden email]>
Reply-To: "CDT General developers list." <[hidden email]>
Date: Friday, March 24, 2017 at 8:00 PM
To: "[hidden email]" <[hidden email]>
Subject: [cdt-dev] Programmatically adding additional include paths for indexer

Hi All,


I am attempting to programmatically add additional header files paths to a project. Ideally I'd like the added paths to appear in the UI (i.e. properties->C/C++ General->Paths and Symbols->Includes), but even if not, at least I'd like to make the indexer happy. Without the additional paths, it currently shows the "Unresolved inclusion" marker. 


Here is the code I am using at the moment, which I found from a post a few years ago which seems to be happy, but so far the indexer is still showing the same marker.


IPath someHeaderFilePath = new Path("/some/absolute/path");
IPath someOtherHeaderFilePath = new Path("/some/other/workspaceRelative/path");

ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(getProject(), true);
ICConfigurationDescription configDecriptions[] = projectDescription.getConfigurations();
for (ICConfigurationDescription configDescription : configDecriptions) {
    ICFolderDescription projectRoot = configDescription.getRootFolderDescription();
    ICLanguageSetting[] settings = projectRoot.getLanguageSettings();
    for (ICLanguageSetting setting : settings) {
        List<ICLanguageSettingEntry> includes = new ArrayList<ICLanguageSettingEntry>();

        includes.addAll(setting.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
        includes.add(new CIncludePathEntry(someHeaderFilePath, ICSettingEntry.LOCAL));
        includes.add(new CIncludePathEntry(someOtherHeaderFilePath, ICSettingEntry.LOCAL));
        setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes);

        // Set information to project description
        ManagedBuildManager.saveBuildInfo(getProject(), true);
    }
}


Thanks,

Richard



_______________________________________________
cdt-dev mailing list
[hidden email]
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
[hidden email]
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
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 回复: Re: Programmatically adding additional include paths for indexer

Jan Baeyens

I can't r'ecall having had any particular problems.
Problems I had was missing plugins in my development environment.
I would suggest to start from the cdt development environment installed with oomph.


Op 31/03/2017 om 2:49 schreef zanget:
hi, Jantje
its good to hear you have a custom language settings provider options. i was tried to do the samething sometimes ago but failed by change the dest packages cus i was tried of changes options every time i build a new project.
would you please tell me how you did this.
regards mike.

send from my pad


2017-03-31 08:49 上午 [hidden email]写到:

I modify the language settings provider options (in my case arduino compiler settings but any standard CDT provided language provider will do) by adding a environment variable.

By setting the environment variable to what you want to add to the command (like -I[A path add to the indexer ] ) and triggering an invalidation of the language provider (don't recall how to do this but assign a console and you'll see wether it works) your include files will be found.

Wierdly enough when testing here this way the file is found when doing #include but the content of the include was not found by the indexer. But that may have been a glitch or something in the notepad created files.


Good luck

Jantje


Op 27/03/2017 om 20:40 schreef Memory, Richard:

Hi Jan,


That sounds promising ...


Can you kindly elaborate on how to accomplish that programmatically?


Did you use the code listed in this email thread? Is the "indexing command" issued in the context of that code?


Thanks,

Richard



From: [hidden email] [hidden email] on behalf of Jan Baeyens [hidden email]
Sent: Monday, March 27, 2017 12:37 PM
To: [hidden email]
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer
 

I have added the -I command to the indexing command and that works fine.


Op 27/03/2017 om 20:25 schreef Doug Schaefer:
I think the main issue is that there are a few places where these settings are set. And I’m not sure which one gets used where. Not only is there the Paths and Symbols as you  are using, there’s also the Preprocessor Include Paths, … entry. I’m not sure how they’re related if at all. You might need to debug down all the way to the scanner info provider. Yuck.

Doug.

From: <[hidden email]> on behalf of "Memory, Richard" <[hidden email]>
Reply-To: "CDT General developers list." <[hidden email]>
Date: Monday, March 27, 2017 at 1:37 PM
To: "CDT General developers list." <[hidden email]>
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer

Hi Doug,


The answer to both appears to be "no".


I probably should mention, that after running the code mentioned in my original email on this thread, despite it appearing to be successful, I don't see the added paths in the UI.


With that said, if i manually add them to the UI (which prompts me for a reindex), the "Unresolved inclusion" marker still shows up in the source file.


I should also note that I am adding the paths as absolute paths, even though in this case they point to directories that are in the workspace (to other projects). Possibly an interesting observation is when I add one of the paths, I am seeing a "warning" icon next to it. I don't see the same icon on the other path. I haven't yet determined what the warning is trying to tell me. Both paths exist.


Thanks,

Richard



From: [hidden email] <[hidden email]> on behalf of Doug Schaefer <[hidden email]>
Sent: Monday, March 27, 2017 10:08 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer
 
Hey Richard, does it work if you add the paths in the UI? Does a project Reindex help?

Doug.

From: <[hidden email]> on behalf of "Memory, Richard" <[hidden email]>
Reply-To: "CDT General developers list." <[hidden email]>
Date: Friday, March 24, 2017 at 8:00 PM
To: "[hidden email]" <[hidden email]>
Subject: [cdt-dev] Programmatically adding additional include paths for indexer

Hi All,


I am attempting to programmatically add additional header files paths to a project. Ideally I'd like the added paths to appear in the UI (i.e. properties->C/C++ General->Paths and Symbols->Includes), but even if not, at least I'd like to make the indexer happy. Without the additional paths, it currently shows the "Unresolved inclusion" marker. 


Here is the code I am using at the moment, which I found from a post a few years ago which seems to be happy, but so far the indexer is still showing the same marker.


IPath someHeaderFilePath = new Path("/some/absolute/path");
IPath someOtherHeaderFilePath = new Path("/some/other/workspaceRelative/path");

ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(getProject(), true);
ICConfigurationDescription configDecriptions[] = projectDescription.getConfigurations();
for (ICConfigurationDescription configDescription : configDecriptions) {
    ICFolderDescription projectRoot = configDescription.getRootFolderDescription();
    ICLanguageSetting[] settings = projectRoot.getLanguageSettings();
    for (ICLanguageSetting setting : settings) {
        List<ICLanguageSettingEntry> includes = new ArrayList<ICLanguageSettingEntry>();

        includes.addAll(setting.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
        includes.add(new CIncludePathEntry(someHeaderFilePath, ICSettingEntry.LOCAL));
        includes.add(new CIncludePathEntry(someOtherHeaderFilePath, ICSettingEntry.LOCAL));
        setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes);

        // Set information to project description
        ManagedBuildManager.saveBuildInfo(getProject(), true);
    }
}


Thanks,

Richard



_______________________________________________
cdt-dev mailing list
[hidden email]
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
[hidden email]
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
[hidden email]
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
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 回复: Re: Programmatically adding additional include paths for indexer

Mike
hi, Jantje.

the oomph is a eclipse installer, right ? 
how would it help me about different project sharing the same configuration or options?


At 2017-04-03 15:39:17, "Jan Baeyens" <[hidden email]> wrote:

I can't r'ecall having had any particular problems.
Problems I had was missing plugins in my development environment.
I would suggest to start from the cdt development environment installed with oomph.


Op 31/03/2017 om 2:49 schreef zanget:
hi, Jantje
its good to hear you have a custom language settings provider options. i was tried to do the samething sometimes ago but failed by change the dest packages cus i was tried of changes options every time i build a new project.
would you please tell me how you did this.
regards mike.

send from my pad


2017-03-31 08:49 上午 [hidden email]写到:

I modify the language settings provider options (in my case arduino compiler settings but any standard CDT provided language provider will do) by adding a environment variable.

By setting the environment variable to what you want to add to the command (like -I[A path add to the indexer ] ) and triggering an invalidation of the language provider (don't recall how to do this but assign a console and you'll see wether it works) your include files will be found.

Wierdly enough when testing here this way the file is found when doing #include but the content of the include was not found by the indexer. But that may have been a glitch or something in the notepad created files.


Good luck

Jantje


Op 27/03/2017 om 20:40 schreef Memory, Richard:

Hi Jan,


That sounds promising ...


Can you kindly elaborate on how to accomplish that programmatically?


Did you use the code listed in this email thread? Is the "indexing command" issued in the context of that code?


Thanks,

Richard



From: [hidden email] [hidden email] on behalf of Jan Baeyens [hidden email]
Sent: Monday, March 27, 2017 12:37 PM
To: [hidden email]
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer
 

I have added the -I command to the indexing command and that works fine.


Op 27/03/2017 om 20:25 schreef Doug Schaefer:
I think the main issue is that there are a few places where these settings are set. And I’m not sure which one gets used where. Not only is there the Paths and Symbols as you  are using, there’s also the Preprocessor Include Paths, … entry. I’m not sure how they’re related if at all. You might need to debug down all the way to the scanner info provider. Yuck.

Doug.

From: <[hidden email]> on behalf of "Memory, Richard" <[hidden email]>
Reply-To: "CDT General developers list." <[hidden email]>
Date: Monday, March 27, 2017 at 1:37 PM
To: "CDT General developers list." <[hidden email]>
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer

Hi Doug,


The answer to both appears to be "no".


I probably should mention, that after running the code mentioned in my original email on this thread, despite it appearing to be successful, I don't see the added paths in the UI.


With that said, if i manually add them to the UI (which prompts me for a reindex), the "Unresolved inclusion" marker still shows up in the source file.


I should also note that I am adding the paths as absolute paths, even though in this case they point to directories that are in the workspace (to other projects). Possibly an interesting observation is when I add one of the paths, I am seeing a "warning" icon next to it. I don't see the same icon on the other path. I haven't yet determined what the warning is trying to tell me. Both paths exist.


Thanks,

Richard



From: [hidden email] <[hidden email]> on behalf of Doug Schaefer <[hidden email]>
Sent: Monday, March 27, 2017 10:08 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Programmatically adding additional include paths for indexer
 
Hey Richard, does it work if you add the paths in the UI? Does a project Reindex help?

Doug.

From: <[hidden email]> on behalf of "Memory, Richard" <[hidden email]>
Reply-To: "CDT General developers list." <[hidden email]>
Date: Friday, March 24, 2017 at 8:00 PM
To: "[hidden email]" <[hidden email]>
Subject: [cdt-dev] Programmatically adding additional include paths for indexer

Hi All,


I am attempting to programmatically add additional header files paths to a project. Ideally I'd like the added paths to appear in the UI (i.e. properties->C/C++ General->Paths and Symbols->Includes), but even if not, at least I'd like to make the indexer happy. Without the additional paths, it currently shows the "Unresolved inclusion" marker. 


Here is the code I am using at the moment, which I found from a post a few years ago which seems to be happy, but so far the indexer is still showing the same marker.


IPath someHeaderFilePath = new Path("/some/absolute/path");
IPath someOtherHeaderFilePath = new Path("/some/other/workspaceRelative/path");

ICProjectDescription projectDescription = CoreModel.getDefault().getProjectDescription(getProject(), true);
ICConfigurationDescription configDecriptions[] = projectDescription.getConfigurations();
for (ICConfigurationDescription configDescription : configDecriptions) {
    ICFolderDescription projectRoot = configDescription.getRootFolderDescription();
    ICLanguageSetting[] settings = projectRoot.getLanguageSettings();
    for (ICLanguageSetting setting : settings) {
        List<ICLanguageSettingEntry> includes = new ArrayList<ICLanguageSettingEntry>();

        includes.addAll(setting.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
        includes.add(new CIncludePathEntry(someHeaderFilePath, ICSettingEntry.LOCAL));
        includes.add(new CIncludePathEntry(someOtherHeaderFilePath, ICSettingEntry.LOCAL));
        setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes);

        // Set information to project description
        ManagedBuildManager.saveBuildInfo(getProject(), true);
    }
}


Thanks,

Richard



_______________________________________________
cdt-dev mailing list
[hidden email]
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
[hidden email]
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
[hidden email]
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
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev
Loading...