Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-dev] Using WeavingHook in eclipse

Thanks Christoph,
Mine is a eclipse plugin, i will try to p2.inf approach.

Gayan.


On Sun, Oct 25, 2020 at 6:52 PM Christoph Läubrich <laeubi@xxxxxxxxxxxxxx> wrote:
It all depends on the context.

If you run from a product for example, add your bundle to the
configuration, set its autostart=true and startlevel=1

If you bundle is just an eclipse-plugin you would need to provide a
p2.inf to configure appropriate start-levels and edit your runconfig
accordingly.

Am 25.10.20 um 18:48 schrieb Gayan Perera:
> Hi Christoph,
>
> How can i make my bundle start early as possible, I tried registering my
> hook at Activator, but i couldn't get the bundle to start. Thats why i
> though may be the service annotation would start my bundle early.
>
> Gayan
>
> On Sun, Oct 25, 2020 at 6:37 PM Christoph Läubrich
> <laeubi@xxxxxxxxxxxxxx <mailto:laeubi@xxxxxxxxxxxxxx>> wrote:
>
>     WeavingHooks require a good knowledge of how OSGi works as they have
>     several constraints and implications.
>
>     I can only recommend to start with an absolute minimal example (aka
>     Hook
>     with system.out), lazy loading is NOT sufficient for making
>     WeavingHooks
>     work, dependencies should be cut down to the absolute minimum as you
>     won't be able to (reliable) weave any class you depend on!
>
>     So the very first steps should include:
>     - create a bundle with only osgi+weaving requirements as PACKAGE(!)
>     imports
>     - make sure your bundle is startet AS EARLY as possible
>     - do not use DS or any other abstraction laver but register your
>     WeavinHook with an Activator
>     - make sure you are able to debug resolving/startup issues
>
>     If all that is done, you can try to enhance your bundle to do the
>     actual
>     tasks.
>
>
>     Am 25.10.20 um 18:22 schrieb Gayan Perera:
>      > I tried adding the correct dependencies, but i couldn't find the
>     bundles
>      > in bundle dependencies, i searched in update site and orbit as
>     well, but
>      > i could only find the source bundles. But for some reason the
>     classes
>      > seems to be resolved for compilation.
>      >
>      > Where can i get the correct bundles ? I'm using 4.18 Ibuild and 4.17
>      > release as my PDE target runtimes.
>      >
>      > Gayan.
>      >
>      > On Sun, Oct 25, 2020 at 6:17 PM Dirk Fauth
>     <dirk.fauth@xxxxxxxxxxxxxx <mailto:dirk.fauth@xxxxxxxxxxxxxx>
>      > <mailto:dirk.fauth@xxxxxxxxxxxxxx
>     <mailto:dirk.fauth@xxxxxxxxxxxxxx>>> wrote:
>      >
>      >     Well your bundle requirement looks very wrong since you
>     require the
>      >     source bundles that IMHO are not part of the runtime and of
>     course
>      >     you should never require sources! That is why your bundle
>     does not
>      >     start.
>      >
>      >     Gayan Perera <gayanper@xxxxxxxxx <mailto:gayanper@xxxxxxxxx>
>     <mailto:gayanper@xxxxxxxxx <mailto:gayanper@xxxxxxxxx>>>
>      >     schrieb am So., 25. Okt. 2020, 18:13:
>      >
>      >         Hi Dirk,
>      >         Yes PDE annotation are enabled.
>      >         The xml generated inside OSGI-INF looks like this
>      >
>      >         *<?xml version="1.0" encoding="UTF-8"?>*
>      >
>      >       
>       *<**scr:component**xmlns:scr=*/"http://www.osgi.org/xmlns/scr/v1.1.0 <http://www.osgi.org/xmlns/scr/v1.1.0>
>      >         <http://www.osgi.org/xmlns/scr/v1.1.0
>     <http://www.osgi.org/xmlns/scr/v1.1.0>>"/*immediate=*/"true"/*name=*/"org.gap.eclipse.plugins.eclipseiconpacks.core.IconPackWeavingHook"/*>*
>      >
>      >         *<service>*
>      >
>      >       
>       *<provide**interface=*/"org.osgi.framework.hooks.weaving.WeavingHook"/*/>*
>      >
>      >         *</service>*
>      >
>      >       
>       *<implementation**class=*/"org.gap.eclipse.plugins.eclipseiconpacks.core.IconPackWeavingHook"/*/>*
>      >
>      >         *</scr:component>*
>      >
>      >
>      >         My build.properties looks like this
>      >
>      >
>      >         source.. = src/main/java/
>      >
>      >         output.. = target/classes/
>      >
>      >         bin.includes = plugin.xml,\
>      >
>      >                         META-INF/,\
>      >
>      >                         .,\
>      >
>      >                         icons/,\
>      >
>      >                         OSGI-INF/
>      >
>      >
>      >         Manifest looks like this
>      >
>      >         *Manifest-Version**:*/1.0/
>      >
>      >         *Bundle-ManifestVersion**:*/2/
>      >
>      >         *Bundle-Name**:*/eclipse-icon-packs Core Plugin/
>      >
>      >       
>       *Bundle-SymbolicName**:*/eclipse-icon-packs.core;//singleton/*:=*/true/
>      >
>      >         *Bundle-Version**:*/0.0.1. <http://0.0.1.>qualifier/
>      >
>      >       
>       *Bundle-Activator**:*/org.gap.eclipse.plugins.eclipseiconpacks.core.Activator/
>      >
>      >         *Require-Bundle**:*/org.eclipse.core.runtime,/
>      >
>      >         / org.eclipse.osgi.services,/
>      >
>      >         / org.eclipse.equinox.region.source,/
>      >
>      >         / org.eclipse.equinox.weaving.hook.source/
>      >
>      >         *Bundle-RequiredExecutionEnvironment**:*/JavaSE-1.8/
>      >
>      >         *Bundle-ActivationPolicy**:*/lazy/
>      >
>      >       
>       *Service-Component**:*/OSGI-INF/org.gap.eclipse.plugins.eclipseiconpacks.core.IconPackWeavingHook.xml/
>      >
>      >       
>       *Export-Package**:*/org.gap.eclipse.plugins.eclipseiconpacks.core/
>      >
>      >         /
>      >         /
>      >         Gayan
>      >
>      >
>      >
>      >         On Sun, Oct 25, 2020 at 6:02 PM Dirk Fauth
>      >         <dirk.fauth@xxxxxxxxxxxxxx
>     <mailto:dirk.fauth@xxxxxxxxxxxxxx> <mailto:dirk.fauth@xxxxxxxxxxxxxx
>     <mailto:dirk.fauth@xxxxxxxxxxxxxx>>>
>      >         wrote:
>      >
>      >             Do you have pde ds annotations enabled? Because then the
>      >             bundle activation policy should be lazy by default.
>     And also
>      >             the @Component annotation is processed correctly.
>      >
>      >             Gayan Perera <gayanper@xxxxxxxxx
>     <mailto:gayanper@xxxxxxxxx>
>      >             <mailto:gayanper@xxxxxxxxx
>     <mailto:gayanper@xxxxxxxxx>>> schrieb am So., 25. Okt. 2020,
>      >             17:59:
>      >
>      >                 Hi Wim,
>      >
>      >                 No the bundle is not getting started, i thought
>     exposing
>      >                 the service descriptor should start the bundle.
>     But its
>      >                 not getting started, i put a break point in
>      >                 BundleActivator start method to see. It doesn't
>     get hit.
>      >
>      >                 Gayan.
>      >
>      >                 On Sun, Oct 25, 2020 at 4:49 PM Wim Jongman
>      >                 <wim.jongman@xxxxxxxxx
>     <mailto:wim.jongman@xxxxxxxxx> <mailto:wim.jongman@xxxxxxxxx
>     <mailto:wim.jongman@xxxxxxxxx>>>
>      >                 wrote:
>      >
>      >                     Hi,
>      >
>      >                     Is the bundle started?
>      >
>      >                     Cheers,
>      >
>      >                     Wim
>      >
>      >                     On Sun, Oct 25, 2020 at 1:58 PM Gayan Perera
>      >                     <gayanper@xxxxxxxxx
>     <mailto:gayanper@xxxxxxxxx> <mailto:gayanper@xxxxxxxxx
>     <mailto:gayanper@xxxxxxxxx>>> wrote:
>      >
>      >                         Hi,
>      >
>      >                         I’m trying to register a weavinghook using
>      >                         services descriptors. I annotated my
>     weavinghook
>      >                         class with component annotation and
>     inhave the
>      >                         osgi folder with the service descriptor
>     xml in
>      >                         place. The osgi folder is included in
>      >                         build.properties as well. But the
>     weavinghook is
>      >                         not getting called. Can someone guide me
>     how to
>      >                         get this working.
>      >
>      >                         My endgoal is to weave ImageDescriptor
>     class to
>      >                         support override bundle images.
>      >
>      >                         Best regards,
>      >                         Gayan.
>      >                       
>       _______________________________________________
>      >                         platform-dev mailing list
>      > platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>
>      >                         <mailto:platform-dev@xxxxxxxxxxx
>     <mailto:platform-dev@xxxxxxxxxxx>>
>      >                         To unsubscribe from this list, visit
>      > https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>
>      >                       
>       <https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>>
>      >
>      >                     _______________________________________________
>      >                     platform-dev mailing list
>      > platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>
>      >                     <mailto:platform-dev@xxxxxxxxxxx
>     <mailto:platform-dev@xxxxxxxxxxx>>
>      >                     To unsubscribe from this list, visit
>      > https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>
>     <https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>>
>      >
>      >                 _______________________________________________
>      >                 platform-dev mailing list
>      > platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>
>     <mailto:platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>>
>      >                 To unsubscribe from this list, visit
>      > https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>
>      >               
>       <https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>>
>      >
>      >             _______________________________________________
>      >             platform-dev mailing list
>      > platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>
>     <mailto:platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>>
>      >             To unsubscribe from this list, visit
>      > https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>
>      >           
>       <https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>>
>      >
>      >         _______________________________________________
>      >         platform-dev mailing list
>      > platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>
>     <mailto:platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>>
>      >         To unsubscribe from this list, visit
>      > https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>
>      >         <https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>>
>      >
>      >     _______________________________________________
>      >     platform-dev mailing list
>      > platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>
>     <mailto:platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>>
>      >     To unsubscribe from this list, visit
>      > https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>
>      >     <https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>>
>      >
>      >
>      > _______________________________________________
>      > platform-dev mailing list
>      > platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>
>      > To unsubscribe from this list, visit
>     https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>
>      >
>     _______________________________________________
>     platform-dev mailing list
>     platform-dev@xxxxxxxxxxx <mailto:platform-dev@xxxxxxxxxxx>
>     To unsubscribe from this list, visit
>     https://www.eclipse.org/mailman/listinfo/platform-dev
>     <https://www.eclipse.org/mailman/listinfo/platform-dev>
>
>
> _______________________________________________
> platform-dev mailing list
> platform-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/platform-dev
>
_______________________________________________
platform-dev mailing list
platform-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/platform-dev

Back to the top