Friday, October 25, 2013

Google Talk plugin presence breaks Eclipse in Fedora 20.

This is the kind of news I really hate to announce, and at the same time, this is the reason why I'm addicted to open source. With open-source I could report it. Investigate it, or even workaround it. But the only thing I can do with a binary plugin is to remove it.

Symptoms:
Eclipse 4.3.1 in Fedora 20 crashes shortly after content assist or javadoc is shown. ABRT discovers a crash.

Reason:
Both content assist and javadoc are browser-based. Google Talk plugin interferes with webkit/SWT, and in the end JVM crashes.

Workaround:
Remove Google Talk plugin.
yum -y remove google-talkplugin 

Thursday, October 24, 2013

Enabling Tycho tests for P2 - lessons learned

Today's morning, after turning on Eclipse, I got this notification:


I find it to be a big step forward (at least to me), because from now on, all P2 patches pushed to gerrit will be automatically verified in a quite reasonable time - more or less 2 hours - yes, that's the time that is necessary to run the build and execute all P2 tests.

However, the road to the green build was a rather bumpy one - here is the list of issues that may impact more people doing the migration:

Issue #1 - Error code 23.

First reported as Bug 415489 - tycho-surefire occasionally fails with unexpected return code 23. Then after investigation - duplicate opened by me:
Bug 417430 - tycho-eclipserun may interfere with tycho-surefire OSGi runtime.

Symptoms:
Tycho builds stops with an unexpected error code 23. The build is not failed, it just exits.

Cause:
Tycho occasionally assembles and spins Equinox instances, if it is necessary to run OSGi-based tooling during the build. But in one place, Equinox was refusing to start, and was returning error code 23, demanding to be restarted. The sequence that lead to this was pretty simple:
  • Tycho assembled and run Equinox instance based on Kepler versions to generate API description
  • a bit later, tycho assembled and run another Equinox instance based on Luna-Nightly to run tests, but the configuration directory was not cleaned, so Equinox thought an update was happening, and demanded a restart.
Solutions:
  • Update to Tycho 0.19.0 - the issue has been fixed there
  • Change tycho surefire configuration area to avoid collision with api builder:
    <work>${project.build.directory}/surefireconf</work>

Issue #2 - Different naming schemas.

One of the tests was failing all the time, returning doubled number of artifacts in a generated P2 repository (expected:3, was:6). What happened was that P2 was copying bundles from a running application, and this Surefire application was using different naming scheme: Regular Eclipse apps use following convention: bundleId_version.qualifier.jar, but Tycho Surefire uses bundleId-version.qualifier.jar. Of course, P2 processed those files properly, and generated valid repo, just the test input was wrong.

Issue #3 - Circular dependencies.

P2 Tests, to run properly, require platform specific filesystem bundles. The only way to add those bundles to Surefire is to add parent feature - and since we are building P2, parent feature (org.eclipse.platform) would be resolved from an update site. Well, almost. The parent feature happened to include one bundle from the reactor (org.eclipse.update.configurator I think). So, almost everything was resolved from the update site, except this one bundle, which came from the reactor, and didn't satisfy feature requirements due to the changed version.

The workaround was to use java.io.File api (luckily this is all about test case preparation).

Some discussion concerning this issue seems to be happening in Bug 419201 - "mvn clean verify -Pbuild-individual-bundles" fails for Platform Compare.

Side note:
There is an ongoing effort to enable running tests during the build for particular components, under the umbrella  Bug 416904 - Allow to run tests with tycho-surefire-plugin. "In order to lower entry barrier and execution of unit tests [...]".

Best regards,

Monday, October 21, 2013

Rediscovering Mylyn (Builds)

I always have a mixed feelings when I try to write anything about Mylyn. It's just impossible to cover all its greatness it in one blogpost, and the fact that it is written as an Eclipse add-on is not helping much in promoting it amongst my linux readers (it's all because of this joke:
But let's try. First of all, Mylyn is an excellent tool to keep all your bugs in one place, which is very useful for me, as I very often jump between projects and need to switch between different areas quite fast:

Mylyn Task list - bugs from different sources in one place
But that's just a tip of the ice berg.  The true power of Mylyn is 'context' management. What is a context? Well, it's a set of files you are working with, and Mylyn's ability to track which files are important for certain bug is hard to overestimate when you get a comment like:
Can you include a "description.txt" file (or similar) that describes how to rebuild them, in case it is required in the future?

The context is just one click-away - the only thing you need is to activate your task by clicking the ball next to it:

An active task, a task without context, and an inactive task with recorded context.
So now we go to the main Mylyn functionality, that really let's the entire Eclipse shine - just compare the next two screenshots:



Have you noticed which files are presented in the 'Package Explorer' view? Yes, that's those I really need! No clutter, no list scrolling! One click and you're back to task that you've left a week ago!

But even that's not all. If you have Continuous Integration running on Jenkins/Hudson, you may connect your Eclipse to it, and get this lovely view of your jobs:
Builds view. Notifications included. No more page refreshing.
Can you see the small JUnit action? Guess what does it do :). Yes, you are right - it opens tests in a JUnit view:

Jenkins/Hudson build test result loaded into Eclipse.
And now - once you double click the stack trace - Eclipse will open a file for you - no grepping, finding, searching - everything loaded into your really Integrated Development Environment!

Of course - this is just a small part of Mylyn functionality, this is just what appeals to me most in my daily work. But managers will be happy, too, with all the project-tracking functionality, integrated via OSLC, and really powerful tools (out of scope for this blog).

Quick instructions how to install Mylyn in Fedora (packaged by me):
sudo yum install eclipse-mylyn
Pretty simple - and really worth to try out!