|
| 1 | +# Category |
| 2 | + |
| 3 | +A category.xml file can be used to define which content is placed into a p2 repository. |
| 4 | +It can also specify how to display the content in the p2 installation dialog. |
| 5 | +For Tycho to use it, it must to be placed into the root of an project with the packaging type 'eclipse-repository'. |
| 6 | + |
| 7 | +The 'category.xml' format was originally defined by the Eclipse PDE project. |
| 8 | +There are extensions to the format only supported by p2 and Tycho. |
| 9 | + |
| 10 | +The following listing is a simple category file listing only one feature and one plug-in. |
| 11 | + |
| 12 | + |
| 13 | +``` |
| 14 | +<?xml version="1.0" encoding="UTF-8"?> |
| 15 | +<site> |
| 16 | + <feature id="com.example.feature"> |
| 17 | + <category name="com.example.category.update"/> |
| 18 | + </feature> |
| 19 | + <category-def name="com.example.category.update" label="Example update site"/> |
| 20 | +</site> |
| 21 | +``` |
| 22 | +The following is an example, demonstrating a complex category definition. |
| 23 | + |
| 24 | +``` |
| 25 | +<?xml version="1.0" encoding="UTF-8"?> |
| 26 | +<site> |
| 27 | + <!-- Include features --> |
| 28 | + <feature id="feature.id" version="1.4.100.v2009"/> |
| 29 | + <!-- Since Tycho 1.1.0 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=407273#c18), features can declare platform-specific compatibility for multi-platform builds --> |
| 30 | + <!-- Examples: https://github.com/mickaelistria/org.eclipse.simrel.build/blob/master/categories/category.xml#L581 --> |
| 31 | + <feature id="linux.specific.feature.id" version="0.0.0" os="linux"/> |
| 32 | + |
| 33 | + <!-- Directly include bundles, without a feature --> |
| 34 | + <bundle id="bundle.id" version="1.3.1.v2023"/> |
| 35 | + <!-- Directly include any iu --> |
| 36 | + <iu id="unit.id"/> |
| 37 | + <!-- Include all IUs matching an expression --> |
| 38 | + <iu> |
| 39 | + <query> |
| 40 | + <expression type="match"> |
| 41 | + <![CDATA[ |
| 42 | + id == $0 |
| 43 | + ]]> |
| 44 | + </expression> |
| 45 | + <param>another.unit.id</param> |
| 46 | + </query> |
| 47 | + </iu> |
| 48 | + |
| 49 | + <!-- Categories --> |
| 50 | + <feature id="feature.in.category"> |
| 51 | + <category name="category.id"/> |
| 52 | + </feature> |
| 53 | + <category-def name="category.id" label="Category Label"> |
| 54 | + <description>Details on the category</description> |
| 55 | + </category-def> |
| 56 | + |
| 57 | + <!-- example for a dynamic category --> |
| 58 | + <category-def name="javax" label="Bundles starting with javax."/> |
| 59 | + <iu> |
| 60 | + <category name="javax"/> |
| 61 | + <query><expression type="match">id ~= /javax.*/</expression></query> |
| 62 | + </iu> |
| 63 | +</site> |
| 64 | +``` |
0 commit comments