Thursday, June 25, 2020

Eclipse JustJ

I've recently completed the initial support for provisioning the new Eclipse JustJ project, complete with a logo for it.


I've learned several new technologies and honed existing technology skills to make this happen. For example, I've previously used Inkscape to create nicer images for Oomph; a *.png with alpha is much better than a *.gif with a transparent pixel, particularly with the vogue, dark-theme fashion trend, which for old people like me feels more like the old days of CRT monitors than something modern, but hey, to each their own. In any case, a *.svg is cool, definitely looks great at every resolution, and can easily be rendered to a *.png.

By the way, did you know that artwork derivative of  Eclipse artwork requires special approval? Previously the Eclipse Board of Directors had to review and approve such logos, but now our beloved, supreme leader, Mike Milinkovich, is empowered to do that personally.

Getting to the point where we can redistribute JREs at Eclipse has been a long and winding road.  This of course required Board approval and your elected Committer Representatives helped push that to fruition last year.  Speaking of which, now there is an exciting late-breaking development: the move of AdoptOpenJDK to Eclipse Adoptium.  This will be an important source JREs for JustJ!

One of the primary goals of JustJ is to provide JREs via p2 update sites such that a product build can easily incorporate a JRE into the product. With that in place, the product runs out-of-the-box regardless of the JRE installed on the end-user's computer, which is particularly useful for products that are not Java-centric where the end-user doesn't care about the fact that Eclipse is implemented using Java.  This will also enable the Eclipse Installer to run out-of-the-box and will enable the installer to create an installation that, at the user's discretion, uses a JRE provided by Eclipse. In all cases, this includes the ability to update the installation's embedded JRE as new ones are released.

The first stage is to build a JRE from a JDK using jlink.  This must run natively on the JDK's actual supported operating system and hardware architecture.  Of course we want to automate this step, and all the steps involved in producing a p2 repository populated with JREs.  This is where I had to learn about Jenkins pipeline scripts.  I'm particularly grateful to MikaĆ«l Barbero for helping me get started with a simple example.  Now I am a pipeline junkie, and of course I had to learn Groovy as well.

In the initial stage, we generate the JREs themselves, and that involves using shell scripts effectively.  I'm not a big fan of shell scripts, but they're a necessary evil.  I authored a single script that produces JREs on all the supported operating systems; one that I can run locally on Windows and on my two virtual boxes as well. The pipeline itself needs to run certain stages on specific agents such that their steps are performed on the appropriate operating system and hardware.  I'm grate to Robert Hilbrich of DLR for supporting JustJ's builds with their organization's resource packs!  He's also been kind enough to be one of our first test guinea pigs building a product with a JustJ JRE.  The initial stage produces a set of JREs.


In the next stage, JREs need to be wrapped into plugins and features to produce a p2 repository via a Maven/Tycho build.  This is a huge amount of boiler plate scaffolding that is error-prone to author and challenging to maintain, especially when providing multiple JRE flavors.  So of course we want to automate the generation of this scaffolding as well.  Naturally if we're going to generate something, we need a model to capture the boiled-down essence of what needs to be generated.  So I whipped together an EMF model and used JET templates to sketch out the scaffolding. With the super cool JET Editor, these are really easy to author and maintain.  This stage is described in the documentation and produces a p2 update site.  The sites are automatically maintained and the index pages are automatically generated.

To author nice documentation I had to learn PHP much better.  It's really quite cool and very powerful, particularly for producing pages with dynamic content.  For example, I used it to implement more flexible browsing support of download.eclipse.org so that one can really see all the files present, even when there is an index.html or index.php in the folder.  In any case, there is now lots of documentation for JustJ to describe everything in detail, and it was authored with the help of PHP scaffolding.

Last but not least, there is an Oomph setup to automate the provisioning of a full development environment along with a tutorial to describe in detail everything in that workspace.  There's no excuse not to contribute.  While authoring this tutorial, I found that creating nice, appropriately-clipped screen captures is super annoying and very time consuming, so I dropped a little goodie into Oomph to make that easier.   You might want to try it. Just add "-Dorg.eclipse.oomph.ui.screenshot=<some-folder-location>" to your eclipse.ini to enable it.  Then, if you hit Ctrl twice quickly, screen captures will be produced immediately based on where your application currently has focus.  If you hit Shift twice quickly, screen captures will be produced after a short delay.  This allows you to bring up a menu from the menu bar, from a toolbar button, or a context menu, and capture that menu.  In all cases, the captures include the "simulated" mouse cursor and starts with the "focus", expanding outward to the full enclosing window.

