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
open source
applications
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
•
•
Metadata Repository
•
•
Exists independently of the 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
Touchpoints
Engine
Profiles
Eclipse
Eclipse
Classic
Other
OS
Eclipse
for C++
Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.
p2 architecture
Metadata
fetched and
constraints
analyzed
Director
Data transfer
Transports
Mirroring
Provisioning
operation
requested
Repositories
IU install,
uninstall, update
operations
Engine
Http/Https
File system
Volume
p2
Update Site
Artifact availability
and mirroring
Eclipse/OSGi
Native/OS
IUs configured
into runtimes
Runtimes
Profile updated
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/S3.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
product=\
# Cross platform building
configs=win32, win32, x86 & linux, gtk, x86
runPackager=true
archivePrefix=hyperbola
# CVS Access control
skipMaps=true
mapsRepo=\
:pserver:anonymous@example.com</path/to/repo>
mapsRoot=<path/to/maps>
mapsCheckoutTag=HEAD
skipFetch=true
/org.eclipsercp.hyperbola.product/hyperbola.product
# Build naming and locatingion
buildDirectory=${user.home}/eclipse.build
buildType=I
buildId=TestBuild
buildLabel=${buildType}.${buildId}
# Base identification and location
skipBase=true
pluginPath=
# Publish the build to a p2 repository
p2.gathering = true
p2.metadata.repo =\
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:\ide\eclipse\eclipse.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
•
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:\builder\eclipsec.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
topLevelElementType = feature
topLevelElementId =
org.eclipsercp.voice.feature
archivePrefix=voip_feature
# Build naming and location
buildDirectory=${user.home}/feature.build
# SCM Access control
skipMaps=true
skipFetch=true
# Publish the build to a p2 repository
p2.gathering = true
# 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:\ide\eclipse\eclipse.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/understandingand-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_SelfUpdate_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
Test
p2 repository
Assemble
Build
Copyright © IBM Corp., EclipseSource 2010. All rights reserved. Licensed under EPL, v1.0.