-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pub support #107
Add pub support #107
Conversation
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Hi @lak-proddev, I tinkered around with a workspace listener to listen on changes to "pubspec.yaml" files. It is quite tedious and I'm not sure if this is the correct way to do this. Could you review and test? Thanks. |
As per @vogella comment, We need to use startup OSGi service to register the resource listener.
I also looking same solution for registring the logger |
Signed-off-by: Lakshminarayana Nekkanti <narayana.nekkanti@gmail.com>
@jonas-jonas I pushed mistakenly. Please, check whether it's working for you as expected. |
This reverts commit 50ff97c.
No problem at all. For me it seems to work with your commit before the revert. Why did you revert? Also do feel free to push onto branches of mine, if you feel it's needed to improve the code. No need to communicate code changes solely through comments. :) |
See
https://www.vogella.com/tutorials/OSGi/article.html#exercise-provide-an-osgi-service
IIRC the annotation provides a way to enable it eagerly. Jonas, please have
a look and add this to the tutorial.
You can use the OSGi console to see if it is running
Jonas Hungershausen <notifications@github.com> schrieb am Mo., 22. Juli
2019, 13:11:
… @jonas-jonas <https://github.com/jonas-jonas> I pushed mistakenly.
Please, check whether it's working for you as expected.
No problem at all. For me it seems to work with your commit before the
revert. Why did you revert?
Also do feel free to push onto branches of mine, if you feel it's needed
to improve the code. No need to communicate code changes solely through
comments. :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#107?email_source=notifications&email_token=AABCFBW7MJKZUTENUUWAYBLQAWPVNA5CNFSM4IFS4U32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2PW6LI#issuecomment-513765165>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABCFBW5LOQWABBPENQSMO3QAWPVNANCNFSM4IFS4U3Q>
.
|
Jonas, Yes it will work. But, need to improve a bit. With my commit, the listener will add for every event (multiple times). |
@vogella, @lak-proddev didn't use an annotation for the service. It is registered via the |
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used an OSGI service here instead of the StartupListener. I'm not sure if I've done this correctly. Could someone verify?
org.eclipse.dartboard/OSGI-INF/org.eclipse.dartboard.ListenerService.xml
Outdated
Show resolved
Hide resolved
XML file must be committed. Manifest looks fine on my mobile.
Jonas Hungershausen <notifications@github.com> schrieb am Mo., 22. Juli
2019, 20:51:
… ***@***.**** commented on this pull request.
I used an OSGI service here instead of the StartupListener. I'm not sure
if I've done this correctly. Could someone verify?
------------------------------
In org.eclipse.dartboard/META-INF/MANIFEST.MF
<#107 (comment)>:
> org.slf4j.spi
+Service-Component: OSGI-INF/org.eclipse.dartboard.ListenerService.xml
+Bundle-ActivationPolicy: lazy
Is this correct?
------------------------------
In
org.eclipse.dartboard/OSGI-INF/org.eclipse.dartboard.ListenerService.xml
<#107 (comment)>:
> @@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
This file should be committed right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#107?email_source=notifications&email_token=AABCFBRIJB626EHG7AG5V3LQAYFUHA5CNFSM4IFS4U32YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB7F5VZQ#pullrequestreview-265018086>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABCFBU3QDPURV6R7XPDERDQAYFUHANCNFSM4IFS4U3Q>
.
|
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
This PR adds multiple things related to the Pub package manager. Features added by the PR:
I tested it on my windows VM and it worked for me. Please do test on your machine. Also I'd like to provide PubServer as an |
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
org.eclipse.dartboard/src/org/eclipse/dartboard/ListenerService.java
Outdated
Show resolved
Hide resolved
org.eclipse.dartboard/src/org/eclipse/dartboard/pub/PubGetHandler.java
Outdated
Show resolved
Hide resolved
org.eclipse.dartboard/src/org/eclipse/dartboard/pub/PubGetHandler.java
Outdated
Show resolved
Hide resolved
@Activate | ||
public void registerListeners() { | ||
IWorkspace workspace = ResourcesPlugin.getWorkspace(); | ||
workspace.addResourceChangeListener(new PubspecChangeListener()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to remove the listener?. I am not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, ideally we would remove the listener when the user unchecks the checkbox on the preference page. But as the ListenerService is not available in the class in the current design, the listener stays registered as is and the necessary checks are done whenever it fires.
And it should stay registered until the workspace is closed.
org.eclipse.dartboard/src/org/eclipse/dartboard/propertytester/IsDartProjectPropertyTester.java
Outdated
Show resolved
Hide resolved
* A {@link Map} holding an {@link IProject} and a {@link Job} as ideally there | ||
* should only be one {@code pub get} job running per project. | ||
*/ | ||
private Map<IProject, Job> pubGetJobs = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the flow of this class. Can you check do we need to clear or making null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the flow of this class. Can you check do we need to clear or making null.
I'm not sure what you mean by this. The Map should always be the same object for the lifetime of the object.
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Alright, I think I tested the functionality of this patch thoroughly on Windows and Linux. As mentioned in the comments above, most of the service architecture depends on a working structure of OSGi services, which is out of scope of this patch. I will ask @vogella once he is back in office to see what we can do about it. I'd like to merge and see what happens. Any objections? |
No objections from my side. |
And I would merge if there wasn't an exception on every startup related to the OSGi service: If the plugin is installed from an update site, after a second restart after the install the IDE fails to start with the following exception in the log. It does not happen if I remove the Anyone know a solution to this? If not, the startup extension would be the other solution, we could use.
|
I think you have to register for the startup completed event in the service
to ensure the application is running before registering the listener.
See
https://www.vogella.com/tutorials/Eclipse4EventSystem/article.html
Jonas Hungershausen <notifications@github.com> schrieb am Di., 30. Juli
2019, 20:28:
… And I would merge if there wasn't an exception on every startup related to
the OSGi service:
If the plugin is installed from an update site, after a second restart
after the install the IDE fails to start with the following exception in
the log. It does not happen if I remove the ListenerService.
Anyone know a solution to this? If not, the startup extension would be the
other solution, we could use.
Root exception:
java.lang.IllegalStateException: The instance data location has not been specified yet.
at org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized(DataArea.java:59)
at org.eclipse.core.internal.runtime.DataArea.getStateLocation(DataArea.java:136)
at org.eclipse.core.internal.runtime.InternalPlatform.getStateLocation(InternalPlatform.java:545)
at org.eclipse.core.runtime.Plugin.getStateLocation(Plugin.java:259)
at org.eclipse.core.internal.resources.LocalMetaArea.<init>(LocalMetaArea.java:63)
at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:481)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:842)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:834)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:791)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1013)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:365)
at org.eclipse.osgi.container.Module.doStart(Module.java:598)
at org.eclipse.osgi.container.Module.start(Module.java:462)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:493)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:117)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:570)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:330)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:396)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:41)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:470)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:423)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:415)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:155)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructors(Class.java:1651)
at org.apache.felix.scr.impl.inject.ComponentConstructor.<init>(ComponentConstructor.java:94)
at org.apache.felix.scr.impl.inject.ComponentMethodsImpl.initComponentMethods(ComponentMethodsImpl.java:106)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.initDependencyManagers(AbstractComponentManager.java:1008)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.collectDependencies(AbstractComponentManager.java:1026)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:936)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:765)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432)
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665)
at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339)
at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:381)
at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49)
at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:263)
at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196)
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169)
at org.apache.felix.scr.impl.AbstractExtender.addingBundle(AbstractExtender.java:139)
at org.apache.felix.scr.impl.AbstractExtender.addingBundle(AbstractExtender.java:49)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:973)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:234)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:140)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:132)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:231)
at org.eclipse.osgi.container.Module.publishEvent(Module.java:493)
at org.eclipse.osgi.container.Module.start(Module.java:480)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$1.run(ModuleContainer.java:1820)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$2$1.execute(EquinoxContainerAdaptor.java:150)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1813)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1769)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1735)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1661)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#107?email_source=notifications&email_token=AABCFBQFAF3I5ZHUNSYIO7DQCCB4XA5CNFSM4IFS4U32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3E33WI#issuecomment-516537817>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABCFBXJPKNYJOP5NXKQNILQCCB4XANCNFSM4IFS4U3Q>
.
|
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
After trying virtually every approach I could find, with non of them working without any issues, I reverted back to the startup extension that works without issues out of the box. As mentioned in previous comments, I'd like to use OSGi services later on for all sorts of services, but couldn't figure out how to use them everywhere. @vogella when you're back we should try to sort this out. For now, I'm going to merge this patch because I'd like to move forward with featuers. We can refactor it later to conform to OSGi services. |
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
Signed-off-by: Jonas Hungershausen <jonas.hungershausen@vogella.com>
-Can be disabled via the Preference page