The bottom line, JustJ generates everything given just a set of URLs to JDKs as input, and it maintains everything automatically.  It even provides an example of how to build a product with an embedded JRE to get you started quickly.  And thanks to some test guinea pigs, we know it really works as advertised.


On the personal front, during this time period, I finished my move to Switzerland.  Getting up early here is a feast for the eyes! The movers were scurrying around my apartment the same days as the 2020-06 release, which was also the same day as one of the Eclipse Board meetings.  That was a little too much to juggle at once!

At this point, I can make anything work and I can make anything that already works work even better. Need help with something?  I'm easy to find...

Friday, November 8, 2019

Getting to the Source

As a Java developer using JDT, no doubt you are intimately familiar with Ctrl-Shift-T to launch the Open Type dialog.  You might not even realize this is a shortcut accessible via the Navigate menu.  So you probably will not have noticed that this menu also contains Open Discovered Type:


Eclipse has a huge variety of open source projects maintained in a bewildering collection of Git repositories.  Many are hosted at Eclipse:
https://git.eclipse.org/c/
Others are hosted at Github:
https://github.com/eclipse/

Finding the Git repository that contains a particular Java class is like finding a needle in a haystack.  This is where Open Discovered Type comes to the rescue.  Once a week, Oomph indexes every *.java file in every Git repository hosted by git.eclipse.org and github.com/eclipse.  The Open Discovered Type dialog loads this information to populate a tree view of all these packages and classes.


Please read the help information the first time you use it.  It was written to help you get the most out of this dialog.  Also be patient the first time you launch the dialog; there's a lot of information to download.

Suffice to say, you can use the dialog much like you do Open Type.  So here we search for JavaCore and discover all the classes with that name:


We can select any one of them and discover all the Git repositories containing that class and we can use the context menu for each link for each repository or for the specific file in that repository to open the link where we want it opened.  From that link, you can of course see the full history of the repository or specific file.

As a bonus, if this repository provides an Oomph setup, you can easily use that Oomph setup to import the sources for this project into your workspace. If there is no Oomph setup, you'll have to do that manually.

In any case, contributing to Eclipse open source projects has never been easier.

Thursday, August 29, 2019

And Now for Something Completely Different

It's been 5 years since I last blogged, so I had to delete 500 SPAM posts when getting started again.  Much has happened over the past years, some of them not so great. When you start to get old like me, you must deal with the older generation gradually passing on and health problems, such as coronary re-plumbing, can become an ugly fact of life.


I've been working with itemis for the past 11 years, but that now draws to a close.  I wish to thank them for their generous support over all these years.  Many of you might thank them as well because much of what I've contributed is thanks to their funding.  Though admittedly I have the nasty habit of working like a maniac, beyond any reasonable number of working hours, regardless of whether or not there is financial reward.  Cool things are just so compelling. But the worst habit then is not bothering to document or advertise all these cool new features as they become available, but rather to dive into the next obsession because somehow that's more compelling.  Compulsion is a bit of a Merks' family trait, e.g., my sister has more than 20 dogs, though it's easy to lose count...

In any case, most of my obsession over the last year has been related to working with Airbus.  I don't normally talk about my customers, but given they were gracious enough to allow me to demo at last year's EclipseCon the software being developed at Airbus, it's common knowledge anyway.  My goodness but that was a creative and cool project! Unfortunately that too has, as is the case for all good things, come to an end.

I immediately dove into generating a quality report for the Eclipse SimRel p2 repository; there's no rest for the wicked nor for the compelled.  I used EMF's Java Emitter Templates (JET) for implementing that, just as I did for generating the full site information for  EMF's Update Sites  as part of migrating the build to Maven/Tycho.

Speaking of which, did you know that you can make it trivially easy for your contributors to set up a development environment? Just have a look at EMF' build page.  Also, did you know that there exists such a thing for the complete Eclipse Platform SDK as well? Of course not, because I never bothered to tell you!

