Author Topic: post-build commands  (Read 12043 times)

Eric Burnett

  • Guest
post-build commands
« on: April 14, 2005, 06:48:21 am »
How would I go about using the post-build commands? I have tried for a while and can't get anything at all to happen. The closest I can figure is that the compiler-independant option, console shell, is not configurable, and is stuck using a linux file (xterm). Could this be what the problem is?

Specifically, in the post-build commands box, I have:
Code
start "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:"C:\Documents and Settings\Eric Burnett\Desktop\fractalBrowser" /notempfile
start "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"C:\Documents and Settings\Eric Burnett\Desktop\fractalBrowser" /notempfile


Ideally, I would have it commit my code to a repository on a successful build, but I am having trouble atm.

Thanks!

--Eric Burnett

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
post-build commands
« Reply #1 on: April 14, 2005, 10:55:11 am »
Quote
The closest I can figure is that the compiler-independant option, console shell, is not configurable, and is stuck using a linux file (xterm)

This is disabled because it only makes sense under linux. For windows the command shell is standard (cmd.exe or command.exe). In linux there are too many shells and terminals to choose from ;)

Note that the commands you can use must be existing executables. This means you can use cp.exe, but you can't use copy because copy is an internal shell command (search for copy.exe - you 'll find nil).
I 'm not sure, but I think start is also an internal command.
To overcome this limitation, you can enter your commands in a batch file and use this in the commands box.

Quote
Ideally, I would have it commit my code to a repository on a successful build, but I am having trouble atm.

Keep in mind that if this action asks you for a password, you will not see it because codeblocks doesn't run the commands in an interactive shell...
In this case, a solution would be (I haven't tried it!):
Suppose you have your commands in a batch file named commit_after_build.bat.
You would normally use as a post-build command in codeblocks: commit_after_build.bat
To run this in an interactive shell, use this: cmd /k commit_after_build.bat.
This will run your commands in an interactive shell ("dos" box) and keep it open until the commands finish executing.

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

Eric Burnett

  • Guest
post-build commands
« Reply #2 on: April 15, 2005, 01:45:48 am »
Ok, I see what I was doing wrong. But I still can't get it to do anything at all...when I type anything (including 'cmd /k commit_after_build.bat', which now refers to a batch file in the root directory of my project), nothing happens. And also, nothing is logged on any of the bottom tabs like I would have expected, which leads me to believe that this is actually disabled/broken at the time being. I would have expected 'cmd /k' to at least bring up a commnd prompt.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
post-build commands
« Reply #3 on: April 15, 2005, 09:17:54 am »
The post-build step is ran just after linking. If you 're trying it on an already linked project, the post-build step won't run...
To test it, delete the executable to force it to be re-linked.

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

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
post-build commands
« Reply #4 on: April 15, 2005, 12:34:12 pm »
I just noticed there is a bug with the pre-build and post-build commands, when using GNU "make" to build  :oops:
Either wait for next release (any day now), or use compiler in direct-mode...

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

Eric Burnett

  • Guest
post-build commands
« Reply #5 on: April 15, 2005, 04:28:05 pm »
Haha alright. I will wait until after that comes out before I try to fix this any more. For now I have setup two tools to do it instead, so its not critical.

Keep up the good work!

EricBurnett

  • Guest
post-build commands
« Reply #6 on: April 18, 2005, 08:01:06 am »
This has been puzzling me with its lack of...well...anything, so I thought I would take a look at how it works for myself. I grabbed and compiled a copy of Codeblocks from the cvs, then started digging into it. But I am stuck on one thing...DirectCommands::GetPreBuildCommands takes a ProjectBuildTarget as its parameter, then calls target->GetCommandsBeforeBuild() on it. But when looking at the definition of ProjectBuildTarget, I can't find the GetCommandsBeforeBuild() function definition, and I can't see where a child class is being constructed that defines it :oops:. Care to point me in the right direction?

Thanks.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
post-build commands
« Reply #7 on: April 18, 2005, 08:54:32 am »
Quote
Care to point me in the right direction?

Sure thing:
ProjectBuildTarget is-a CompileTargetBase (compiletargetbase.h) which is-a CompileOptionsBase (compileoptionsbase.h).

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

EricBurnett

  • Guest
post-build commands
« Reply #8 on: April 19, 2005, 07:46:59 am »
Thanks. For the moment I've been sidetracked into hunting bugs in the debugger, but when it is working to my satisfaction I will work on this again  8)