| Summary: | Setting environment variables using shell functions or scripts | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Roland Schulz <roland> |
| Component: | cdt-build-managed | Assignee: | Project Inbox <cdt-build-managed-inbox> |
| Status: | NEW --- | QA Contact: | Jonah Graham <jonah> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | ben, cdtdoug, com-eclipse-dot-org, jalameda, jdeblen1, lleeoo, petkovve, yevshif |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Roland Schulz
(In reply to comment #0) > We are happy to provide a patch which adds this functionality. But we would like > to first get input on how to improve the suggest new functionality (e.g. the UI > to add these commands). There is "Build Steps" tab on "Settings" page (for managed projects). I think this UI suits the idea with some adjustments like multiple commands. It is close to the idea. ( I never use managed project and thus didn't know that option). But it would have to be available also for non-managed projects. Thus I suggest: - Add support for several Pre and Post Commands - Add support for this feature for non-managed projects For non-managed projects it should use a shell to execute the list of commands (pre+make+post). I'm not sure how to do this best under Windows (in case this feature is supposed to be supported their to). This would require some rework compared to how things work now. Currently, the various commands that the build launches are individually launched in their own shell instances. In order to have the environment variables persist between the commands, you'd need to execute the commands in the same shell. (In reply to comment #3) > This would require some rework compared to how things work now. Currently, the > various commands that the build launches are individually launched in their own > shell instances. In order to have the environment variables persist between > the commands, you'd need to execute the commands in the same shell. Maybe it would be easier to import (/source) environment variables from a script. I imagine this could work the following way: - The user provides a script/command which sets the variables - CDT queries the remote environment (e.g. by running 'sh -c export') - CDT executes the script followed by re-querying the environment - CDT then compares the two environments and adds the added/modified variables to the list of environment variables. This would allow the user to easily import and the environment variables from the script into CDT and would have the same effect as running the script before every command. The only difference is when the script changes. If the variables are imported than any changes in the script has no effect on the variables in CDT. I think this has both advantages and disadvantages. It depends on what the user expects. If it is a system script he might always want to use the latest version or he might want to use the version originally imported. (In reply to comment #3) > Currently, the various commands that the build launches > are individually launched in their own shell instances. Hi Chris, what are "the various commands" exactly? Obviously make, but what else? Scanner discovery or something? I would suggest that this feature be independent of the build process. Maybe it even belongs in Eclipse, not CDT. The use case I currently can't address is to automate launching. I currently use make as the command to "Run" because I need some dynamic environment variables. While that works, it is not particularly intuitive. Roland's suggestion is a brilliant, simple, user-configurable way to greatly enhance Eclipse's functionality without adding another scripting layer. The user could use whatever shell they are most comfortable with to change the environment before any build or run. |