What's really supergeil (yes, I live in Germany and speak fluent Denglish) about the installing an environment with the full Platform SDK, or some subset there of, is that you can easily see all the Git history of each source file, so you can see what exactly has changed and evolved.  Also, when developing new applications, you can easily search for how the Platform implements those things; then you can snarf and barf out your own solutions, with all due respect for the EPL of course.  You can even find out all the places that a constant is actually used; you cannot do that against binaries because constants get in-lined.  Also, if you see some label in the IDE, you can search for where it comes from, some *.properties file somewhere no doubt, and then you will know the name of that property and can easily find where that's defined and how that's used in the code.  You might even contribute fixes via Gerrit commits!

But I digress.  I was using JET to generate a nice helpful web page with information about all the problems in the SimRel repo, or in any arbitrary repo actually, i.e., invalid licenses, unsigned content, missing pack200 files, duplicate bundles, inappropriate providers, and so on. But then I got frustrated that JET templates eventually get really hard to read, especially as they become more complicated.  Then, when you need it the most, all the nice features of JDT are missing while editing the scriplets and expressions in that template. So as I am wont to do, I digressed further and spent the better part of the last two months working on a rich editor for JET.  I'm sorry (not!) that I had to violate a few API rules to do so, but alas, API rights activists is a topic for another blog because that's a long digression.  The good thing is that the JET editor is finished now; it will be in 2019-09's M3.  Here's a sneak preview:


Yes, that's content assist, just is if were in a real Java editor! Not only that, this time I wrote documentation for it in EMF's doc bundle. And, to top that off with icing, this time I blog about it.  Perhaps only three people in the world will ever use it, but I am one of those three people and I love it and I need it even for working with EMF's code generation templates too. So now I can pop this off my digression stack and go back to generating that p2 repo quality report.  I've been doing that for the past week, and it's almost ready for prime-time.

But then at this point, I must ask myself, where is the financial gain in all this?  My local neighborhood fox, I've named him Fergus,  might be trying to tell me something.



Perhaps you should be a little more sly.  Perhaps the endless free goodness too must come to an end...

Monday, October 6, 2014

A Floor Wax or a Dessert Topping?

For those as old as I am and as influenced by American culture as most Canadians certainly are, the question "Is it a floor wax or a dessert topping?" likely rings a bell. Unfortunately, because the internet aims to curb the exchange cultural media—I use the term "cultural media" loosely in this case—you likely can't watch the video via that Wikipedia link where you live, but there are alternatives, thanks to the wonders of Google search. How could modern society, and effective software developers, function without Google?  It makes a guy dizzy just to think about it!


I bring this floor wax verses dessert topping question up because EclipseCon is just around the corner.  Like a floor wax, it's a valuable utility, in this case for learning cool new things and for interacting with experts and other like-minded people. Yet like a dessert topping, it's fun, because of the social events, and fattening, because the food is so good. I'm certainly excited to attend yet another EclipseCon. Barring death or disease, I wouldn't miss it! I've been to every EclipseCon and Eclipse Summit, except one.

Eike and I will be presenting Oomph, which is like a floor wax—reducing hours of tedious work to several minutes of automation— and like a dessert topping—recording your preferences and propagating them to all your workspaces.  Perhaps the latter feature isn't even technically a dessert topping, not if you consider the top reasons why some people hate Eclipse. In particular, consider how many of those reasons relate to issues that are addressed by appropriate preferences. Of course that leads to an endless debate about what's the best default preference, i.e., surely no one wants to use Cp1252 as their default workspace encoding. We intend to address this issue with Oomph, so come to our talk and find out about the grand things that are in store.


The biggest problem with Oomph right now is documentation.  Which self-respecting developer wants to spend time on that?  Not only is it a motivation issue, authoring help-center documentation is beyond horrible. So, being tool smiths and OCD, we've worked on making that much easier.  The basic idea is that the documentation is authored as Javadoc, with numerous doclet extensions. It is processed to generate the help center HTML. The overall processing includes a preprocessor phase to produce model diagrams, screen captures, Java snippets, XML snippets, and even tree views complete with their associated properties view.  All this makes the author's life simpler and the end result is way beyond cool. In particular, have a look at the Setup Resources section; this link is likely to change in the coming days when we refactor the documentation using JDT.

