Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Advanced Scripting Environment (EASE) » Eclipse CDT project configuration(Can EASE be used to perform automation of existing project customization?)
Eclipse CDT project configuration [message #1850099] Tue, 15 February 2022 19:23 Go to next message
Laurent Masse-Navette is currently offline Laurent Masse-NavetteFriend
Messages: 2
Registered: February 2022
Junior Member
As a C++ developer, I use Eclipse CDT on a daily basis to perform development tasks, such as editing code, analyze dependencies, navigate the history of changes user the perforce perspective etc...
Since we have lots of code branches to manage, and juggling between different projects, we have to create new code sandboxes often, and import them as new Eclipse workspace with a single project in it. It can happen several times any given day. At the moment, the creation of the workspace and project is automated, but we still have to customize Eclipse manually after bringing up Eclipse for the first time in any given sandbox. We apply a repetitive sequence of setup steps that I am trying to find a way to automate. Here is a sanitized version of the manual steps we are following:


    Open the Perforce perspective and add connection to P4 server (<name of server we use>). Add your credentials. On next page select your P4 workspace. Cancel without importing any folders (this was already done by <name of eclipse launch script/worspace creation script>).
    Go back to your C++ perspective, rightclick on the project root and select Team -> Share project, choose Perforce, set your connection and workspace and uncheck the "Move to target" option (files are already there).
    Go back to your C++ perspective, rightclick on the project, go to Properties (at the far end), select "C/C++ Build", and in the path appearing in "Build Command" edit the name of the build command to <name of our custom build script>.
    Add a resource filter so that certain directories are excluded from code analysis. Rightclick project -> Properties -> Resource -> Resource Filters -> Add filter: Exclude all / Folders / All children / Name matches *<pattern>*, then repeat for *<another pattern>*.
    Import the C++ format definition from /remote/pcgdisk190/eclipse-setup/Synopsys_Format.xml. Window -> Preferences -> C/C++ -> Code Style -> Formatter -> Import.
    Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery -> CDT GCC Build-in Compiler Settings in the text box entitled Command to get compiler specs append -std=c++11
    Project→ Properties → C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." __GXX_EXPERIMENTAL_CXX0X__ into "Name", leave "Value" blank, select "apply to all configurations".


Can EASE be used to perform this manual customization automatically?
If so, what would be the general method to understand what scripts needs to be written? Is there an easy way to translate the menu actions into a script that EASE can execute?

If not, then I am looking at the wrong place and I apologize for posting to the wrong forum. Is there any other solution, aside from system scripts to hack/edit the Eclipse configuration files, to programmatically configure Eclipse?
Re: Eclipse CDT project configuration [message #1850115 is a reply to message #1850099] Wed, 16 February 2022 17:23 Go to previous messageGo to next message
Christian Pontesegger is currently offline Christian PonteseggerFriend
Messages: 233
Registered: July 2009
Location: Graz, Austria
Senior Member
Hi Laurent,

EASE can be used to automate several things. Basically you can use it for anything that can be done via the Java API of your Eclipse installation. For some of these tasks we have nice helpers, eg

- Set preferences via the Platform module. A sample code might look like this:
loadModule('/System/Platform');
writePreferences("org.eclipse.some.plugin/some/prefs/node" , "key", "value");


- Change Resources via the Resources module:
Allows to access Projects and descriptions, create/alter files and folders

- Call eclipse handlers
The Platform module provides 'executeCommand()' which allows to call any handler from your IDE. Handlers are the executors triggered when you click on toolbar icons or select menu entries.

As the tasks you listed are very specific, I cannot give you guidance which of the mentioned methods might be best to implement them, but you should be able to handle most of your requests.

In case EASE does not work out for you, you should also be able to handle your tasks using Oomph, which is a nice way to setup your environment.

HTH
Christian

Re: Eclipse CDT project configuration [message #1850279 is a reply to message #1850115] Wed, 23 February 2022 16:52 Go to previous messageGo to next message
Laurent Masse-Navette is currently offline Laurent Masse-NavetteFriend
Messages: 2
Registered: February 2022
Junior Member
Hi Christian,

Thank you for your kind reply.
So I guess it answers my first question: it should be possible to use EASE to implement what I am trying to do.

But where to find the resources to know exactly what syntax to write for each of the methods you described? For instance, if I use the platform module with writePreference(), how do I determine the value of node, key and value to pass? There must be a trick, method or documentation to determining how to fill-in the blanks, and this is what I now need to understand.
I tried using the script recorder, but when I do, nothing happens. I must be using it wrong, or what I am doing is not handled by it.

Thanks in advance for any advice. While waiting for an answer, I will have a look at Oomph.

Best regards,

Laurent
Re: Eclipse CDT project configuration [message #1850357 is a reply to message #1850279] Sat, 26 February 2022 10:19 Go to previous message
Christian Pontesegger is currently offline Christian PonteseggerFriend
Messages: 233
Registered: July 2009
Location: Graz, Austria
Senior Member
When changing preferences interactively you can use Oomph to record them. Then you need to check out your Oomph profile for the dedicated keys and values. Another option is to manually inspect your workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings folder for the preferences you are interested in. Unfortunately this is some reverse engineering you have to do.

The script recorder simply stores all commands you enter in the shell. My original idea always was to record things that people do in the IDE. Unfortunately I did not find a nice way to spy on things happening in the IDE...

Christian
Previous Topic:EASE in Python4Capella
Next Topic:Jython not used
Goto Forum:
  


Current Time: Mon Oct 03 21:51:12 GMT 2022

Powered by FUDForum. Page generated in 0.02336 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top