Author Topic: Pre-"workspace build" and post-"workspace build" scripts?  (Read 5699 times)

Offline filofel

  • Multiple posting newcomer
  • *
  • Posts: 11
Pre-"workspace build" and post-"workspace build" scripts?
« on: April 02, 2008, 02:47:46 pm »
Hi,

I use  a workspace as a way to group several related projects.
And so far, I didn't find  a foolproof way to create a pre-build and/or a post-build workspace script that would execute when I do a "workspace build" or "workspace rebuild".
I could of course attach a pre-build script to the project that I assume will occur first, and a post-build script to the project that I assume would occur last, but this is unsafe, as a later modification in the projects dependencies could end up silently altering the order of the builds.

Is there a trick that I'm missing, or does something like that belong to the "Features request" section?

TIA,

Phil
« Last Edit: April 02, 2008, 04:49:40 pm by filofel »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Pre-"workspace build" and post-"workspace build" scripts?
« Reply #1 on: April 03, 2008, 10:18:28 am »
I don't think there is a way, nor that there will be one any time soon, since workspaces are not more than a collection of projects in Code::Blocks. There is no concept for something like a pre-build script, or compile options in them, no dialog where one could enter such a thing. So, implementing any such thing wouldn't be trivial.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline filofel

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Pre-"workspace build" and post-"workspace build" scripts?
« Reply #2 on: April 03, 2008, 01:02:29 pm »
Thomas,

Bad news.
Workspaces are actually a little bit more than just "a collection of projects in Code::Blocks", since the build system offers to select "project dependencies" among the projects in a workspace, and apparently organizes the project builds inside the workspace in the right order: Having that, the execution position of the "pre-workspace-build" and "post-workspace-build" scripts become obvious.

The problem of workspace build (or compile) parameters is certainly more complex, but adding user-defined workspace-level variables could possibly provide an acceptable work around.

For any project that implies several distinct and/or intermediate targets, that could be really useful.


Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Pre-"workspace build" and post-"workspace build" scripts?
« Reply #3 on: April 03, 2008, 01:17:39 pm »
I'm not saying it isn't useful, it is very useful. But I don't think it will be trivial to implement.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Pre-"workspace build" and post-"workspace build" scripts?
« Reply #4 on: April 03, 2008, 09:29:10 pm »
Don't forget that you can control a whole build process from the command line. Thus if you need pre- post-build steps for a workspace, just write a script (batch) file with an automised build process. This can include any pre- or post-build steps for a workspace step you like. I for myself use this before building the C::B workspace. I do a source code sync before and file movement afterwards (if the build succeeded).
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 filofel

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Pre-"workspace build" and post-"workspace build" scripts?
« Reply #5 on: April 04, 2008, 11:00:27 am »
Thomas,
Then we agree on all counts. I'm very new to Code::Blocks, but I don't consider anything it does or could do to be trivial either! :)

MortenMacFly,
Good point, thank you.
I assume I could also create a phony project that would depend on all others as a post-build, and one that is a dependency of all others for a pre-build?
That would work automatically without getting out of C::B...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Pre-"workspace build" and post-"workspace build" scripts?
« Reply #6 on: April 04, 2008, 02:24:18 pm »
That would work automatically without getting out of C::B...
In fact, that's possible, too. Good point! :D
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