From build to assembly to deployment:
Using p2 to facilitate agile software
development


                    Kim Moir, IB...
About us

• Kim Moir is the Release Engineering lead for the Eclipse and
  RT Equinox projects, and works in the IBM Ottaw...
What about you?

• How do you use p2?
• What are you looking to get out of this tutorial?
• Are your building products bas...
Agile Software Development




• Key characteristic of agile software development includes Fast
  Cycle Time:
  •   Includ...
Overview

• How can p2 be used to manage your update strategy?
  •   Update your RCP and OSGi applications
  •   Provide a...
Outline

• Overview of p2
  • p2 architecture and terminology
  • Anatomy of a repository
  • Using the director and publi...
Hands-on exercises

  • Building and assembling different configurations of your
    application
  • Building and publishi...
A brief history of Eclipse

• When Eclipse starts, the plug-ins are scanned and
  functionality is discovered

  • If a de...
Unzipping is not Installing




                   Copyright © IBM Corp., EclipseSource 2010. All rights reserved. License...
What is p2 – p2 is Installing!

• A replacement for the old update manager
  •   New UI, simplified workflow
  •   Manage ...
What does p2 enable?

• An extensible provisioning platform for OSGiTM systems which
  provides
  •   Installation
  •   S...
What p2 isn’t

• An end to end build system
• PDE build provides tooling to generate p2 repositories when
  building bundl...
What can you build with p2?

•   Add-on manager for RCP applications
•   Installers
•   Configuration Management Systems
•...
Who needs to provision?


          Engineers                                                                 Users




  ...
p2 is for more than just bundles

• p2 can provision
  •   OSGiTM bundles
  •   Executables
  •   Configuration files – fo...
Where’s p2 ?




               Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
p2 terminology

• Artifacts is actual content being installed (bytes)
• Metadata consist of Installable units (IUs) that d...
Decouple decision making from the actual content




                                         IU
                         ...
Anatomy of an IU, more

• Update description
   • This allows to control of
     • IU is being updated org.eclipse.osgi_3....
Anatomy of an IU, requirements / capabilities

• Capabilities and requirements are the mechanism by which an IU
  express ...
Separation of concerns

•   Installable Unit
    •   Exists independently of the repository


•   Metadata Repository
    ...
Artifacts

• Bytes/content to be installed
• Any form
  • JARs (e.g., bundles, features, …)‫‏‬
  • Binary executables
  • ...
Repositories

• Defined as an interface, IRepository
• No serialization format assumed
• All repositories have
  • Identit...
Metadata Repository

• Defined as an interface, IMetadataRepository

• Add/remove installable units
• Add references to ot...
Artifact Repository

• Defined as an interface, IArtifactRepository



• Add/remove descriptors
• Access artifacts by desc...
p2 architecture

   Metadata                                                                                       Artifac...
p2 architecture


                                          Metadata                        Data transfer
                ...
Disk layout




                                                 Configuration area

                                     ...
Disk layout

• Simple configurator provides the OSGi framework the list
  of bundles to run.
• The information stored in b...
Disk layout




                                                      Download cache, where non-eclipse
                  ...
A p2 profile

• A profile contains
  • Properties defining the “environment” such as os, ws, arch,
    install location, b...
Changing a profile

• A profile is usually created during the initial installation
• It is changed by provisioning operati...
Our example: Hyperbola

• RCP chat client application from the RCP book
  http://eclipsercp.org
• We’ll be building this a...
Tutorial requirements

• Eclipse 3.6M6
  http://download.eclipse.org/eclipse/downloads/drops/S-
  3.6M6-201003121448
• >= ...
Installing the tutorial code

• Start Eclipse 3.6M6
  with a clean workspace
• The samples.zip
  contains the repository
 ...
Introduction to the sample manager




                 Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Li...
Exercise 1 – Target Platforms

•   Two large bodies of artifacts make-up your software system
    1. The code you write
  ...
Exercise 1 – Target Platforms

• PDE provides facilities to help you manage your target
• We don’t need JDT or PDE in our ...
Create a target platform




