Author Topic: Post-compilation steps not getting saved  (Read 5809 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Post-compilation steps not getting saved
« on: June 10, 2005, 07:08:15 pm »
I already solved it for myself, just writing in case anyone else has the same problem:

Post compile steps are "broken" when there are pre-compile steps at the  same time. The reason is that the project saver and the project loader don't quite speak the same language, so the pre-compile steps get loaded while the post-compile steps don't.

This is what goes into the project file:
Code

<ExtraCommands>
    <Add before="this is done before compile"/>
</ExtraCommands>
<ExtraCommands>
    <Add after="this being done after"/>
</ExtraCommands>


and this is what the project loader expects:
Code

<ExtraCommands>
    <Add before="this is done before compile"/>
    <Add after="this being done after"/>
</ExtraCommands>


A functional workaround (if you are reluctant to rebuild c::b) is this:

Code

sed  -e 'N;s/\n//;N;s/\n//;s%</ExtraCommands>\s*<ExtraCommands>%%g'  project.cbp


Quite nasty, but put in a batch file, it is not that painful really, and it fixes things :)



The "guilty" function in projectloader.cpp (for those who *want* to recompile c::b) is ProjectLoader::DoExtraCommands.
Code

TiXmlElement* node = parentNode->FirstChildElement("ExtraCommands");
if (!node)
 return; // no options

TiXmlElement* child = node->FirstChildElement("Add");
while (child)
 {
 ...
 }

should be something like
Code

if( !(TiXmlElement* node = parentNode->FirstChildElement("ExtraCommands")) )
return;
do
 {
 TiXmlElement* child = node->FirstChildElement("Add");
 while (child)
  {
  ...
  }
 }while ( ( TiXmlElement* node = node->NextSiblingElement("ExtraCommands") ) )

One could argue, too, that the project is correctly read in, as several Adds inside one ExtraCommands seems more logical. In that case the save function would have to be changed.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Post-compilation steps not getting saved
« Reply #1 on: June 10, 2005, 09:58:53 pm »
Which C::B version are you referring to?

Yiannis.
Be patient!
This bug will be fixed soon...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Post-compilation steps not getting saved
« Reply #2 on: June 11, 2005, 06:45:56 pm »
1.0finalbeta build May 15 2005, 16:02:37
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Post-compilation steps not getting saved
« Reply #3 on: June 11, 2005, 10:29:24 pm »
Mind submitting a bug report about this? It will be forgotten if it is just left here...

Yiannis.
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Post-compilation steps not getting saved
« Reply #4 on: June 12, 2005, 12:26:33 am »
I submitted it. :)