tycho icon indicating copy to clipboard operation
tycho copied to clipboard

Use DS annotations for tycho components

Open laeubi opened this issue 3 years ago • 7 comments

Currently we use hand crafted component.xml using DS-Annotations would automate this process and make it much more convenient and clear.

laeubi avatar Mar 10 '22 12:03 laeubi

Would you please ellaborate what should/could be done here?

akurtakov avatar Jun 01 '22 08:06 akurtakov

We currently have for example here some component definitions, hand crafted:

https://github.com/eclipse/tycho/tree/master/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/OSGI-INF

the in code then these methods are (sometimes) marked with // for DS usage.

On the other hand one can use DS Annotations with the following advantages:

  1. Automatic validation and generation of the XML (e.g. missing methods)
  2. One can work "in code" to change something without taking care of the XML
  3. The annotations already document that these is used for DS so one don't think they are unused
  4. With recent Tycho 2.7.3 you don't even need to check in the XML as they are generated by the build

laeubi avatar Jun 01 '22 10:06 laeubi

Would you please do one of them to serve as example? And I can trying doing others while familiarizing myself with DS .

akurtakov avatar Jun 01 '22 10:06 akurtakov

I can try to prepare an example, I have written a short "quickstart" once at m2e here:

https://github.com/eclipse-m2e/m2e-core/pull/628/files#r841896726

and here is an example for a very simple component:

https://github.com/eclipse-m2e/m2e-core/blob/master/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectFacadeAdapterFactory.java

laeubi avatar Jun 01 '22 10:06 laeubi

@akurtakov do you plan to further work on this?

laeubi avatar Jun 28 '22 04:06 laeubi

I hope to find time for it before 3.0

akurtakov avatar Jun 28 '22 05:06 akurtakov

Great let me know if you need any help.

laeubi avatar Jun 28 '22 05:06 laeubi

@laeubi Is this fixed in Tycho 3.0.0? Is the MANIFEST.MF also extended with the service metadata references? Would be good to also document this in https://wiki.eclipse.org/Tycho/FAQ#How_to_use_OSGi_declarative_service_annotations.

kwin avatar Oct 03 '22 09:10 kwin

@kwin this is about Tycho using DS internally (and is somehow obsolete now).

The wiki itself is heavily outdated and mostly would need a complete overhaul. From the user side you can use all the annotations and Tycho will generate the xml, but you will need to add the service metadata references (or mostly PDE will do this for you if you enable DS annotation processing).

laeubi avatar Oct 03 '22 09:10 laeubi