Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
JDT UI/Howto/Create Feature Patch
This page explains how you can create a feature patch. E.g. to add that fix for the most annoying bug ever to the otherwise perfect JDT UI plug-in.
I'll just show how I've produced the output for bug 434941 comment 17, a feature patch on top of 4.4.1 that patches the org.eclipse.jdt.ui plug-in in the org.eclipse.jdt feature. You can adapt the versions/bundles to your concrete use case. Note that patching multiple features is a bit more complicated, since you need to create multiple patch features that depend on each other and mirror the dependencies between the original features.
Contents
Setup
- start up with the Eclipse version you want to create a patch for (4.4.1 / M20140925-0400)
- clone
git://git.eclipse.org/gitroot/jdt/eclipse.jdt.ui.git
- import the projects you need to touch (org.eclipse.jdt.ui)
- switch to the right branch (R4_4_maintenance) and make sure the patch is applied to your workspace
Shortcut if you just want to patch your existing install
(Skip this section if you want to create a feature patch that others can use as well!)
- select the project and choose Export > Deployable plug-ins and fragments
- select the plug-in to export (org.eclipse.jdt.ui)
- select Destination > Install into host
- click Finish
- confirm messages, restart, and enjoy
Create patch feature
- create New > Other... > Feature Patch
- give the project a unique name (org.eclipse.jdt.ui.bug434941.sortmembers)
- click Browse and select the feature that contains the plug-in (org.eclipse.jdt)
- click Finish
- In the feature.xml editor, go to the Plug-ins tab and add the plug-in to patch (org.eclipse.jdt.ui)
- fill out the rest of the forms.
feature.xml for this example |
---|
<?xml version="1.0" encoding="UTF-8"?> <feature id="org.eclipse.jdt.ui.bug434941.sortmembers" label="Sort Members patch for bug 434941" version="1.0.0" provider-name="Eclipse.org"> <description> Sort Members patch for bug 434941 </description> <copyright> Copyright (c) 2014 IBM Corporation and others </copyright> <license url="http://www.eclipse.org/legal/epl-v10.html"> Eclipse Public License v1.0 http://www.eclipse.org/legal/epl-v10.html </license> <requires> <import feature="org.eclipse.jdt" version="3.10.0.v20140910-2310" patch="true"/> </requires> <plugin id="org.eclipse.jdt.ui" download-size="0" install-size="0" version="0.0.0" unpack="false"/> </feature> |
- due to p2 bug 262009, you also have to create a New > Category Definition
- save the category.xml file in your patch feature project
- add a dummy category and add your new patch feature
resulting category.xml |
---|
<source lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <site> <feature url="features/org.eclipse.jdt.ui.bug434941.sortmembers_1.0.0.jar" id="org.eclipse.jdt.ui.bug434941.sortmembers" version="1.0.0" patch="true"> <category name="org.eclipse.jdt.ui.sortmembers.bug434941"/> </feature> <category-def name="org.eclipse.jdt.ui.sortmembers.bug434941" label="Dummy category for p2 bug 262009"> <description> Dummy; please vote for https://bugs.eclipse.org/bugs/show_bug.cgi?id=262009 . </description> </category-def> </site> |
Build and export feature patch
- open the feature.xml > Overview, and click Export Wizard, or open the "Deployable features" wizard under File > Export...
- make sure your feature is checked and specify an (empty) output directory
- switch to Options tab
- click the Browse button after Categorize repository and select your category.xml
- click Finish and go get a coffee
Publish
- when the export is done, publish the output directory on a website or put it into a ZIP for manual installs