Not only have I been busy with these Oomph-related things, Xcore has some dramatic performance improvements in the latest Luna service release thanks in large part to my itemis colleague, Stefan Oehme, a member of the world-renowned Xtext team. And of course there was the usual service and support work associated with EMF itself, but everyone takes that for granted. I also want to thank Jonas for revamping the embarrassingly outdated Modeling home page along with EMF's home page. It's hard to keep up with all these driving factors, but it's definitely better than being bored!

I hope to see you in Ludwigsburg at the end of the month.  Feel free to test my much-improved German skills!  Though be prepared to hear me complain about the complexities of German grammar. Sollte das ein das, ein die, oder ein der sein? Translated literally to the pointless question, should that a the, a the, or a the be?  Note the three gender articles and dangling verb. Don't expect to get the point of a German sentence until you get to the very end.

Friday, February 14, 2014

Shoes for the Shoemaker

We shoemakers are typically so busy making shoes for others that we and our children are often out and about in shoddy shoes if not barefoot. There is also a strong tendency in the wider Eclipse community to find fault without taking action, looking instead to others to magically fix problems while feeling entitled to "motivate" those actions with poisonous complaints. We should consider carefully what's wrong with this picture.

Consider for example the all-important Eclipse Platform project and the perennial concern about the limited contributions it receives.  Of course this same concern extends to all projectswe'd all love high-quality contributions associated with each and every Bugzilla reportbut let's just take the platform as a case in point.  Suppose you would like to provision an IDE for working with the platform SDK source so you can commit your bug fixes to Gerrit.  All you need to do to get started is follow a few simple steps.

That's right, in the modern age of integrated development environments, you're expected to act as an interpreter for converting human language scripts into machine operations.  Does that not strike you as completely anachronistic?  Of course you're likely already doing this each time you provision an IDE to work on your own project, and you likely don't keep up with the release train milestones because it's a royal pain to do all this work each time there's a new version.

This whole problem irritates me to the extreme, not so much the platform's specific problem, but the fact that I have the same problem for EMF and for every project I use and to which I wish to contribute.  Just so you don't think I'm throwing bricks at the platform, have a look into my glass house, in particular at the extremely lovely analog of the platform's wiki page for setting up EMF's source. Good luck getting that to work!  What that heck is CVS? 

Not only is it anachronistic to follow scripts manually, it's always the case that these scripts become dated and are in need of constant maintenance, which, as busy developers, we don't have time to do.   Compound that with the fact that the scripts are buggy, you should not be surprised that when you treat the community like monkeys, you end up mostly with a lot of hooting.

Oh well, so much for the whining, sniveling, and complaining part, this problem calls for action.  Eike and I, being inherently lazy, don't even want to follow these kinds of scripts ourselves so we've worked on an  alternative approach. Yes, there's still a script for bootstrap purposesyou can help improve itbut here's the synopsis:
  • just as you would any Eclipse package, download the appropriate version of the Eclipse Oomph installerwe need to do some brand marketing instead of just calling it the "Setup tool",
  • unzip it,
  • run it, 
  • select the project you wish to set up, 
  • go for coffee, 
  • and come back to enjoy your fully provisioned IDE along with that fresh cup of Java.
Here's how you'd provision an IDE for working with the platform's SDK:




Here's the end result:


Of course a workspace with the entire Eclipse SDK as source is a bit aggressive, but it's a great proof of concept that it can be done for the entire platform. Be patient though, Rome wasn't built in a day: the platform's code base is very large, so cloning it all takes time, for me more than an hour!  Try a simpler project, like the EMF Core SDK, if you want more immediate gratification, and keep in mind that this would not be any faster if you did it manually.  Note that Oomph was built with EMF.  Did I mention that we're inherently lazy?

It's quite easy to author an executable setup script for your own project.  Here's how the platform's setup script looks:


The platform's script is quite complex because the platform itself is complex. Not only that, there are gotchas to get the platform to build without errors, e.g., an inherent need to install several JREs, which I avoided by changing project-specific preferences to not treat an imperfect JRE match as an error. You can see there are tasks to set global preferences, a task to install additional tools, e.g., the EE profiles feature, tasks to clone the dozens of repos, a task to materialize the target platform, a task to populate reasonable dynamic working sets, and so on.  Unfortunately it's apparently very hard to build all the platform's Ant jars and there appears to be a platform bug that requires an IDE "Restart" followed by a "Build All" before everything builds without errors and with less than 17,000 warnings. Note that the provisioned target platform contains only bundles from Orbit and from Jetty; I have no idea how the Jetty folks provision an IDE to work with source.

