Discovering the P2 APIs at EclipseCon 2011

When I entered, I got handed over a nice « I love P2 » and a « I Love Tycho shirt » along with a Maven book by Sonatype staff ! pretty warm welcome !

Pascal started his presentation giving the history of P2, that he described as the only provisioning system for Equinox

  • 3.4/3.5 provisional api
  • 3.6 (Helios) first official release
  • 3.7 (Indigo) full backward release

What’s  new in 3.7 ?

  • API : new features to use the consumption, simplification for RCP use case, simpler headless API for simple cases (Even simple things were complex !)
  • SPI : pluggable transport (SAP needs, they target a P2 runtime less than a 1MB)
  • Memory code improvement, inter process locking of local repositories

3 level of APIs :

  • graphical API : SWT based, designed to be used in RCP applications (few dialogs and wizards that you can found in Eclipse update dialogs) ; use org.eclipse.equinox.p2.rcp.feature : you include that in your product and you’re done (it will include org.eclipse.equinox.p2.ui.sdk bundle) this approach was chosen because it was too complicated to the user to build his UI from « toothpicks »; tweaking the API is also made available ; and there is also an extension/ discovery UI (org.eclipse.equinox.p2.discovery, Pascal is proud of the icons work ;-) ) but API is not provided for this one
  • headless operations : minimal headless P2 , via p2.core.feature enough to install/update/uninstall , you can find it from 3.7 M6 (you can still do smaller for specific use cases); headless operations : org.eclipse.equinox.p2.operations; Pascal then presented a demo plugin that uses this operation API : 4 lines of code to install a new plugin ! (compared to more that 20 before)
  • core APIs and SPIs : Installable Unit, Profile, ProvisiongAgent… you do not need to know everything anymore, since the high level operations encapsulate the P2 complexity; what is not API ? the p2 folder and the repository serialized format : don’t mess with those !