Author Topic: post build step : launch plugin  (Read 6412 times)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5300
post build step : launch plugin
« on: January 28, 2010, 08:24:38 pm »
Dear All,

What do you think about the following idea :

Quote
Would it be nice to be able to launch a plug-in as a post build step (or maybe pre build step) of a build of target/project.

A simple example. Suppose you want to have Cppcheck run on your project as a post build step.
Why : you want to ensure that stuff builds, and that CppCheck doesn't find any issues.

Another example :
When you have a unit test project, it might be very interesting to have it run at the end of it's build ($exe_output), but it might be evenly interesting to have it run by Valgrind.

How far away are we from achieving such behavior ?

Any further ideas ?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9616
Re: post build step : launch plugin
« Reply #1 on: January 29, 2010, 07:15:57 am »
Quote
Would it be nice to be able to launch a plug-in as a post build step (or maybe pre build step) of a build of target/project.
How far away are we from achieving such behavior ?
IMHO it's already (at least partially) possible and in fact I am doing this.

What's needed is a batch file (in my case) which you provide with the information required via macros.
This way you can run an external (stand-alone) application with all the information needed. this worked fine for me for things like documentation update (doxygen), reporting and logging.

For the plugins we probably would need to declare events like:
- build succeeded for target/project/workspace
- pre-pre-processor, post-pre-processor for targets
- pre-post-processor, post-post-processor for targets

I'm open for it if a plugin makes more sense because it needs to access a lot of information (e.g. from other targets, compiler options and so on...).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: post build step : launch plugin
« Reply #2 on: January 29, 2010, 03:53:09 pm »
Correct me if I 'm wrong, but isn't it already possible to run script commands in pre/post build steps?
AFAIR, scripting exposes ToolPlugins' "Execute()" function already.
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9616
Re: post build step : launch plugin
« Reply #3 on: January 29, 2010, 04:13:12 pm »
isn't it already possible to run script commands in pre/post build steps?
You tell - you did it. But yes: Scripting is surely possible. So that's another possibility. :-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5300
Re: post build step : launch plugin
« Reply #4 on: January 29, 2010, 07:02:05 pm »
Hey Yiannis, good you give an example ?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: post build step : launch plugin
« Reply #5 on: January 29, 2010, 11:26:34 pm »
Hey Yiannis, good you give an example ?

In rev.6118, two new script commands were added: ExecuteToolPlugin() and ConfigureToolPlugin().
You can now put something like this in your post-build steps:

Code
[[ ExecuteToolPlugin(_("CppCheck")) ]]

Enjoy :)
Be patient!
This bug will be fixed soon...

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5300
Re: post build step : launch plugin
« Reply #6 on: January 30, 2010, 12:18:25 am »
gonna try them out tomorrow.
Hehe nice to have the boss back  :P

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: post build step : launch plugin
« Reply #7 on: February 01, 2010, 10:15:35 am »
Another feature request for the "Post build step":

Is it possible to add option: "ReRun if Build/Post build failed last time"
This will be useful for unittest projects, where the resulting executable is run in the postbuild step.
At the moment I have to enable the option "Always run post build step", in order to get constant test failures

Example:
Code
0. Load the project
1. Edit code/tests
2. Hit compile
3. The tests are run and fail
4. Hit compile again (no changes to code),
  Expected behavior: tests are run again and fail.
  If the "Always run post build step" is not enabled the build succeeds, which is wrong.

The current solution works, but is not optimal for large projects (many projects in a workspace, with lots of test projects),
because every time the user hits "Compile" all the test projects will be run, which costs time :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]