Author Topic: [UPDATED] EnvVars plugin  (Read 10654 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
[UPDATED] EnvVars plugin
« on: May 29, 2007, 11:07:11 pm »
Dear community,
I've taken some time to implement the most requested feature for the EnvVars plugin: EnvVar sets and their applicability to projects. Thus the result is an updated EnvVar plugin accordingly. I would like to start something like a "BETA" testing for people that like to play around with the new features. Most important (as I can't do it myself) is the following:
- compatibility / issues with wxWidgets 2.8.x
- compatibility / issues with *nix/MAC
- issues with build system (a.k.a. autobuild...)
Any reports are welcome...
With regards, Morten.
Ps.: Best to be placed within the "old" envvar plugin folder under contrib plugins which should be cleared before...

Edit: Removed attachment. Latest revision is merged into SVN trunk.
« Last Edit: June 06, 2007, 10:37:42 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: [UPDATED] EnvVars plugin
« Reply #1 on: May 30, 2007, 03:00:24 am »
Hi Morten: you are off to a great start.
I managed to get the code to compile on Ubuntu Linux. (The only thing I need to change was the paths in the build options - i changed ../../../devel to $(#cb)/devel etc)

a few things i noticed
1. the list control in the project properties is huge (expands to the whole height of the panel) (but also see 4)
2. it would be clearer if the custom sets list control appeared above instead of below the list of environment variables in environment settings (but also see 4)
3. the environment variables show up in the child processes as they are supposed to. are they also subsituted in any of the build options?
4. it seems that the environment sets are kept in the program settings. would the projects be more portable if kept in the project settings?



Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: [UPDATED] EnvVars plugin
« Reply #2 on: May 30, 2007, 04:00:42 am »
attached my version of the linux project file

[attachment deleted by admin]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: [UPDATED] EnvVars plugin
« Reply #3 on: May 30, 2007, 08:01:48 am »
Thanks for the report! :-)

1. the list control in the project properties is huge (expands to the whole height of the panel) (but also see 4)
Mmmh... not for me. Mind sending me a screenshot? It is setup to be as width as the propeties dialog... but you really mean the height?!

2. it would be clearer if the custom sets list control appeared above instead of below the list of environment variables in environment settings (but also see 4)
Ok - can do that (had in mind to move the label, too...).

3. the environment variables show up in the child processes as they are supposed to. are they also subsituted in any of the build options?
Yes, they are. The project specific envvars are applied as soon as the project jets activated (consult the C::B debug console to see what exactly is going on - there is currently a lot of debug messages.). By using default user variable expansion, e.g. $(MY_VAR) you can access the envvars during build.

4. it seems that the environment sets are kept in the program settings. would the projects be more portable if kept in the project settings?
Yes and no. I decided to do it like that for several reasons:
1.) You will need C::B anyway for this feature to work so it's easier to keep the sets in one place.
2.) You can easily share envvar sets between C::B users using the cb_share_config tool.
3.) I wanted to be compatible to the GCV's as they are working the same way (e.g. #(My_VAR)).
In the end I believe maintaining them at one place is easier. Imagine you have an envvar set for a specific platform. If you have 10 projects you would have to maintain all 10 projects if *one* envvar changes. This seems not convenient to me. But I'm open for discussion...

With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: [UPDATED] EnvVars plugin
« Reply #4 on: May 30, 2007, 03:22:20 pm »
EDIT: Ignore below, I am an idiot and should definitly be more grateful when I feature I asked for gets implemented.

It should obviously be per project, per target and global, just like the current compiler settings.  I have several difference projects on my computer that all need custom LD_LIBRARY_PATH's, and random environment variables.  I don't want to have to be constantly edit on LD_LIBRARY_PATH every time I change projects. 

Really this is a flaw/missing feature in CB almost all other IDE's I have used let you set these on a per executable basis.  These being Eclipse, XCode and VS.
« Last Edit: May 30, 2007, 05:25:44 pm by Game_Ender »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: [UPDATED] EnvVars plugin
« Reply #5 on: May 30, 2007, 03:43:15 pm »
Really this is a flaw/missing feature in CB almost all other IDE's I have used let you set these on a per executable basis.  These being Eclipse, XCode and VS.
What are you talking about? This is what I have implemented and what I want to be tested - did you try before you speech?! :?
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: [UPDATED] EnvVars plugin
« Reply #6 on: May 30, 2007, 05:28:04 pm »
:oops: Sorry about that, should of  payed closer attention.  Building and beta testing as we speak.

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: [UPDATED] EnvVars plugin
« Reply #7 on: May 30, 2007, 06:43:33 pm »
I have more debugging I can do but right now it looks like you don't unset all the variables when you change what set your project is using.  Also I can't seem to set LD_LIBRARY_PATH, it might be because my run shows something like "LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH" and that might be over riding the variable.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: [UPDATED] EnvVars plugin
« Reply #8 on: August 05, 2007, 07:01:38 am »
I'm having the same troubles with LD_LIBRARY_PATH (trying to set it to /usr/local/lib so I can run a GSL app from within CB). anyone have a solution for this?

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: [UPDATED] EnvVars plugin
« Reply #9 on: August 05, 2007, 10:25:06 am »
Oh, and another one that I came across and didn't pay much attention to (sorry  :oops:). In the .cbp  file the envars plugin writes multiple entries (one after each save after the "project has changed" prompt). This is the Extensions part of my project that I can see this behavior (I had to save it a few times testing a QtWorkbench feature).
Code
		<Extensions>
<envvars />
<code_completion>
<search_path add="$(#qt.include)" />
<search_path add="$(#qt.include)/QtCore" />
<search_path add="$(qt.include)/QtGui" />
</code_completion>
<debugger />
<envvars />
<qtworkbench>
<enabled value="true" />
</qtworkbench>
<envvars />
<envvars />
<envvars />
<envvars />
</Extensions>
Life would be so much easier if we could just look at the source code.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: [UPDATED] EnvVars plugin
« Reply #10 on: August 06, 2007, 04:18:37 pm »
I'm having the same troubles with LD_LIBRARY_PATH (trying to set it to /usr/local/lib so I can run a GSL app from within CB). anyone have a solution for this?
Under Windows this works nicely - started a project, setup the envvar, modified it and printed out the envvar during compilation.

Hence under Linux I'd say the compiler plugin may overwrite this envvar *before* compilation which is *after* the envvars plugin did it's "stuff". So if this is the case there is currently no way using the plugin.
But: Nowadays (as Yiannis made some nice changes) I'd say it would be possible using the new compiler started event. I have to modify the envvars plugin slightly and do some testing... stay tuned...
With regards, Morten.
« Last Edit: August 06, 2007, 04:20:20 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: [UPDATED] EnvVars plugin
« Reply #11 on: August 06, 2007, 04:19:51 pm »
Code
		<Extensions>
<envvars />
<envvars />
<envvars />
<envvars />
<envvars />
<envvars />
</Extensions>
Uh! How ugly. Unfortunately I cannot reproduce. In addtion I checked alll my project files theay all have a single entry. Can you tell me a step-by-step instrcution how to "achieve" this?!
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