Much ado about scripting, Linux & Eclipse: card subject to change

Showing posts with label pde. Show all posts
Showing posts with label pde. Show all posts

2011-02-02

Visualizing OSGi Dependencies

Yesterday I blogged about how to find dependencies in features on plugins or features using a shell script to rip through feature jars.

But maybe you're less commandline, and more visual? Well, it may be over three years old, but there's a way to visualize plugin interdependencies using Ian Bull's PDE Dependency View. Frankly, I'm amazed this isn't already a core feature in PDE (and correct me if it is).

To use this tool, simply install it from:

http://download.eclipse.org/eclipse/pde/incubator/visualization/site

After installing and restarting, hit CTRL-3 and type "Graph" to find the "Graph Plug-In Dependencies View". (It's also available from Window > Show View > Other... (ALT-SHIFT-Q,Q) under Plug-in Development, if you prefer to kick it old-school.)

Next, right-click in the view or hit the "Focus on" button in the view, and select the plugin on which you want to focus.

Now you can browse up or down through plugins to explore dependencies.

For example, to see what plugins depend on a given plugin, such as org.eclipse.tm.terminal, click the "Show Callers" button in the view.

Or, to see on which plugins org.jboss.ide.eclipe.as.rse.ui depends, click the "Show Callees" button in the view. You can shift-click on nodes to highlight them for emphasis, or click and drag them around.

2010-01-05

PDE Best Practices : A Noob's Guide To Plugin & Build Health

I've drafted a collection of tips for keeping your plugins healthy and your builds green.

Feel free to add to, change, or comment on the list here:

http://wiki.eclipse.org/Common_Build_Infrastructure/Getting_Started/FAQ/Plugin_Health_And_Best_Practices

2009-09-07

Re-Return to Athena

Thanks to Miles for taking the time to slap Athena into submission on his local system - frequent and regular stress testing is what's going to make this facade over PDE bridge the gap between today and the far-flung future (namely B3).

Because he took the time to itemize his concerns / problems / gotchas, I thought I'd take the time to explain why these happen... and which are bugs vs. features. Speaking of bugs and features, Athena has a handy New & Noteworthy wiki page which I update about once a month. If you've never seen the N&N, it's here.

# skipPack=true is useful if you want to test locally. I found that the update manager does not work with pak'd jars when running locally. Perhaps P2 is relying on something on the web server side..?
If p2 isn't properly unpacking pack'd jars, the problem is either: you're using a JDK with pack200 bugs (like Sun 1.6), or you have jars which should never be packed. How can you exclude jars from packing? See JarProcessor Options.
# The build scripts appear to be simply searching for the occurrence of strings to determine wether a given map entry type is being used. They do not appear to respect the comment lines. I guess I should file a bug report on this one -- it cost a bit of time because I have a dodgy SVN setup on my home laptop. I'm actually still not sure what is going on with that (and does the mysterious Java 134 error msg have anything to do with it) but I'm trying to learn not to fix things for which I have a work-around, i.e. if ti works on a different machine, just use that instead!
The purpose of the collectMapTypes task is to simply know what types of maps are being used so that warnings can be echoed to the user if appropriate. If you use SVN on linux, there's a good chance you'll get this message:
[echo] If you get a SIGSEGV or Java Result: 134 when fetching from SVN, remove 
[echo] subversion-javahl and svnkit to force PDE to use commandline svn client.
Why? Because it's a pain in the butt to debug, and at least having a message in the build log gives you some tea leaves to read. I favour documentation over performance in this case.
# There is a somewhat lengthy description at http://wiki.eclipse.org/Common_Build_Infrastructure/Getting_Started of how to setup your local build to use a local cache CVS site but I'm not sure what scenario that would really be helpful in. I just use COPY and it works fine. I suppose that using the CVS approach might excercie some issues that you wouldn't run into with a plain COPY. And I'm not sure wether the local build copies over the binary files or not. If it does, you could get different build results if say your local environment happens to place some artifacts in the copied directories that aren't cleaned out by the PDE build. Not going to worry about it!
A more useful scenario is to take a dump of a CVS, SVN, or Git tree, and point your build at that folder using localSourceCheckoutDir=/path/to/full/source/tree/root in your build.properties file. Then it'll build against that local source cache instead of having to fetch from the repo. Once you have the dump of the repo, from Eclipse do File > Import > Existing projects, and you can have those same projects compilable/editable in your workspace. You can also use Eclipse (eg., with Subversive, Subclipse, eGit) to update the cache before doing a build.
# A useful hack when building locally is to pack up your difficult dependency(s) into a zip file and refer to them in your dependencyURL. It doesn't matter what you use for the URL, because it will use the cached file instead. For example, GEF3D doesn't yet have a build or update site. (We've been collaborating a bit on this so hopefully the build I've got working will help them get one up soon.) So instead of solving the the SVN stuff right away, I put that off until everything else worked. So I created a zip and added an entry for http://download.eclipse.org/tools/gef/fake/gef3d.zip. You have to be careful to have your zip file packaged up correctly or it won't work. That's easy to get wrong..your file structure needs to conform to the standard structure, i.e. eclipse/plugins/some.plugin. On the other hand, you have to be careful to remove these fake dependencies when you begin testing the real fetched versions! The fetch part then fails silently; your build succeeds but using the previously downloaded files.
I generally add comments (TODO, FIXME) in my build.properties to mark temporary hacks, or use a new file, like build.properties.local.hack so I'm not breaking the server-friendly version. (Just make sure you tell build.xml which build.properties file to use, if not the default one -- and DON'T CHECK IN the changed file.)
# But in any case getting the SVN map file right has been a major headache. Again, the only reason I want this is to grab the GEF3D sources, but I can't seem to let this one go as it seems that it should be so easy. The Athena build seems to mangle things in the fetch script; or perhaps this is a PDE Build issue. So I tried the sourceforge style entry and after a couple of hours of fiddling (see below) I found a magic incantation that seems to work -- plugin@org.eclipse.draw3d=SVN,trunk,http://dev.eclipse.org/svnroot/technology/org.eclipse.gef3d,,org.eclipse.draw3d@HEAD
@HEAD is optional; you only need to specify a tag if it's not the HEAD of the branch or trunk. Here's a sample SVN map.
# It would be super nice if there were a built-in dependency analyzer so that one could find the root plugin issues easily. As it is, if you have a bad dependency you get the whole tree and you have to walk the tree by hand to find out the root cause. Overall I think this is another demonstration of the ultimate weakness of the standard build systems out there. They are by nature linear (batch) approaches and so usually you can't do post hoc or inline analysis of issues. There is no semantic information in logs! You end up having to parse them back if you want to do any useful analysis. In a parallel lifetime, I would love to work on a simple semantic logging system that would allow structured analysis of this sort.
I believe the Buckminster guys are doing work in this area, so this may make its way into B3.
# Here is something else that I would love to do given time. The map files are pretty well structured - it would be nice to whip up a quick XText editor that would at least check syntax and more ambitiously provide a mechanism for hooking in semantic checks -- wouldn't it be nice if you could check that that SVN url is correct while editing the map file itself?!
Add that to the wishlist for B3!
# I'm still not sure how Athena determines what goes in the sdk vs. runtime vs. example zips so for now I'm just building the examples manually. Anyone come across documentation for this?
This arbitrary allocation of files is done in common.releng/tools/scripts/buildAllHelper.xml, lines 1063-1097, and is only done if the build.steps entry 'buildZips' is enabled. This behaviour is as far as I'm concerned deprecated, but in place simply to ease transition for existing builds using the old Common Modeling Build to the Athena Common Build. IMHO, no one needs these zips - you only need an update site zip. If you don't like what's in the zips, you can omit the 'buildZips' step and package your own zips by hand, eg:
 <zip destfile="${buildDirectory}/${buildLabel}/${SDKZip}" update="true">
   <zipfileset src="${buildDirectory}/${buildLabel}/${allZip}" dirmode="775" filemode="664" excludes="**/*.pack.gz, **/pack.properties, **/features/*.jar, **/${domainNamespace}.*.all*, **/${domainNamespace}.*.all*/**" />
 </zip>

