Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Storing language.settings.xml in a VCS(Each developer's environment calculates a different env-hash value, making storage in a VCS difficult)
icon5.gif  Storing language.settings.xml in a VCS [message #1303960] Sat, 19 April 2014 15:35 Go to next message
Steven Soloff is currently offline Steven SoloffFriend
Messages: 3
Registered: April 2014
Junior Member
(Kepler SR2)

Hi All,

My team recently needed to customize the CDT GCC Built-in Compiler Settings MinGW provider "Command to get compiler specs". In order for this command to be shared among all developers, we unchecked the "Use global provider shared between projects" option so that the relevant configuration will be stored in the .settings/language.settings.xml file, which we then committed to our VCS.

Unfortunately, the corresponding node in language.settings.xml where this information is stored also has an attribute named "env-hash". This value appears to be dependent on the details of the toolchain discovered by the CDT. Specifically, if the toolchain on one developer's machine is installed to a different location than the toolchain on another developer's machine (even if the toolchains are otherwise identical), env-hash is updated, and language.settings.xml appears to be in a modified state to the VCS client.

(If we check "Store entries in project settings folder (easing project migration)", we observe the discovered include paths to the toolchain location under the same node in language.settings.xml, thus suggesting that the toolchain location is indeed relevant to the calculation of env-hash. We also tried changing those paths to make use of environment variables that are common to every developer's setup [e.g. use "${MINGW_HOME}/include" instead of "C:/MinGW/include" as written by CDT]. While CDT seems to read that modified configuration and expand the environment variables correctly, it still writes back out the absolute paths, thus once again modifying the file.)

In general, is it acceptable for language.settings.xml to be stored in a VCS? If so, is there a way to prevent env-hash from being updated so that language.settings.xml doesn't appear to be modified in everyone's working copy (except for the last developer to commit it)? If not, is there an alternate mechanism for sharing language settings provider options among the team in a VCS?

Thanks,
Steve
Re: Storing language.settings.xml in a VCS [message #1322385 is a reply to message #1303960] Tue, 29 April 2014 20:51 Go to previous messageGo to next message
Andrew Gvozdev is currently offline Andrew GvozdevFriend
Messages: 257
Registered: July 2009
Senior Member
Built-in Compiler Settings provider is sensitive to environment changes. Changing environment variables in eclipse or a a new version of compiler will trigger rediscovery.
If you want to keep those settings unchanged under source control it is possible to create by hand another provider in language.settings.xml and put the entries under it. Make sure to use class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" and unique id and name.

Andrew
Re: Storing language.settings.xml in a VCS [message #1323730 is a reply to message #1322385] Wed, 30 April 2014 12:09 Go to previous messageGo to next message
Steven Soloff is currently offline Steven SoloffFriend
Messages: 3
Registered: April 2014
Junior Member
Thanks for the tip, Andrew. I didn't realize that alternate provider was available. I'll investigate and try to get it working in our project.
Re: Storing language.settings.xml in a VCS [message #1324020 is a reply to message #1323730] Wed, 30 April 2014 15:10 Go to previous messageGo to next message
Steven Soloff is currently offline Steven SoloffFriend
Messages: 3
Registered: April 2014
Junior Member
Works like a charm. Thanks, Andrew!

For anyone who comes across this thread later, the process we used follows:


  1. Use GCCBuiltinSpecsDetectorMinGW to discover and save the gcc and g++ language setting entries.
  2. Replace any machine-dependent information (e.g. include paths) with environment variables.
  3. Manually switch the provider to LanguageSettingsGenericProvider with the id/name requirements Andrew mentioned.
Re: Storing language.settings.xml in a VCS [message #1750620 is a reply to message #1324020] Fri, 23 December 2016 11:58 Go to previous messageGo to next message
Andres Llopis is currently offline Andres LlopisFriend
Messages: 2
Registered: December 2016
Junior Member
Hi there guys, I am trying to solve this issue as well and store the include settings in version control. I have managed to change the name of the provider as Andrew suggested and stored some values:


However, when other developer creates a project from that source, he cannot see NPKT provider, he just sees CDT provider, so he effectively doesnt get the settings.

How can this be done?

Regards!
Re: Storing language.settings.xml in a VCS [message #1750623 is a reply to message #1324020] Fri, 23 December 2016 12:18 Go to previous message
Andres Llopis is currently offline Andres LlopisFriend
Messages: 2
Registered: December 2016
Junior Member
Hello! I am trying to do this with a custom LanguageSettingsGenericProvider with an unique Id and name, but when other developer creates a project, it won't detect this new provider. How can it be solved?
Previous Topic:Duplicate project - rename again
Next Topic:Copy files from source to build directory as part of compilation.
Goto Forum:
  


Current Time: Fri Jan 28 08:42:02 GMT 2022

Powered by FUDForum. Page generated in 0.02079 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top