SlideShare a Scribd company logo
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.
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.
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.
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.
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.
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.
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.
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.
Unzipping is not Installing




                   Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
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.
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.
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.
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.
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.
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 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Introduction to the sample manager




                 Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
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.
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.
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.
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.
Configure the UI




                   Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
Add the feature and launch




                 Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
Customizing the UI




                     Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
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.
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.
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.
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.
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.
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.
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.
Running the Builder




                  Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
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.
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.
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.
Update your target




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




                 Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
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.
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.
director




                                             • Invoke provisioning
                                               operations in a
                                               headless manner
                                                   • Install
                                                   • Uninstall
                                                   • Update?




           Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
Director app from within IDE




Install pde
feature into new
directory

                   Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
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 under EPL, v1.0.
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.
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.
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.
Running the build




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




• Automatically update Hyperbola each time it starts



                    Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
Update on startup




                    Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
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.
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.
Metadata is immutable


 Reuse metadata




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




Specify source and destination


                        Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
Mirroring is slicing




               Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
p2.metadata.repository.mirrorApplication




Specify source and destination

                       Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.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.
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.
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.
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.
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.
p2 and agile software development


                                 Develop




                          p2 repository
         Test                                                                    Build




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

More Related Content

PPTX
Discovering the p2 API
PPT
Understanding and extending p2 for fun and profit
PDF
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
PPTX
Do's and Do not's about p2
PPTX
Discovery the p2 API (updated to Indigo)
PPT
Eclipse Plug-in Develompent Tips And Tricks
KEY
Tycho - Building plug-ins with Maven
PPTX
Tycho Tutorial EclipseCon 2013
Discovering the p2 API
Understanding and extending p2 for fun and profit
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
Do's and Do not's about p2
Discovery the p2 API (updated to Indigo)
Eclipse Plug-in Develompent Tips And Tricks
Tycho - Building plug-ins with Maven
Tycho Tutorial EclipseCon 2013

What's hot (20)

PPT
Managing Your Runtime With P2
PPT
Sleep Peacefully as Maven Tycho Builds your Product
PDF
2015 11-04 HEADS at EclipseCon: Modelling Things for IoT
PDF
Eclipse plug in development
PPTX
PDE builds or Maven
PPTX
Building Eclipse Plugins
PDF
EEF : Sexy Properties, Wizards and Views - EclipseCon 11
ODP
PDE Good Practices
ODP
Migrating to Git: Rethinking the Commit
KEY
L0016 - The Structure of an Eclipse Plug-in
KEY
OSGi, Eclipse and API Tooling
PPT
Compare framework
PDF
Using Go in DevOps
PPT
Automating the consumption of Eclipse for internal use
PDF
Building Good Containers for Python Applications
PDF
Lua on Steroids - EclipseCon NA 2012
PPTX
Building Microservices with Jakarta EE and MicroProfile - EclipseCon 2019
PDF
Dr. Strangelove, or how I learned to love plugin development
PPTX
Migrating from PDE to Tycho builds
PPTX
Cross-platform Mobile Development on Open Source
Managing Your Runtime With P2
Sleep Peacefully as Maven Tycho Builds your Product
2015 11-04 HEADS at EclipseCon: Modelling Things for IoT
Eclipse plug in development
PDE builds or Maven
Building Eclipse Plugins
EEF : Sexy Properties, Wizards and Views - EclipseCon 11
PDE Good Practices
Migrating to Git: Rethinking the Commit
L0016 - The Structure of an Eclipse Plug-in
OSGi, Eclipse and API Tooling
Compare framework
Using Go in DevOps
Automating the consumption of Eclipse for internal use
Building Good Containers for Python Applications
Lua on Steroids - EclipseCon NA 2012
Building Microservices with Jakarta EE and MicroProfile - EclipseCon 2019
Dr. Strangelove, or how I learned to love plugin development
Migrating from PDE to Tycho builds
Cross-platform Mobile Development on Open Source
Ad

Viewers also liked (17)