(For those unfamiliar with the story of the Re-Return, you need to watch HIMYM, S1E15.)

2009-07-24

Athena Common Builder: Thanks to the early adopters!

Here's a quick list of some of the projects @ Eclipse.org currently using Athena. If you haven't tried Athena, maybe it's time!

  1. Linux Tools
  2. Visual Editor (VE)
  3. Voice Tools (VTP)
  4. PDE Declarative Services Modeling Incubator (pde.ds.modeling.incubator)
  5. Nebula Widgets Gallery
  6. Faceted Project Framework (fproj)
  7. EMF Query (EMF MQ)
  8. EMF Validation (EMF VF)
  9. EMF Transaction (EMF MT)
  10. Ajax Tools Framework (ATF)
And @ JBoss.org, all available in JBoss Tools 3.1.0.M2 for Eclipse 3.5 (Galileo) ...
  1. JMX Console
  2. BPEL Editor*
  3. jBPM 3 and 4
  4. FreeMarker
  5. ...to name but a few.

* - will be available in M3 or you can get a nightly build here.

What are people saying about Athena?

"[I] really like the new build. It is much less confusing then the old [Common Modeling] one."

"[C]ongrats for this builder. It is quite good and I'm eager to rely fully on it."

"We are playing around with Athena and finding it really useful. It is already deployed to one of our customer developments. Thanks a lot for the hard work! We will definitely try to contribute back anything useful we will have in the process."

