Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358605 - No environment variables imported to new cfg while importing configuration from another project in Manage Configurations dialog
Summary: No environment variables imported to new cfg while importing configuration fr...
Status: CLOSED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Andrew Gvozdev CLA
QA Contact: Andrew Gvozdev CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-22 11:15 EDT by Andrew Gvozdev CLA
Modified: 2012-02-23 11:33 EST (History)
2 users (show)

See Also:


Attachments
patch (2.45 KB, patch)
2011-09-22 15:06 EDT, Andrew Gvozdev CLA
angvoz.dev: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Gvozdev CLA 2011-09-22 11:15:55 EDT
1. Add some user environment variables in project A.
2. In context menu of project B select "Build Configurations"->Manage.
3. Use "New" and "Import from projects" the configuration of project A where environment variables were added. Save the new config.
4. Check the new configuration in properties. No user environment variables propagated from the source configuration.

The problem seems to be that the new configuration description is created in the way where no copying CConfigurationSpecSettings happens.
Comment 1 CDT Genie CLA 2011-09-22 14:23:02 EDT
*** cdt git genie on behalf of Andrew Gvozdev ***

    bug 358605: Cosmetics. Renamed some local variables, fixed warnings,
    changed wording in error message.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=6d6ddb397dd432871769786b3574d063fb5fe2cd
Comment 2 Andrew Gvozdev CLA 2011-09-22 15:06:43 EDT
Created attachment 203858 [details]
patch

James, it's a small patch but if you have time - I'd appreciate a quick look to check if it's the way to do it.
Comment 3 James Blackburn CLA 2011-09-22 15:19:13 EDT
Looks fine to me Andrew
Comment 4 Andrew Gvozdev CLA 2011-09-22 15:33:49 EDT
Thanks for the fast review, pushed to master.
Comment 5 CDT Genie CLA 2011-09-22 16:23:05 EDT
*** cdt git genie on behalf of Andrew Gvozdev ***

    bug 358605: No environment variables imported to new cfg while importing
    configuration from another project in Manage Configurations dialog

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=6a63d0325fc79e06d9ccc28658005758b344a492
Comment 6 James Blackburn CLA 2011-09-22 16:31:29 EDT
Don't have an eclipse in front of me, so just checking:
When you create a new configuration based on one in another project, do all the setting get copied over on creation? I.e. If the original source project goes away, does the copied configuration continue to work? 
That would be my only worry...
Comment 7 Andrew Gvozdev CLA 2011-09-22 17:12:43 EDT
(In reply to comment #6)
> Don't have an eclipse in front of me, so just checking:
> When you create a new configuration based on one in another project, do all the
> setting get copied over on creation? I.e. If the original source project goes
> away, does the copied configuration continue to work?
> That would be my only worry...
AFAICS they are. New configuration for the same project is created the same way:
			if (b_cloneFromProject.getSelection()) {
				ICConfigurationDescription base = ManagedBuildManager.getDescriptionForConfiguration(parentConfig);
				cfgDes = des.createConfiguration(id, newName, base);
				cfgDes.setDescription(newDescription);
			} else if (b_importFromOtherProject.getSelection()) {
The settings are supposed to be copied in this case, aren't they? My worry is if for some objects references are copied instead of cloning but that would be equally bad for copying a configuration in the same project, won't it?
Comment 8 James Blackburn CLA 2011-09-22 17:24:52 EDT
(In reply to comment #7)

If the base configuration is a built in configuration, or a configuration in the same project, that would be OK, as the base configurations are in the plugin.xml (which are always available), and configurations in the same project live in the same .cproject.

As I understood it, configurations inherit all their setting  by default from their parent/superclass.  Only settings which are explicitly changed are overwritten in the XML.  This means that if you don't change the optimisation level in your configuration, and the default changes, then the project gets the new default.

It's worth trying:
  - In Project A Debug config set Optimisation to -O2
  - Create a config in Project B copies ProjectA/Debug
  - Does Project B's configuration show -O2 (and is it in the project B's .cproject)?
  - Delete Project A, does Project B still work, can you open & close it without error?


The environment is somewhat different to the MBS settings, as it isn't inherited in this way, it's just copied out and saved in the EclipsePreferences.
Comment 9 Andrew Gvozdev CLA 2011-09-22 17:47:11 EDT
(In reply to comment #8)
> (In reply to comment #7)
> It's worth trying:
> - In Project A Debug config set Optimisation to -O2
> - Create a config in Project B copies ProjectA/Debug
> - Does Project B's configuration show -O2 (and is it in the project B's
> .cproject)?
> - Delete Project A, does Project B still work, can you open & close it without
> error?
Thanks for additional test cases, just tried that. Seems to be working as it should. No exceptions in the log either.