Eike and I intend to maintain an index of all Eclipse project setup scripts so that our community of contributors can enjoy one-stop shopping.  In addition, there are already folks looking to maintain indices for other open source forges.

The script-authoring documentation is a work in progress, but of course you can look at all the working examples as a basis for creating your own; remember to turn on "Live Validation" in the editor to catch problems early.  Note that if you provision the CDO Release Engineering environment using Oomph, you'll have all of Oomph's source code and some example scripts at your fingertips.  Contributions to the project are welcome; your changes can be easily committed to Gerrit. If you have questions, please use the EMF newsgroup and prefix the subject line with "[Oomph]". If you find problems, please report a Bugzilla. And finally, if you're so inclined, come see our EclipseCon presentation!

As you might expect, we're not the only ones who recognize the need to solve this vexing problem nor the only ones with a solution for it.  If you need this same type of thing in an enterprise context, you'll want to have a look at the cool features of p3, e.g., carefully managed inside-the-firewall p2 repositories.

As a footnote, it's committer representative election time again.  How will you decide how best to cast your vote given the 4 available choices this year?  Of course you'll want people who actively represent your committer interests at Eclipse, so you might glance at commit stats to see who's actively committing to notice these lines-of-code-committed stats over the past 1, 3, 6, and 9 months:


As a caveat, keep in mind that modeling is a great productivity amplifier!  Not only that, code commits are not the only significant committer activity and are mostly certainly not a good measure of who will best represent your interests.  On that note, I can only promise that, if elected, I'll continue to do my best to make sure Eclipse is a great place to be.  You can definitely count on me to take action where action is needed.

Thursday, April 25, 2013

Modeling: Eclipse Daze at JAX 2013

Eike and I (well, mostly Eike because I'm faul) have organized this year's Eclipse Modeling Day at the JAX conference in Mainz. We hope to see you in Gutenbergsaal 2 on Friday, March 26th, at 9:00AM sharp. Eike will perform feats of magic to entertain you.


We think you'll really enjoy the mix of technology talks from Eclipse project leads and experienced industrial users.

Wednesday, January 16, 2013

Decorating with EMF

I recently added something totally cool to EMF.  It's so cool, you might want to use it even if you don't use EMF for anything else.  You're probably aware that JFace provides tool tip support for column viewers and of course, as a user of JDT, you've likely made extensive use of the Java editor's Javadoc hovers which display HTML-based information that even allows hyperlink navigation.  It's effectively a mini browser.  With the new feature I added, you can easily display HMTL-based hover information in any column viewer. You can see that in action with the sample I created; you'll need the latest build.  It's an RCP application that looks like this:

It displays a simple hand-written file system "model" where the files have links to other files. The hovers allow you to navigate those links within the tree. Note that EMF ships with many fine-grained features, so you need only depend on EMF's Common UI feature to exploit this, i.e., just two very small plug-ins, not the whole EMF runtime.

I used this basic feature to implement improved validation support. You can try this out by enabling Sample Ecore Editor → Live Validation.  With that enabled, whenever you change the model, the tree view will be decorated with validation results.  For example, when you create a new EClass, it won't have a name, and that's invalid.  The hover displays that as follows:

Note that the validation decorations propagate up the tree. The hovers at these higher levels display a composed result which contains links to allow you to navigate directly to any child object with a problem.

Also, the properties view itself is decorated, so a feature with a problematic value will be called out and selecting it provides details in the status line.

Pretty cool hey? And now for the best part: this has all been generated.  So if you'd like to see this type of thing in your own model, just set the GenModel's Editor Decoration property to Live, regenerate the editor, and enjoy the results. Have a look at the underlying infrastructure and let your imagination run wild with creative ideas of your own.

I'd like to thank itemis, the generous sponsor of cool things, for funding this year's "Christmas tree decoration" effort. The benefits will definitely outlast your decorated Christmas tree.