So, how do *you* get started? Here's a FAQ. Here's our New and Noteworthy. And here's all the rest of the knowledge base articles.

Oh, and I'd be remiss if I didn't mention that there's a big list of requested features still waiting for contributions. If you use Athena, you're already half-way to contributing back. Want to help? Drop me a line any time and we can discuss what holes need filling that match your skills and most directly improve your use of PDE, p2 and Athena.

2009-05-26

Dash Athena: Eclipse Common Build System / Running Tests On Your System

Bjorn recently kvetched that Eclipse projects met two or three of those goals, but fell down on the "common build system" and "tests run on your system" [1].

While it's true I've seen a number of projects who don't have, don't run, or don't publish their tests, I'm a little disappointed to see Bjorn's no longer committed to the common build solution we've been working on since September 2006 (in earnest since June 2008). We do have a project to solve both those concerns, but like all things at Eclipse, it's powered by YOU. You want it to happen, you have to help. I'm looking for a few good contributors and committers for the Dash Athena project to supplement the great people we already have. Or, if you don't have time to contribute code, you can help by using the system, testing it, opening bugs, enhancing documentation, and blogging about it.

So, what is Dash Athena?

Well, it's a common build system using Hudson and PDE which can also be run commandline on Linux, Windows or Mac, or in Eclipse. It can produce zips of plugins, features, examples, tests, then run those tests. It can also produce update sites with p2 metadata, which can then be published to eclipse.org (or sourceforge.net, for that matter) so everyone can get your bits via Update.

Tests will currently only run on Linux - if you'd like to help us port to Mac OS X and Windows, please step up. The system works with CVS, SVN, and probably Git/Bzr/Hg too, since it supports building from locally checked-out sources and will copy your features/plugins so they're in the format that PDE requires. It supports source input via map files (soon Project Set Files (*.psf), too!) and binary inputs via zips and p2 repos / update sites.

If you aren't sure how to get started w/ an Athena build, please don't hesitate to ask. If you feel the docs are insufficient, incomplete, or inaccurate, let me know - or better - fix them! Want your own Hudson job to run your build? Just open a bug and we'll set you up.

Oh, and incidentally, the irony is not lost on me that I'm using American iconography above even though 5 of the 6 committers on the project are Canucks. :)

2009-05-25

They're Coming To Make Me Write ASP!


watch video

Remember when you ran away
Big Blue got on their knees
And begged you not to leave
PDE'd go berserk

You left 'em anyhow
And then the days got worse and worse
And now I see you've gone
(Completely out of your mind)

And they're coming to take you away ha-haaa
They're coming to take you away ho ho hee hee ha haaa
To the Redmond farm
Where life is beautiful all the time
And you'll be happy to see those nice young men
In their - see? Sharp coats
And they're coming to take you away ha haaa

We thought it was a joke
And so we laughed
We laughed when you had said
That you could leave the FLOSS and work for Bill

Right? You know we laughed
You heard us laugh. We laughed
We laughed and laughed but still you left
But now we know you're utterly mad

And they're coming to take you away ha haaa
They're coming to take you away ho ho hee hee ha haaa
To the happy home with bugs and Vista and viruses
Security "fixes" which patch and patch and open new hacks and holes
And they're coming to take you away ha haaa

We've read your blogs
And used your code
And this is how you pay us back
For all our kind unselfish, loving deeds?
Ha! Well you just wait
They'll find you yet and when they do
They'll make you write with ASP.net
You well-dressed geek

And they're coming to take you away ha haaa
They're coming to take you away ha haaa ho ho hee hee
To Camp Microserf where life is beautiful all the time
And you'll be happy to drink that nice Kool-Aid
In their clean white cups
And they're coming to take you away

Neuroticfish - They're Coming To Take Me Away

2007-06-23

And Now For Something Completely Different...

Much like Ian's post the other day, I've always wanted to blog that line. Anyway, it's been brought to my attention that of late I've been apparently posting less-than-positive things about Eclipse, so to balance that out, here's my top three cool UI features in Eclipse 3.3, in order from oldest to newest:

#3: Use PDE UI to generate an Ant build.xml script for a plugin project