PDF
GMF : Create your graphical DSL - EclipseCon 11
PDF
SCR Annotations for Fun and Profit
PDF
The ultimate dependency manager shoot out - X Uiterlinden & S Mak
KEY
OSGi For Eclipse Developers
PPTX
Els gossos
ODP
P2 slideshare
PPT
Power point gossos
PPT
PRESENTACIÓ DELS GOSSOS P3
PPTX
Els aliments
PDF
OSGi Blueprint Services
PPT
Projecte gossos p4
PPTX
Projecte: com creixen les flors?
PPT
Panda
PPT
Tema2 els aliments
ODP
Els Aliments
PPTX
Physics Unit P2
PPT
Methods of cooking ppt
GMF : Create your graphical DSL - EclipseCon 11
SCR Annotations for Fun and Profit
The ultimate dependency manager shoot out - X Uiterlinden & S Mak
OSGi For Eclipse Developers
Els gossos
P2 slideshare
Power point gossos
PRESENTACIÓ DELS GOSSOS P3
Els aliments
OSGi Blueprint Services
Projecte gossos p4
Projecte: com creixen les flors?
Panda
Tema2 els aliments
Els Aliments
Physics Unit P2
Methods of cooking ppt
Ad

Similar to P2 Introduction (20)

PDF
Who Took The Cookie From The Cookie Jar?
PPT
ABC of Platform Workspace
PPT
Orion Introduction
PDF
Software update for IoT Embedded World 2017
PPT
Orion Introduction
PDF
Orion (What's Next conference)
PPTX
Appium overview (Selenium Israel #2, Feb. 2014)
PDF
Oracle Java ME Embedded 8.1 Devloper Preview: Introduction
PDF
Keynote - Eclipse - Accelerating OSGi Adoption - Mike Milinkovich, Executive ...
PDF
OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation
PDF
stackconf 2022: It’s Time to Debloat the Cloud with Unikraft
PPTX
Deploy and Update Jakarta EE & MicroProfile applications with Paketo.pptx
PDF
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
PDF
Easy Docker Deployments with Mesosphere DCOS on Azure
PDF
EclipseCon 2010 - What's new in JDT
PDF
What's New In JDT ?
PDF
Introducing the Embedded Rich Client Platform (eRCP) - Jim Robbins, IBM
PDF
Kolla - containerizing the cloud itself
PDF
Randstad Docker meetup - Serverless
PPTX
MWLUG - Universal Java
Who Took The Cookie From The Cookie Jar?
ABC of Platform Workspace
Orion Introduction
Software update for IoT Embedded World 2017
Orion Introduction
Orion (What's Next conference)
Appium overview (Selenium Israel #2, Feb. 2014)
Oracle Java ME Embedded 8.1 Devloper Preview: Introduction
Keynote - Eclipse - Accelerating OSGi Adoption - Mike Milinkovich, Executive ...
OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation
stackconf 2022: It’s Time to Debloat the Cloud with Unikraft
Deploy and Update Jakarta EE & MicroProfile applications with Paketo.pptx
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
Easy Docker Deployments with Mesosphere DCOS on Azure
EclipseCon 2010 - What's new in JDT
What's New In JDT ?
Introducing the Embedded Rich Client Platform (eRCP) - Jim Robbins, IBM
Kolla - containerizing the cloud itself
Randstad Docker meetup - Serverless
MWLUG - Universal Java

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Advanced IT Governance
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Big Data Technologies - Introduction.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Advanced IT Governance
The Rise and Fall of 3GPP – Time for a Sabbatical?
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
NewMind AI Weekly Chronicles - August'25 Week I
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
CIFDAQ's Market Insight: SEC Turns Pro Crypto
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Advanced Soft Computing BINUS July 2025.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Big Data Technologies - Introduction.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
“AI and Expert System Decision Support & Business Intelligence Systems”
Unlocking AI with Model Context Protocol (MCP)

P2 Introduction

  • 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. 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. 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. 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. 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. 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. 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. 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. Unzipping is not Installing Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. 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. 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. 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. Where’s p2 ? Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. Introduction to the sample manager Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. 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. 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. Configure the UI Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. Add the feature and launch Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. Customizing the UI Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. 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. 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. 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. 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. 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. Running the Builder Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. 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. Update your target Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 61. Update your target Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. 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. 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. 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. Voice Over IP Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 69. The p2 UI Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 70. Exercise 5 – Feature builds Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. Running the build Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 75. Exercise 6 • Automatically update Hyperbola each time it starts Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. Update on startup Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. Metadata is immutable Reuse metadata to create subsets of functionality Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 82. Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 83. p2.repository.repo2runnable Specify source and destination Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. Mirroring is slicing Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. p2.metadata.repository.mirrorApplication Specify source and destination Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. Extra slides Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
  • 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. 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. 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. 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. 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. p2 and agile software development Develop p2 repository Test Build Assemble Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.