• Window -> preferences -> Plugin development -> Target
  platform
• Add Empty Target
• Selec...
Exercise 2 – Adding a little p2




• Reusing the Eclipse SDK UI
  • Reusing the UI in its entirety is easy
  • A variety ...
Versioning

• Every IU has the following identifiers
• Major.minor.service.qualifier
• 3.6.0.v20100129
  •   Major – break...
Configure the UI




                   Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL...
Include the p2 bundles




• We have provided a simple p2 feature that includes everything you need
• Simply add the featu...
Add the feature and launch




                 Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed u...
A Variety of Options

• Use the p2 API to create your
  own update UI
• Reuse the existing p2 UI in its
  entirety
• Custo...
Customizing the UI




                     Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under...
Eclipse 3.6 – New UI Options
    Simplifying update and extension install for RCP applications


                         ...
Exercise 3 – Product Builds




• Using PDE/Build to create p2 enabled products


                    Copyright © IBM Corp...
pde build

• PDE build generates Ant scripts based on the inputs that your
  provide to the build.
• These Ant scripts are...
Enabling p2 in your build

• Options to enable in your feature or product build’s
  build.properties
• p2.gathering=true
 ...
Enabling p2 in your build

• p2.build.repo
  • Default value is file:${buildDirectory}/buildRepo
  • Build time repository...
Product builds

• Eclipse bundles + custom branding
  • Platform specific options for VM args, program arguments
  • Speci...
Creating a builder
                 Create a builder with a top level build.properties file:

# Product and packaging cont...
Running the Builder

•   Create ${buildDirectory}.
•   Create ${buildDirectory}/plugins.
•   Create ${buildDirectory}/feat...
Running the Builder




                  Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under E...
Building SDKs

• Software developer kits provide
   •   Binaries
   •   Source
   •   Documentation
• SDK features
   •   ...
Exercise 4




•   Creating a Voice Over IP feature
•   Export from the workspace
•   Install the add-on using the UI
•   ...
Feature builds

• Features are collections of bundles with related functionality.
  Example org.eclipse.pde feature




  ...
Update your target

• Add on providers don’t have access to your SCM
• Add on providers don’t want access to your SCM

• A...
Update your target




                 Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL...
Update your target




                 Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL...
Categories

• If features are not categorized they will not show up
• Most developers worry about the producers version of...
Voice Chat

• Exercise 4 contains a simple
  VoIP feature
• Integrates with Hyperbola to
  add voice chat
• Load the code ...
Installing the feature

• We all know how to install the feature using the UI

                                           ...
director




                                             • Invoke provisioning
                                          ...
Director app from within IDE




Install pde
feature into new
directory

                   Copyright © IBM Corp., Eclipse...
director example



  d:buildereclipsec.exe -application
  org.eclipse.equinox.p2.director
  –metadataRepository http://do...
Voice Over IP




                Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
The p2 UI




            Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
Exercise 5 – Feature builds




                  Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed...
Adding the voice feature

• Like product builds, PDE supports building features
• We just want a repository to represent o...
Feature build.properties

# Feature identification                                   # SCM Access control
topLevelElementT...
Running the build

•   Create ${buildDirectory}
•   Create ${buildDirectory}/plugins.
•   Create ${buildDirectory}/feature...
Running the build




                    Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under E...
Exercise 6




• Automatically update Hyperbola each time it starts



                    Copyright © IBM Corp., EclipseS...
How to update

• Two ways to update
  •    Look at all the IUs in your Profile
  •    See if there are any “updates” avail...
Update on startup




                    Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under E...
Operation API

• We have a much simpler API for the basic use case
  • Pre-canned Operations for Update, Install, Uninstal...
Setting your repositories

• You likely want a pre-canned set of repositories to check
• You can use a p2.inf file to supp...
Exercise

• Setup hyperbola to auto update itself on startup.
• Make some changes, rebuild, and continually update




   ...
Metadata is immutable


 Reuse metadata




                                      to create subsets of functionality
     ...
Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
p2.repository.repo2runnable