This has been around for years, true, but it's certainly top on my list of time-savers. Here's a quick HOWTO for taking a plugin and ending up with a versioned, Update Manager-compatible OSGi bundle.

  1. Create, import, or extract a plugin project from CVS.
  2. Right-click the plugin's plugin.xml and select PDE Tools > Create Ant Build File.
  3. Open the Ant view (CTRL-3, Ant or SHIFT-ALT-Q,Q > Ant) then drag the newly-generated build.xml into that view to see all the available targets. It's like the Outline view, but you can launch targets by double-clicking them.
  4. Double-click the build.update.jar target to run that build. You should see a new jar created in the root of your plugin project. (If you don't, select the plugin project's folder in the Package Explorer, Project Explorer, or Navigator view, and hit F5 to refresh.)
  5. You can run other targets, like src.zip to create a source zip, or edit them to suit your needs. If you delete the build.xml you can always regenerate it from the latest template.

#2: Use Package Explorer + Working Sets + Filters to clean up your view

I've been using these for at least a year by now, but only recently discovered that they behave differently in the Package Explorer than in the other filesystem views, like Navigator and Project Explorer. The best by far, for me, is the way the Package Explorer does things. Here's a shot of how one of my rather project-heavy workspaces looks in the Navigator view, compared to the Package Explorer with Working Sets set as my Top Level Elements:

