Eclipse + CDT: How to batch build several build configurations - eclipse

I have an eclipse CDT project that builds static and shared libraries. I have created several build configurations for them.
I want to know if there is any way to do a batch build i.e. build all configurations at once with single operation. I tried "Build All" (ctrl+B) but it seems to be building only the current configuration (just that it applies "all" as the target for the current configuration).
One of the earlier posts suggest making use of CMake(http://stackoverflow.com/questions/5204180/how-to-build-several-configurations-at-once-with-cmake) .
Is this the way, or is there any other alternative without getting into CMake.
regards,
Ravi

If you have CDT installed, then there is also a launch configuration type called Launch group. You can create one of that to list all your other already configured launch configurations and to execute one after the other. Make sure to set the post build action in the list dialog to "wait until terminate".

put all your projects into a tree (symlinks), e.g. my/Projects and run a headless build (ref http://gnuarmeclipse.livius.net/blog/headless-builds/)
eclipse -application org.eclipse.cdt.managedbuilder.core.headlessbuild -importAll my/Projects -cleanBuild all -nosplash -data ./eclipse_ws_dir --launcher.suppressErrors -vmargs -Xmx7g

Related

Eclipse RCP: How to set launch parameters?

You need to set the path to the directory "splash_v1" in plugin "com.project.console". Example without directory "splash_v1":
osgi.splashPath=platform:/base/plugins/com.project.console
If you are asking how to define launch parameters when starting up your RCP application you have two options.
Define them in the Run Configuration (configurable via Project > Run Configurations)
Define them at startup by passing them in with the executable from the console (e.g., ./myrcp -application myrcp).
For an overview of runtime options, cf. The Eclipse runtime options.

STS (Spring Tools Suite) writes STS.ini any time I get updated, merging with my own configuration

To improve my STS performance I've added some parameters to STS.ini. But every time I update the tool, it puts its own configuration at the beginning of STS.ini file, relegating my configuration to the end, sometimes duplicating several parameters.
Is there another way to avoid this?
Now, everytime I update the tool I need to backup the file and check the parameters...
I tend to launch Eclipse and STS from the command line. I create a bunch of shell scripts, one for each variant of Eclipse/STS that I run. This ensures that every launch has precisely the arguments that I need.
For example, I have a bunch of scripts like this:
[21:09] ~/Eclipse
$ more eclipse_42.sh
Installations/Eclipse4.2.M6/Eclipse -data \
"/users/Andrew/Eclipse/Workspaces/workspace_42" \
-vmargs -Xmx1024M -XX:PermSize=64M -XX:MaxPermSize=256M
I like running from a terminal so that you can see what gets sent to sysout. And this could also be launched from a Finder window.
I run on Mac, but you could do something similar on Linux or Windows.
Just thought of another possible answer. I haven't tried this, but it could work.
Instead of doing "Check for updates", go to the install manager Help -> Install new software...
With the STS update site, select all the components that you want updated (except SpringSource Tool suite (required) and SpringSource Tool Suite Package (if you see it)).
I think it is these two components that alter the STS.ini. The only thing that I am not sure of is if it is at all possible to update individual components without updating that package.

How to make eclipse launch a program in the eclipse workbench from the command line?

How do I make eclipse launch a program in the eclipse workbench from the command line?
Specifically, I would like to run a command from the shell that causes my eclipse instance (which is already open) to run a particular program. If there is no program to do this from the shell, is there some RPC API that eclipse provides to make such a program?
I do not want to make a plugin. It must be a separate process that controls eclipse.
Eclipse Remote Control seems that it might do the trick https://github.com/marook/eclipse-remote-control from the Read me file.
Introduction
Eclipse plug-in project which adds remote control features to eclipse.
Commands can be sent via the eclipse remote control client to a
running eclipse instance.
I have not tried it myslef but I ran into it trying to figure out how to write an ant task that triggers .launch file
First create a batch file and save it in a location.
For example if I want to invoke notepad , I will write in the batch as follows
start notepad
In eclipse, you can configure external tools.
Goto Run -> External Tools -> External Tools Configurations.
You will be presented with a Dialog box.
Now Click on the New Configuration Icon.
In the right pane of Window you can assign a configuration Name.
In the Location Text Box, Click on the "Browse File System" Button, and select the batch file you have created earlier.
In the Common Tab, uncheck "Launch In Background".
You can set this configuration in Favourites menu, by clicking the checkbox "External Tools" under Common Tab.
Click on Apply.
Now you can Run your required application. This is for Windows only. I don't have any idea of this for Linux Machines.
Take a look at Product Configuration
1º Create a new Product Configuration (Ctrl+N), and select "Use a launch configuration" (or another option, if it's more convenient) on the first page of the wizard.
2º In the Exporting section you should be able to export your product using the "Eclipse Product export wizard".
3º To run the product, follow this instructions
Hope it helps.
Not a complete answer, but here are some things I've come across with Eclipse:
In general, you can open Eclipse from the command line with something like:
java -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -Xms40m -Xmx512m -XX:MaxPermSize=256m -cp plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar org.eclipse.core.launcher.Main
That Main launcher takes an -application flag where you can pass what I think are plugins (not sure). I've typically used this to run Ant within Eclipse:
java -Dosgi.requiredJavaVersion=1.5 -Dhelp.lucene.tokenizer=standard -Xms40m -Xmx512m -XX:MaxPermSize=256m -cp plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar org.eclipse.core.launcher.Main -application org.eclipse.ant.core.antRunner -buildfile build.xml
I have no idea how to manipulate a running Eclipse instance, and I don't know if you can achieve your goals through an Ant script, but I thought these might be fruitful avenues.
Addition to ams' answer, marook's plugin just support very few commands.
open_file and execute_command with RUN/DEBUG/PROFILE
And marook also have a blog post about how to implement more command http://pielmeier.blogspot.com/2010/07/implementing-new-eclipse-remote-control.html
But as we all know, Eclipse plugin development is quite heavy weight.
So, I suggest just use execute_command with RUN by marook's plugin. The further function to Eclipse IDE, can be done by Eclipse EASE script engine. Write a light weight script and then RUN by marook's plugin, to avoid Eclipse plugin development.
More information about EASE can be found at:
https://opensource.com/life/16/2/how-use-python-hack-your-ide
There is also javascript script support:
https://git.eclipse.org/c/ease/org.eclipse.ease.scripts.git/tree/JavaScript%20Beginner%20Tutorial/02%20File%20IO/05%20Create%20sample%20project%20(using%20modules).js
Here you have a series of examples: http://www.rgagnon.com/javadetails/java-0014.html
Basically, you use:
Runtime.getRuntime().exec(command);

Why does CDT rebuild my C-project on Ant build in unrelated project?

I have an Eclipse workspace where a CDT project lives together with other unrelated projects. However, when I run "build as Ant build" in one of those projects, CDT insists on rebuilding its projects too.
Anyone have any ideas where to look to disconnect this "hidden" dependency? (And no, it's not in the "Linked Resources" or the "Project References"...)
The workspace wide build was actually caused by me failing to find the option for the build in "External Tools Configurations". There you can specify to build the whole workspace, the containing project, or some specific resource.
There is also an Eclipse bug for setting the default to something different than to build the whole workspace. (One could think that "Run as Ant build" would default to not build anything except running the specified Ant target.)
Project builders are run at the request of some build trigger. This might be resource changes (when you have build automatically enabled) or it could be the build action you're using: "build as Ant build". The build action may be inadvertently requesting a build of the whole workspace.
Put the following in a text file:
# Eclipse build
org.eclipse.core.resources/debug=true
org.eclipse.core.resources/build/interrupt=true
org.eclipse.core.resources/build/invoking=true
org.eclipse.core.resources/build/needbuild=true
#Managedbuild
org.eclipse.cdt.managedbuilder.core/debug/builder=true
org.eclipse.cdt.managedbuilder.core/debug=true
org.eclipse.cdt.managedbuilder.core/debug/pathEntryInit=false
org.eclipse.cdt.managedbuilder.core/debug/pathEntry=false
And run Eclipse with the additional switches:
-debug <trace_options>.file
This will echo trace prints to the shell in which you started Eclipse. You can use this to better target the bug report you'll no doubt file :)
Try to uncheck the Build Automatically checkbox, under Project menu.

Build several CDT C++ projects from commandline

What is the best solution to build several CDT C++ projects from the command line? The projects have references and so it is not possible to just build single projects.
This feature has been added in CDT 6 (Final build due June 15th 2009). You can download the final release candidate from builds page: download.eclipse.org/tools/cdt/builds/6.0.0/.
Using a release of Eclipse 3.5 + CDT 6, you can import, build and clean-build projects and the workspace using the following options sent to Eclipse at the command line:
eclipse -nosplash
-application org.eclipse.cdt.managedbuilder.core.headlessbuild
-import {[uri:/]/path/to/project}
-build {project_name | all}
-cleanBuild {projec_name | all}
On Windows, use eclipsec.exe instead of eclipse.exe to have build output written to stdout/stderr and so that the call blocks until completion.
The '-application' switch instructs Eclipse to run the CDT headless builder rather than starting the workbench. The other switches can be used individually or together. This means you can checkout a project using a shell script of your own, '-import' it into a workspace, and '-build' it using the Managedbuilder's headless builder.
Use the '-data' switch to specify the workspace to use, which can be an empty temporary directory, see the runtime documentation for other switches supported by the platform runtime:
help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html
See bug 186847 comment 24 and onwards for more detail on the committed functionality.
Pre CDT 6 you could use the JDT's AptBuilder (included with classic Eclipse, for example).
This lets you build an already configured workspace. So you: checkout your source, configure a workspace which points to the checked-out projects. Your automated build scripts can then update the checkouts and run the AptBuilder without needing to start the GUI.
If you created a Make project under CDT you can just use your favorite shell and execute make in all the projects dirs.
Headless build with the manage builder is currently not supported, see bug 186847 - CDT internal builder does not support automated command line builds.
If you use the unmanaged (make) builder, then you already have Makefiles that you can use from the command line.
We do this in our existing build.
Put a makefile in all your external references and your toplevel project.
In your "all" rule, have it run:
make -C ./externalref1
make -C ./externalref2
etc
we actually define the external dependencies in a variable:
EXT_DEP = externalref1 externalref2
then use the subst (substitute) command to kick off all the sub-makes using the correct call.