Specify source and destination


                        Copyright © IBM Corp., EclipseSou...
repo2runnable

• Transforms features and bundles into their installed form
• For example, bundles that are in folder forma...
Mirroring is slicing




               Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL...
Mirroring repositories with p2

• Mirror a repository or a subset of the IUs to a new location
• Separate applications to ...
p2.metadata.repository.mirrorApplication




Specify source and destination

                       Copyright © IBM Corp.,...
p2.artifact.repository.mirrorApplication




                                                      Specify source and dest...
Exercise: Mirroring a Hyperbola subset

• Use the metadata and artifact repository mirroring tools to
  mirror a subset of...
One of these bundles is not like the other




Bundle id + version = one set of bytes
               Copyright © IBM Corp....
Consistent bundles with a comparator

• If you use a different compiler to compile the same source,
  it’s not necessarily...
Composite repositories

• Delineate artifacts and metadata into child repos
      compositeArtifacts.jar
      compositeCo...
get involved

•   p2 in the wiki http://wiki.eclipse.org/P2
•   p2 mailing list p2-dev@eclipse.org
•   IRC #equinox-dev
• ...
References

• Version numbering http://wiki.eclipse.org/Version_Numbering
• 2009 EclipseCon p2 tutorial
  http://www.slide...
Photo credits

• Orange and knife by Safari11
  http://www.sxc.hu/browse.phtml?f=view&id=983682
• Oranges by Stephanie Ber...
Legal notice

•   Copyright © IBM Corp., 2007-2010. All rights reserved. This presentation
    and the source code in it a...
Extra slides




               Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
p2.mirror Ant task

• Allows you to mirror artifacts and metadata simultaneously
• Filter by platform and specify IUs

<p2...
remove.iu Ant task

• Remove IUs from the repository

• Remove all packed jars from a repo

<p2.remove.iu>
   <repository ...
p2.composite.{artifact|metadata}.repository

• Create composite artifact and metadata repositories
<p2.composite.artifact....
Repository management best practices

•   Implement composite repositories
•   Use repository tools to modify the contents...
publisher

• The p2 publisher was integrated into pde build in 3.5M5.
• Features and bundles are gathered from source and ...
p2 and agile software development


                                 Develop




                          p2 repository
 ...
Upcoming SlideShare
Loading in...5
×

P2 Introduction

14,645

Published on

An overview of the Equinox Provisioning Platform (p2).

Published in: Technology
1 Comment
29 Likes
Statistics
Notes
No Downloads
Views
Total Views
14,645
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
0
Comments
1
Likes
29
Embeds 0
No embeds

No notes for slide

