Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Generating .cproject files

On Tue, 2019-04-02 at 16:43 +0200, Christian Walther wrote:
Clément Hurlin <clement.hurlin@xxxxxxxxxxxxx> wrote:

 At my company (where we ship a secure kernel and applications on top
of it), we would like to prepare packaged Eclipse installations for our
clients and for that we need to generate cdt projects. However, the
.cproject file (such as the one generated for a new "Makefile project
with existing code") is pretty complex and seems to contain unique
identifiers (numerical suffixes of Java packages).
 Is it possible to call the .project/.cproject generator used by the
UI, but from the command line ? If yes, it'd enable us to alter this
file (add sourceEntries, definedSymbols, etc.) with specifics for our
clients. I have experience developing Eclipse plugins but I'm new to the
CDT environment.

I have never done this, so I can't give you a full solution, but some ideas:

- Take a look at the headless builder for a command-line environment that deals with CDT projects. I imagine you should be able to create projects in that context as well.
  https://urldefense.proofpoint.com/v2/url?u=https-3A__git.eclipse.org_c_cdt_org.eclipse.cdt.git_tree_build_org.eclipse.cdt.managedbuilder.core_src_org_eclipse_cdt_managedbuilder_internal_core_HeadlessBuilder.java&d=DwIGaQ&c=yzoHOc_ZK-sxl-kfGNSEvlJYanssXN3q-lhj0sp26wE&r=NrrbvTHWa2Nbp_kAN0Hl1o3lM1WAwSes64uBjxjNhMc&m=wBiGJ9NUsqDYHVKJZsK1fBOLGpCPwRF0oT-nF50GJMg&s=t5EQMq2X84lBFtT3VFPws8Rz8ZrnVpBAtbiCJWyueuA&e=

- https://urldefense.proofpoint.com/v2/url?u=http-3A__cdt-2Ddevel-2Dfaq.wikidot.com&d=DwIGaQ&c=yzoHOc_ZK-sxl-kfGNSEvlJYanssXN3q-lhj0sp26wE&r=NrrbvTHWa2Nbp_kAN0Hl1o3lM1WAwSes64uBjxjNhMc&m=wBiGJ9NUsqDYHVKJZsK1fBOLGpCPwRF0oT-nF50GJMg&s=3Zt0T8XJ9Lg2qAtfQYshbRWWQ-2o5oxtMJ3S8h6xHSE&e= has some information on creating projects and their contents.

- There are many CDT unit tests that need to create (rudimentary) projects, you might find some useful code there, too.

I would advise against trying to generate .cproject files using any other mechanisms than CDT itself, for the reasons you have observed.

You can also look at the implementations of the new project wizards.

And if there are any APIs missing, please feel free to contribute them. The .cproject files are actually internal API and can change, or even be removed as we did with .cdtproject, at any moment. Using an Eclipse command line IApplication is the only really supported approach.

Thanks!
Doug.



Back to the top