Integrating an eclipse/cdt-based build into continuous integration

eclipse, eclipse-cdt, jenkins

Solution

it looks like if I start eclipse from a cmd interactively,it forks, if started from a bat script, it doesn't. so putting the previous line in jenkins was enough to do the trick.

Notes:

- you need to add `-data` parameter to define location of your workbench (I clean build each time)

- as usual, blame windows and put quotes....

- `--launcher.suppressErrors` : in case something goes awoc, prevents eclipse from displaying a pop up (which is actually not displayed, thus blocks build)

Final (working !) command:

C:\prog\EclipseCdt\eclipse --launcher.suppressErrors -nosplash -data "%WORKSPACE%" -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import "%WORKSPACE%\project1" -import "%WORKSPACE%\project2" -import "%WORKSPACE%\project3" -build all 

EDIT

- added --launcher.suppressErrors

Problem

I have to reuse a major C++ project which is currently developed inside eclipse, using CDT, mingw and cdt managed build feature (no external makefiles or build environment). The project itself is composed of many sub-projects. I want to integrate that build into a continuous integration server (jenkins namely) and have thus to be able to automate the headless build. So far, I managed to checkout the project (easy from jenkins) and have it build in a headless mode using eclipse, using the following command: ``` C:\prog\EclipseCdt\eclipse -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import %WORKSPACE%\project1 -import %WORKSPACE%\project2 -import %WORKSPACE%\project3 -build all ``` It's however not enough: - build is asynchronous : previous command returns (it forks actually) while I expect it to hold context until I have a result (like it would with `make` on linux or `devenv` on windows) - I was unable to extract the build logs (ideally have them in a file) : to integrate within my continuous information, I need to be able to parse my build logs to display interesting information (think about broken files) - Ideally, I'd like to get from Eclipse a direct status (return code) which indicates pass or fail. Any idea how to have this behaviour ? Note that: - using alternate (external) build system is currently not an option (I must keep the cdt managed build, it has a lot of complex history) - I've already looked on stack overflow and google and did not manage to find a way to do it, despite the apparent simplicity of my need - I'm currently on windows 7 / mingw 4.5.2 / Eclipse IDE for C/C++ Developers Version: Indigo Release Build id: 20110615-0604 but I think question is x-platform

Original source