Transcript of "P2 Introduction"

  1. 1. From build to assembly to deployment: Using p2 to facilitate agile software development Kim Moir, IBM Ian Bull, EclipseSource Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  2. 2. About us • Kim Moir is the Release Engineering lead for the Eclipse and RT Equinox projects, and works in the IBM Ottawa Lab. She uses p2 to provision builds for 13 platforms. • Ian Bull works on a number of Eclipse projects, including p2, Zest and the PDE Incubator. Ian works at EclipseSource as a software engineer. Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  3. 3. What about you? • How do you use p2? • What are you looking to get out of this tutorial? • Are your building products based on p2? Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  4. 4. Agile Software Development • Key characteristic of agile software development includes Fast Cycle Time: • Include your customers in the development process • Ensure your customers are continually using the latest software • Ensure your developers are building against the latest software Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  5. 5. Overview • How can p2 be used to manage your update strategy? • Update your RCP and OSGi applications • Provide a mechanism to install and manage new features • Provide a mechanism to manage different configurations • Manage your developers target platforms Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  6. 6. Outline • Overview of p2 • p2 architecture and terminology • Anatomy of a repository • Using the director and publisher • Product based builds with p2 • Repository management best practices • Assembling products out of pre-existing components (no compiling) Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  7. 7. Hands-on exercises • Building and assembling different configurations of your application • Building and publishing add-on bundles • Export or build your product to a repository, and then install the product from the repository you just created. • Using repository tools such as the slicer, repo2runnable or mirror to build smaller components from existing repositories Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  8. 8. A brief history of Eclipse • When Eclipse starts, the plug-ins are scanned and functionality is discovered • If a dependency is missing, all the dependent plug-ins simply fail to start • Old plug-ins pollute the application • You cannot update resources, licenses, executables or the framework itself Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  9. 9. Unzipping is not Installing Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  10. 10. What is p2 – p2 is Installing! • A replacement for the old update manager • New UI, simplified workflow • Manage Eclipse, RCP and more (exe, ini, bundles, registry keys, …) • Shared bundles across Eclipse-based products • An installer TM • A provisioning platform for OSGi systems (in progress) • Managing non-running instance • Start level, framework extension • Fine-grained dependency management Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  11. 11. What does p2 enable? • An extensible provisioning platform for OSGiTM systems which provides • Installation • Searching for updates • Rollback • Dependency management • Policy control • UI or headless Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  12. 12. What p2 isn’t • An end to end build system • PDE build provides tooling to generate p2 repositories when building bundles • A product – the eclipse community builds the products! Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  13. 13. What can you build with p2? • Add-on manager for RCP applications • Installers • Configuration Management Systems • Self updating applications • Install -> Update -> Roll back scenarios • etc… Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  14. 14. Who needs to provision? Engineers Users source code applications open source tools in-house built runtimes licensed software Automated Builds Test Test Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  15. 15. p2 is for more than just bundles • p2 can provision • OSGiTM bundles • Executables • Configuration files – for instance eclipse.ini and config.ini • Registry keys • Native code • Also supports bundle pooling – sharing bundles across multiple installs Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  16. 16. Where’s p2 ? Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  17. 17. p2 terminology • Artifacts is actual content being installed (bytes) • Metadata consist of Installable units (IUs) that describes the content that can be installed Person Artifact IU Name: org.eclipse.gumby Version:3.6.0.v20100321 Requirements: org.eclipse.pokey Provided capabilities: org.eclipse.bendy Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  18. 18. Decouple decision making from the actual content IU (id, ver) Everything is an IU Everything is installable It is also referred to as “metadata” Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  19. 19. Anatomy of an IU, more • Update description • This allows to control of • IU is being updated org.eclipse.osgi_3.5.1 _v20090827 • IU to update it to org.eclipse.osgi_3.5.2_v20100126 • Applicability filter • This allows for an IU to express when it is only applicable to a particular environment. • Example platform specific filters for swt fragments (x86,linux,gtk) Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  20. 20. Anatomy of an IU, requirements / capabilities • Capabilities and requirements are the mechanism by which an IU express what it provides and what needs. • A capability is composed of a: • Namespace (string), name (string) and version • A requirement is composed of a query by default: • Namespace, name and version range • Namespace, name and version are open ended. • The requirements and capabilities expressed by IUs can be arbitrary and don’t have to all be in the same namespace. • Resources – RPMs, .exes, docs, … • Virtual – if you can define a capability, I can depend on it Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  21. 21. Separation of concerns • Installable Unit • Exists independently of the repository • Metadata Repository • Store only Installable Units • Artifact Repository • Store only Artifacts Metadata Artifacts Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  22. 22. Artifacts • Bytes/content to be installed • Any form • JARs (e.g., bundles, features, …)‫‏‬ • Binary executables • RPM, MSI, … • Defined, maintained, loaded and used separately from the metadata Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  23. 23. Repositories • Defined as an interface, IRepository • No serialization format assumed • All repositories have • Identity • Version • Description • Repos can be queried • Allows for delayed loading • Captures standard questions Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  24. 24. Metadata Repository • Defined as an interface, IMetadataRepository • Add/remove installable units • Add references to other repos • Created by factories • Looked up in an IMetadataRepositoryManager service Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  25. 25. Artifact Repository • Defined as an interface, IArtifactRepository • Add/remove descriptors • Access artifacts by descriptor • Created by factories • Looked up in an IArtifactRepositoryManager service Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  26. 26. p2 architecture Metadata Artifacts Director Repositories Runtimes Engine Touchpoints Profiles Eclipse Eclipse Classic Other Eclipse OS for C++ Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  27. 27. p2 architecture Metadata Data transfer fetched and constraints Director analyzed Transports Http/Https File system Volume Mirroring Provisioning operation Repositories requested p2 IU install, Update Site uninstall, update operations Engine Artifact availability and mirroring Eclipse/OSGi Native/OS IUs configured Profile updated into runtimes Runtimes Profiles Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  28. 28. Disk layout Configuration area p2 data area Artifact repository index. This allows the plug-ins to be served to other instances. Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  29. 29. Disk layout • Simple configurator provides the OSGi framework the list of bundles to run. • The information stored in bundles.info is • Location, id, version, start level, started state Configuration area Simple configurator data Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  30. 30. Disk layout Download cache, where non-eclipse pieces are mirrored before being installed. Profile registry Storage for the profile MailApp.profile Lock file created when the profile is being modified Current and previous state of the system Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  31. 31. A p2 profile • A profile contains • Properties defining the “environment” such as os, ws, arch, install location, bundle pool location • The list of IUs • Properties associated with each IUs • Profiles are held by a profile registry • A profile registry can hold on to several profiles Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  32. 32. Changing a profile • A profile is usually created during the initial installation • It is changed by provisioning operations performed using: • The director application • The UI • The API • … Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  33. 33. Our example: Hyperbola • RCP chat client application from the RCP book http://eclipsercp.org • We’ll be building this application • Creating a repository • Publishing add-on bundles • Installing new bundles • Adding self update to the product • Using repository tools to create smaller components from the repository Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  34. 34. Tutorial requirements • Eclipse 3.6M6 http://download.eclipse.org/eclipse/downloads/drops/S- 3.6M6-201003121448 • >= 1.5 VM • Files from USB key that’s travelling around the classroom Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  35. 35. Installing the tutorial code • Start Eclipse 3.6M6 with a clean workspace • The samples.zip contains the repository that we’ll be using during the tutorial • Help->Add New Software->Add and select the location the file on disk • Accept the license and don’t worry about unsigned content. Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  36. 36. Introduction to the sample manager Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  37. 37. Exercise 1 – Target Platforms • Two large bodies of artifacts make-up your software system 1. The code you write 2. The libraries you use • We know lots about the code you write (SCM Systems, software processes, etc…) • How do you manage your libraries? • These are considered your “target” • Eclipse developers often use the Eclipse SDK as their target • There are better options Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  38. 38. Exercise 1 – Target Platforms • PDE provides facilities to help you manage your target • We don’t need JDT or PDE in our chat client • Create a target based on the Eclipse Platform + Delta Pack Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  39. 39. Create a target platform • Window -> preferences -> Plugin development -> Target platform • Add Empty Target • Select directory • Add new target platform from the directory when you have extracted the SDK and delta pack zips Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  40. 40. Exercise 2 – Adding a little p2 • Reusing the Eclipse SDK UI • Reusing the UI in its entirety is easy • A variety of techniques can be used to customize the UI Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  41. 41. Versioning • Every IU has the following identifiers • Major.minor.service.qualifier • 3.6.0.v20100129 • Major – breaking API • Minor – new API • Service – bug fix • Qualifier – SCM tag or build id • IU version must increase lexicographically for a successful install • NEVER rebuild and keep the same version number. • Ensure that your plugin has a .qualifier at the end! Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  42. 42. Configure the UI Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  43. 43. Include the p2 bundles • We have provided a simple p2 feature that includes everything you need • Simply add the feature to your product Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  44. 44. Add the feature and launch Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  45. 45. A Variety of Options • Use the p2 API to create your own update UI • Reuse the existing p2 UI in its entirety • Customize the existing p2 UI Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  46. 46. Customizing the UI Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  47. 47. Eclipse 3.6 – New UI Options Simplifying update and extension install for RCP applications Steffen Pingel Susan McCourt Wednesday, 15:45, 25 minutes Grand Ballroom Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  48. 48. Exercise 3 – Product Builds • Using PDE/Build to create p2 enabled products Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  49. 49. pde build • PDE build generates Ant scripts based on the inputs that your provide to the build. • These Ant scripts are run to create the build artifacts • Example scripts exist in the templates directory Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  50. 50. Enabling p2 in your build • Options to enable in your feature or product build’s build.properties • p2.gathering=true • Publishes p2 metadata for all bundles, features, product builds and pre-existing binary bundles • p2.compress=true • Creates artifacts.jar and content.jar files (XML by default) Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  51. 51. Enabling p2 in your build • p2.build.repo • Default value is file:${buildDirectory}/buildRepo • Build time repository • The artifacts and metadata will be mirrored from ${p2.build.repo} and into the values of ${p2.artifacts.repo} and ${p2.metadata.repo} are defined. Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  52. 52. Product builds • Eclipse bundles + custom branding • Platform specific options for VM args, program arguments • Specify startup levels for bundles • Custom splash Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  53. 53. Creating a builder Create a builder with a top level build.properties file: # Product and packaging control # Cross platform building product= configs=win32, win32, x86 & linux, gtk, x86 /org.eclipsercp.hyperbola.product/hyperbola.product runPackager=true # CVS Access control archivePrefix=hyperbola skipMaps=true mapsRepo= # Build naming and locatingion :pserver:anonymous@example.com</path/to/repo> buildDirectory=${user.home}/eclipse.build mapsRoot=<path/to/maps> buildType=I mapsCheckoutTag=HEAD buildId=TestBuild skipFetch=true buildLabel=${buildType}.${buildId} # Publish the build to a p2 repository # Base identification and location p2.gathering = true skipBase=true p2.metadata.repo = pluginPath= file://${buildDirectory}/repository/hyperbola p2.artifact.repo = file://${buildDirectory}/repository/hyperbola p2.compress = true # Java class libraries and compile controls #bootclasspath=${java.home}/lib/rt.jar compilerArg= Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  54. 54. Running the Builder • Create ${buildDirectory}. • Create ${buildDirectory}/plugins. • Create ${buildDirectory}/features. • Copy the required feature projects to the features directory and plug-in projects to the plugins directory. cd <workspace location>hyperbola.builder c:ideeclipseeclipse.exe -application org.eclipse.ant.core.antRunner -buildfile productBuild.xml -consolelog Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  55. 55. Running the Builder Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  56. 56. Building SDKs • Software developer kits provide • Binaries • Source • Documentation • SDK features • Include binary feature • Generate source feature generate.feature@org.yourfeature.source=org.yourfeature SDK build.properties individualSourceBundles=true Top level build.properties http://wiki.eclipse.org/PDEBuild/Individual_Source_Bundles Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  57. 57. Exercise 4 • Creating a Voice Over IP feature • Export from the workspace • Install the add-on using the UI • Install the add-on using the director Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  58. 58. Feature builds • Features are collections of bundles with related functionality. Example org.eclipse.pde feature Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  59. 59. Update your target • Add on providers don’t have access to your SCM • Add on providers don’t want access to your SCM • Add on provider need access to your builds • You can include the results of your product in your target Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  60. 60. Update your target Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  61. 61. Update your target Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  62. 62. Categories • If features are not categorized they will not show up • Most developers worry about the producers version of the world • Categories help define a consumers version of the world • Use the category editor define categories Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  63. 63. Voice Chat • Exercise 4 contains a simple VoIP feature • Integrates with Hyperbola to add voice chat • Load the code and export the feature • Generate a p2 metadata repository Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  64. 64. Installing the feature • We all know how to install the feature using the UI DO NOT USE E DROPINS! OT US DO N I NS ! DO DROP DRO NOT U SE PINS ! U SE D O T S! D NO NO PIN R O T DO RO PI U N SE D S! • We can also install it from the command line • We use the director application to affect RCP installs Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  65. 65. director • Invoke provisioning operations in a headless manner • Install • Uninstall • Update? Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  66. 66. Director app from within IDE Install pde feature into new directory Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  67. 67. director example d:buildereclipsec.exe -application org.eclipse.equinox.p2.director –metadataRepository http://download.eclipse.org/releases/helios/ –artifactRepository http://download.eclipse.org/releases/helios/ -installIU org.eclipsercp.voice.feature.feature.group -destination d:/eclipse/ -profile SDKProfile Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  68. 68. Voice Over IP Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  69. 69. The p2 UI Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  70. 70. Exercise 5 – Feature builds Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  71. 71. Adding the voice feature • Like product builds, PDE supports building features • We just want a repository to represent our feature • To build our Voice feature we need two different requirements • The Eclipse Platform • The Hyperbola Platform • For the hyperbola platform, we can use the repositories we generated earlier Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  72. 72. Feature build.properties # Feature identification # SCM Access control topLevelElementType = feature skipMaps=true topLevelElementId = skipFetch=true org.eclipsercp.voice.feature archivePrefix=voip_feature # Publish the build to a p2 repository p2.gathering = true # Build naming and location buildDirectory=${user.home}/feature.build # Cross platform building configs = *, *, * # Base identification and location skipBase=true baseLocation=C:/hyperbola_prereqs repoBaseLocation= <hyperbolaBuildLocation>/repository transformedRepoLocation= ${buildDirectory}/transformedRepo Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  73. 73. Running the build • Create ${buildDirectory} • Create ${buildDirectory}/plugins. • Create ${buildDirectory}/features. • Copy the required plug-ins and feature to plugins/ and features/ directory. • Invoke org.eclipse.ant.core.antRunner as shown below: cd <workspace location>/feature.builder c:ideeclipseeclipse.exe -application org.eclipse.ant.core.antRunner –buildfile build.xml -consolelog Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  74. 74. Running the build Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  75. 75. Exercise 6 • Automatically update Hyperbola each time it starts Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  76. 76. How to update • Two ways to update • Look at all the IUs in your Profile • See if there are any “updates” available • Plan the update • Execute the update on the engine • Handle errors • Restart • Or • Create an UpdateOperation • Execute the Operation Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  77. 77. Update on startup Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  78. 78. Operation API • We have a much simpler API for the basic use case • Pre-canned Operations for Update, Install, Uninstall • Available in the “operations” bundle Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  79. 79. Setting your repositories • You likely want a pre-canned set of repositories to check • You can use a p2.inf file to supply this information Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  80. 80. Exercise • Setup hyperbola to auto update itself on startup. • Make some changes, rebuild, and continually update Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  81. 81. Metadata is immutable Reuse metadata to create subsets of functionality Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  82. 82. Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  83. 83. p2.repository.repo2runnable Specify source and destination Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  84. 84. repo2runnable • Transforms features and bundles into their installed form • For example, bundles that are in folder format will be extracted <p2.repo2runnable> <source dir="${sourcedir}“/> <destination="${destinationdir}/eclipse“/> </p2.repo2runnable> • By default, all IUs will be transformed but you can also specify nested <iu> elements Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  85. 85. Mirroring is slicing Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  86. 86. Mirroring repositories with p2 • Mirror a repository or a subset of the IUs to a new location • Separate applications to mirror metadata and artifacts Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  87. 87. p2.metadata.repository.mirrorApplication Specify source and destination Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  88. 88. p2.artifact.repository.mirrorApplication Specify source and destination Option to use a comparator against a baseline Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  89. 89. Exercise: Mirroring a Hyperbola subset • Use the metadata and artifact repository mirroring tools to mirror a subset of the Hyperbola product – perhaps one platform. • Not sure if we will have time for this Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  90. 90. One of these bundles is not like the other Bundle id + version = one set of bytes Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  91. 91. Consistent bundles with a comparator • If you use a different compiler to compile the same source, it’s not necessarily the same byte code • Use a comparator with a baseline to compare the bundles in the repository in the current ones being built. • Discard new bundles with the same bundle id + version • Bundles in product zip must be identical repository bundles Product build == p2 repo Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  92. 92. Composite repositories • Delineate artifacts and metadata into child repos compositeArtifacts.jar compositeContent.jar I20100210-0950/ I20100211-0900/ I20100212-1053/ • Child repository I20100211-0900 artifacts.jar content.jar features/ plugins/ Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  93. 93. get involved • p2 in the wiki http://wiki.eclipse.org/P2 • p2 mailing list p2-dev@eclipse.org • IRC #equinox-dev • p2 committers on twitter http://wiki.eclipse.org/Twitter • Project sets Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  94. 94. References • Version numbering http://wiki.eclipse.org/Version_Numbering • 2009 EclipseCon p2 tutorial http://www.slideshare.net/PascalRapicault/understanding- and-extending-p2-for-fun-and-profit • PDE Build Integration with p2 http://help.eclipse.org/galileo/index.jsp?nav=/4_2_2 • Adding Self Update to an RCP Application http://wiki.eclipse.org/Equinox/p2/Adding_Self- Update_to_an_RCP_Application • p2 director application http://wiki.eclipse.org/Equinox_p2_director_application Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  95. 95. Photo credits • Orange and knife by Safari11 http://www.sxc.hu/browse.phtml?f=view&id=983682 • Oranges by Stephanie Berghaeuser http://www.sxc.hu/photo/783917 • Sliced oranges shin0 http://www.sxc.hu/photo/278 • Recycle tag by jaylopez http://www.sxc.hu/photo/917290 • Cutlery by Oliver Delgado http://www.sxc.hu/browse.phtml?f=view&id=582099 • Director’s chair by Alek von Felkerzam http://www.sxc.hu/browse.phtml?f=view&id=814604 Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  96. 96. Legal notice • Copyright © IBM Corp., 2007-2010. All rights reserved. This presentation and the source code in it are made available under the EPL, v1.0. • Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. • Eclipse and the Eclipse logo are trademarks of Eclipse Foundation, Inc. • IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both. • Other company, product, or service names may be trademarks or service marks of others. • THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  97. 97. Extra slides Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  98. 98. p2.mirror Ant task • Allows you to mirror artifacts and metadata simultaneously • Filter by platform and specify IUs <p2.mirror source="file://${myRepo}"> <destination kind="metadata" location="file://${myNewRepo}" format="file://${myRepo}" /> <destination kind="artifact" location="file://${myNewRepo}" format="file://${myRepo}" /> <iu id=“org.eclipse.pde" version="" /> <iu id=“org.eclipse.pde.sdk" version="" /> <slicingOptions platformFilter="true" includeOptional="false" includeNonGreedy="false" followStrict="true" /> </p2.mirror> Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  99. 99. remove.iu Ant task • Remove IUs from the repository • Remove all packed jars from a repo <p2.remove.iu> <repository location="file://${myRepo}" /> <iu query="" artifacts="(format=packed)" /> </p2.remove.iu> • Remove specific IUs <p2.remove.iu> <repository location="file://${myRepo}" /> <iu id="com.ibm.icu" artifacts="(format=packed)" /> </p2.remove.iu> Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  100. 100. p2.composite.{artifact|metadata}.repository • Create composite artifact and metadata repositories <p2.composite.artifact.repository.create location="file://${myRepo}" name="${p2.repo.name}" compressed="true" failOnExists="false" /> <p2.composite.metadata.repository.create location="file://${myRepo}" name="${p2.repo.name}" compressed="true" failOnExists="false" /> • Add children <p2.composite.artifact.repository.add location="file://${myRepo}" child="${buildId}" /> <p2.composite.metadata.repository.add location="file://${myRepo}" child="${buildId}" /> </target> Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  101. 101. Repository management best practices • Implement composite repositories • Use repository tools to modify the contents of a repository • Life cycle of a repository • How to specify mirrors in your repository? (Not sure if this is too much detail) Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  102. 102. publisher • The p2 publisher was integrated into pde build in 3.5M5. • Features and bundles are gathered from source and published to a repository • Can publish • Feature and bundles • Products • Categories • Update site • From an existing install • Enabling the publisher will create a repository for all platforms you are building. Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  103. 103. p2 and agile software development Develop p2 repository Test Build Assemble Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.

×