To make this work, open the Package Explorer view, then click the menu icon (an arrow pointing down in the top right corner of the view -- I'll just call it Menu for simplicity). Here's a few things you can do to alter your view:
  • Toggle Working Sets / Projects:
    Menu > Top Level Elements > {Working Sets | Projects}
  • Select what Working Set(s) to show (when TLE = Projects):
    Menu > Top Level Elements > Projects, then
    Menu > Select Working Sets...
  • Select, create, edit, or delete Working Sets (when TLE = Working Sets):
    Menu > Top Level Elements > Working Sets, then
    Menu > Configure Working Sets...
  • Hide closed projects, empty packages, libraries, non-Java files, etc.:
    Menu > Filters

#1: Use Autopin UI Tweaklet to manage open editor tabs

This is my most recent discovery, and once you get used to it, a great new way to manage editor tabs.

First, download & install the Tweaklet plugin(s) from either the Platform UI Incubator downloads or updates site.

Then, marvel as a whole new way of working with tabs is revealed: you only ever have one tab in use until you start editing that file. When you do, the Autopin tweaklet automatically pins the tab, and subsequent files are opened in a second one, then a third, and so on.

Like Working Sets, this is also fantastic when dealing with massive workspaces or when you have a lot of files that reference other files. Eg., when drilling down from one Java class into another and into another to find the method you need, or for PHP scripts that include() or require() others, again, looking for methods or variable declarations, or even in concert with the full-text search (CTRL-H, first tab) to find that elusive build-related metafile which needs to be fixed, without ending up with 20 open files. Kick ass.

The bottom line here is that there's lots of hidden features in Eclipse to make your life easier and your work more efficient. And because we all work a little differently, there's lots of ways to tweak the way the UI behaves to accomodate all our differences. Eclipse is you? Aye!

2007-06-19

Thirteenth Step

Ye gods. As of last week, my little release engineering world is responsible for a total of 13 builds, with two more on the way. Time to crank up a little APC and have a quick look back...

  1. 1Q2004: pre-PDE build system migrated to PDE thanks to Marcelo Paternostro.
  2. 2Q2004: EMF 2.0 released, using Eclipse 3.0 releng.basebuilder. [Builds/branches/codebases: 1/1/1]
  3. 2Q2004: UML2 1.0 released, using cloned/simplified version of EMF builder. [2/2/2]
  4. 2Q2005: EMF 2.1 released, updated to Eclipse 3.1 builder. [2/3/2]
  5. 2Q2005: UML2 1.1 released. [2/4/2]
  6. 3Q2005-4Q2005: EMF 2.2 and UML2 2.0 start development, adding two new branches.[2/6/2]
  7. 4Q2005: first EMF Technologies project starts releasing builds, just before Xmas. Before long, the infant project has crossed the Rubicon, with 4 components: OCL, Query, Validation, and Transaction. [Builds/branches/codebases: 6/10/3]
  8. 1Q2006: EODM and JET join the EMFT party, solidifying the 'cross-project' nature of the EMFT build. 8 different builds supported by 3 code bases, across 1 to 3 active CVS branches. [8/12/3]
  9. 2Q2006: JET Editor, Net4j, and CDO are added to EMFT, and begin releasing builds. Callisto released, including EMF 2.2. Also along for the ride as part of GMF are OCL 1.0 and QTV 1.0 (Query, Transaction, Validation). System updated to use 3.2 basebuilder. [11/15/3]
  10. 3Q2006: Teneo joins EMFT. [12/16/3]
  11. 4Q2006: EMF, UML2, OCL, QTV (3) and JET/JET Editor (2) start work on new branches, in time for M3. Common Modeling Build started, adding new MDT component UML2 Tools. System updated to use 3.3 basebuilder. [13/25/4]
  12. 1Q2007: EODM branches for M4. [13/26/4]
  13. 2Q2007: EODM, OCL, QTV, UML2, JET & JET Editor migrated to Modeling Build and moved into EMF, MDT and M2T websites, making the old UML2 build obsolete and merging the old JET and JET Editor builds into a single website/build. EMF Compare build added to new Modeling.EMFT build. Common Modeling Build now supports multiple branches (Eclipse 3.2/3.3) and nine different component builds (across 4 different projects: EMF, EMFT, MDT, M2T), with varying numbers of upstream dependencies (from 1 to 9) & support for bundling or build-time use of 3rd party code (Orbit and non-Orbit). Original EMF build that started it all supports 4 branches and several non-JUnit test types. Three semi-dormant Technology.EMFT projects left to migrate (Teneo, CDO, Net4j). [Builds/branches/codebases: 13/27/3]

And there's so much still to do! No wonder I'm so tired these days...

2007-06-12

That Ol' PDE Black Magic

... or more reasons why features still suck.

In the past 24hrs, I've encountered two feature-related PDE issues, which I think warrant discussion as they are, to the uninitiated, seemingly black magic. The first of these was discovered and fixed last night while watching The Dresden Files in ten-minute chunks while waiting for builds to complete, but I'm sure that's just a coincidence.

Bug The Firste: feature.xml should not specify version numbers when including required plugins like org.eclipse.test [192231].

This issue manifests when your build stops working one day and complains, "eclipse/test.assembly/eclipse/plugins/${org.eclipse.test} not found." The fix is simple: make sure you set version="0.0.0" in your feature.xml when including org.eclipse.test or other plugins referenced in your map file and required by your build. See also Build Problems.

Bug The Seconde: PDE will build features in the order they're listed in feature.xml [192292].

This issue manifests when your source feature, for example, builds OK but contains no source because PDE is building it BEFORE your runtime feature(s). Once again, the fix is simple. You just have to reorder your feature.xml to put your source feature(s) last.

Bug The Thirde (Bonus Bug!): If your plugin or feature doesn't have the right Nature and Builder in its .project file, it won't behave the way you'd expect [192247] in Eclipse.

This one's a no-brainer, but also a handy tip when working with PDE. If your plugin project doesn't have the Plugin nature, you can't open a MANIFEST.MF file with the Manifest Editor; if your feature doesn't have the Feature nature, PDE won't give you warnings/errors if your feature is misconfigured (eg., if you have a version set to "o.o.o" instead of "0.0.0"). Just add something like this:

<buildSpec>
  <buildCommand>
    <name>org.eclipse.pde.FeatureBuilder</name>
    <arguments/>
  </buildCommand>
</buildSpec>
<natures>
  <nature>org.eclipse.pde.FeatureNature</nature>
</natures>

2007-05-11

Happiness in Codeslavery

Oh. My. God. It's over. Bug 106804, "rearrange the features to minimize external dependencies", is finally done. It's been quite the ride, as you can see in the bug. The last three days are a blur, but it's done. Marcelo and I have been fighting the good fight solidly from Tuesday until this morning to contain this change in time for the M7 + 1 deadline. Thanks to the PDE folks for providing invaluable assistance in deciding what paths to take. Pascal, Kim, Sonia, Andrew: you guys rock. Thanks also to everyone else I've bugged with 'have you ever done this with your features / does your project do this?' questions to determine if we were treading into impossible territory or following an existing path.

EMF now contains smaller features which can be installed via Update Manager to compose whatever legal combination you want. Thanks to Update Manager finally working with features' dependencies on plugins, you can use PDE to generate a feature's dependencies and have the Update Site actually work when you hit 'Select Required' to pick up all the associated required features and their contained plugins. (You have no idea how freakin' exciting this, and how long I've been waiting for this to work.) I still think features suck, but for now I'll allow that they suck a little less than last week.

So, here's the obligatory shout-out to the community to try out EMF 2.3.0M7, and let us know any issues you might have w/ migration & adoption. You can grab it from the usual places. Please don't hesitate to speak up in bug 106804: if there are any unforeseen migration pains, I'll use your comments to draft documentation explaining what's different, why, and how to roll with the changes next week after I've slept a little.

Thanks, everyone, and happy EMF'ing.