Author Topic: Order of build steps?!  (Read 5395 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Order of build steps?!
« on: July 13, 2006, 08:26:20 pm »
Now this seems strange:
I've setup a simple console project with a "Release" and "Debug" target. I've attached build scripts to the project and both targets (thus, 3 scripts) and batch files as pre- and post-build steps to the project and both targets (thus 6 batch files). All of them simply write to the BuildLog a message (e.g. "Project.Post.Batch" for the project's post batch file). Now look at the attached output what happens if I compile The target "All" -> which includes "Debug" and "Release":
Code
-------------- Build: Debug in MyCon ---------------
Project.Script.SetBuildOptions
Target.Script.Debug.SetBuildOptions
Target.Script.Debug.UnsetBuildOptions
Target.Script.Release.SetBuildOptions
Target.Script.Release.UnsetBuildOptions
Project.Script.UnsetBuildOptions
Project.Script.SetBuildOptions
Target.Script.Debug.SetBuildOptions
Target.Script.Debug.UnsetBuildOptions
Target.Script.Release.SetBuildOptions
Target.Script.Release.UnsetBuildOptions
Project.Script.UnsetBuildOptions
Running project pre-build steps
project_pre.bat
"Project.Pre.Batch"
Running target pre-build steps
target_debug_pre.bat
"Target.Debug.Pre.Batch"
mingw32-g++.exe -Wall -g  -ID:\Devel\GCC345\include  -c main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LD:\Devel\GCC345\lib  -o .\MyCon.exe obj\Debug\main.o   
Running target post-build steps
target_debug_post.bat
"Target.Debug.Post.Batch"

-------------- Build: Release in MyCon ---------------
Running target pre-build steps
target_release_pre.bat
"Target.Release.Pre.Batch"
mingw32-g++.exe -Wall -O2 -s  -ID:\Devel\GCC345\include  -c main.cpp -o obj\Release\main.o
mingw32-g++.exe -LD:\Devel\GCC345\lib  -o .\MyCond.exe obj\Release\main.o   
Running target post-build steps
target_release_post.bat
"Target.Release.Post.Batch"
Running project post-build steps
project_post.bat
"Project.Post.Batch"
Project.Script.SetBuildOptions
Target.Script.Debug.SetBuildOptions
Target.Script.Debug.UnsetBuildOptions
Target.Script.Release.SetBuildOptions
Target.Script.Release.UnsetBuildOptions
Project.Script.UnsetBuildOptions
Project.Script.SetBuildOptions
Target.Script.Debug.SetBuildOptions
Target.Script.Debug.UnsetBuildOptions
Target.Script.Release.SetBuildOptions
Target.Script.Release.UnsetBuildOptions
Project.Script.UnsetBuildOptions
Process terminated with status 0 (0 minutes, 4 seconds)
0 errors, 0 warnings
Does this order make any sense, or is the output to the log time-shifted for some reason?!

With regards, Morten.

Ps.: I've attached the project for your reference...

[attachment deleted by admin]
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 mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Order of build steps?!
« Reply #1 on: July 13, 2006, 09:01:56 pm »
I will look into this shortly :)
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Order of build steps?!
« Reply #2 on: July 13, 2006, 09:35:40 pm »
I see nothing wrong.
I also see why you 're confused :)

Let me explain the process:

Before the actual build process starts (i.e. the compiler/linker commands start executing), a preprocessing step runs which generates all needed command-lines. This step is necessary because it also caches much information making subsequent builds faster.
The build scripts run in this preprocessing step. And if you think about it, that's how it should be. Because build scripts alter project/target options which are then added to the command line (in this step).

So, you 're seeing your script log messages first because C::B runs the preprocessing step. When this is done, then it starts to actually execute build commands (including pre/post-build steps).

Does it make sense now, or did I confuse you even more? :P
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Order of build steps?!
« Reply #3 on: July 13, 2006, 10:29:07 pm »
Does it make sense now, or did I confuse you even more? :P
No, no, I've understood. Reading the log again with this knowledge makes perfect sense. Hey - why don't we call this "optimised build process using enhanced caching methods"... ;-)

I'm just kidding - I've read a "nice" presentation today from the marketing department that made an elephant out of a punkie... :lol:

(...of course this doesn't mean the build system is punkie - like...)

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