| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html> |
| <head> |
| <meta name="copyright" |
| content="Copyright (c) IBM Corporation and others 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page."> |
| <meta http-equiv="Content-Type" |
| content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" |
| type="text/css"> |
| <title>Generating Source Features and Plug-ins</title> |
| </head> |
| <body style="background-color: rgb(255, 255, 255);"> |
| <h1>Generating Source Features and Plug-ins<br> |
| </h1> |
| PDE Build can generate a source feature or plug-in. Consider the |
| following SDK feature:<br> |
| <div style="text-align: left; margin-left: 40px;"> |
| <pre>features/<br> org.foo.sdk/<br> feature.xml: <includes id="org.foo.rcp" /><br> <includes id="org.foo.rcp.source" /><br> build.properties: generate.feature@org.foo.rcp.source = org.foo.rcp<br> org.foo.rcp/<br> feature.xml: <plugin id="org.foo.BundleA" /><br> <plugin id="org.foo.BundleB" /><br> <plugin id="org.foo.BundleB.win32" fragment="true" os="win32" /><br></pre> |
| </div> |
| <br> |
| The idea of the SDK is that it includes a feature as well as |
| the source for that feature. Notice |
| the <tt>generate.feature</tt> property in the feature's |
| build.properties |
| file. This property tells PDE Build to generate a feature named |
| "<tt>org.foo.rcp.source</tt>" based on the contents of the feature |
| "<tt>org.foo.rcp</tt>". PDE build will generate an |
| org.foo.rcp.source feature, a plugin that |
| will contain the source code, and fragments containing the source of |
| any platform specific bundles that were included in the feature:<br> |
| <div style="text-align: left; margin-left: 40px;"> |
| <pre>features/<br> org.foo.rcp.source/<br> feature.xml: <plugin id="org.foo.rcp.source"/><br> <plugin id="org.foo.rcp.source.win32" fragment="true" os="win32" /><br>plugins/<br> org.foo.rcp.source/src/<br> org.foo.BundleA/src.zip<br> org.foo.BundleB/src.zip<br> org.foo.rcp.source.win32/src/<br> org.foo.BundleB.win32/src.zip<br> <br></pre> |
| </div> |
| <h2>Customizing the Generated Source Feature<br> |
| </h2> |
| The generate.feature property has the following form:<br> |
| <pre style="text-align: left;">generate.feature@<source feature id> = <feature id> [, feature@<feature id>] [, plugin@<plugin id>[;version=<pluginVersion>][;unpack="false"]]<br></pre> |
| <ul> |
| <li><span style="font-weight: bold;"><source feature id>:</span> |
| This is the id of the source feature and plug-in to be generated. |
| Normally it is something like <feature id>.source</li> |
| <li><span style="font-weight: bold;"><feature id></span>: |
| The feature on which to base the source feature, the source for all |
| contained plug-ins will be collected into the <source feature id> |
| plugin.</li> |
| <li><span style="font-weight: bold;">feature@<feature id></span>: |
| This will include the named feature in the generated source feature.</li> |
| <li><span style="font-weight: bold;">plugin@<plug-in id></span>: |
| This will include the named plug-in in the generated source feature. |
| If the plug-in is JARed specify <span style="font-weight: bold;">unpack="false"</span>. If multiple versions |
| of the plug-in are available, specify the requested version using <span style="font-weight: bold;">version=<pluginVersion></span> followed by <tt>qualifier</tt>.</li> |
| </ul> |
| Use plugin@ to add additional plug-ins that weren't part of the |
| original feature to the generated source feature. This is useful |
| for documentation plug-ins. The feature@ together with a source |
| template can be used to nest source features (see below).<br> |
| <h3>Source Templates</h3> |
| The feature from which the source feature is being generated can |
| provide template files to be included in the generated source feature:<br> |
| <div style="text-align: left; margin-left: 40px;"> |
| <pre>features/<br> org.foo.rcp/<br> sourceTemplateFeature/<files to be included in generated source feature><br> sourceTemplatePlugin/<files to be included in generated source plugin><br> sourceTemplateFragment/<files to be included in generated platform specific fragments><br></pre> |
| </div> |
| <p>Any files located in these sourceTemplate folder will be included in |
| the appropriate generated feature/plug-in/fragment. Specifically, |
| files from these directories will replace files generated by PDE |
| build. This can be used to provide a custom feature.xml if there |
| are requirements for your source feature that PDE build does not |
| support.<br> |
| </p> |
| <h4>Nesting Generated Source Features</h4> |
| <p>You can nest source features by providing a |
| sourceTemplateFeature/build.properties file for your generated source |
| feature that contains a generate.feature property for the nested source |
| feature. You will also need to ensure that your top source |
| feature.xml includes the nested source feature, do this either by using |
| feature@ or by providing a template feature.xml:<br> |
| </p> |
| <div style="text-align: left; margin-left: 40px;"> |
| <pre>features/<br> org.foo.sdk/<br> sourceTemplateFeature/<br> build.properties: generate.feature@org.foo.nested.source = org.foo.nested<br><br> feature.xml: <includes id="org.foo.rcp" /><br> <includes id="org.foo.rcp.source" /><br><br> build.properties: generate.feature@org.foo.rcp.source = org.foo.rcp, feature@org.foo.nested.source<br><br> org.foo.rcp/...<br> org.foo.nested/...<br></pre> |
| </div> |
| In the above example, org.foo.sdk contains a generated source |
| feature named org.foo.rcp.source. This generated source feature |
| will get the template sourceTemplateFeature/build.properties |
| file. It will also include org.foo.nested.source in its |
| feature.xml. So when PDE build is processing the generated |
| org.foo.rcp.source, it sees the inclusion of the org.foo.nested.source |
| feature and the generate.feature property and then generates the |
| org.foo.nested.source.<br> |
| <h2>Generating a Source Plug-in</h2> |
| <p>It is also possible to generate a single source plug-in based on a |
| feature instead of generating an entire source feature. The |
| property to do this is:</p> |
| <p style="text-align: center;"><tt>generate.plugin@<source plug-in |
| id>=<feature-in id></tt></p> |
| Example: |
| <div style="text-align: left; margin-left: 40px;"> |
| <pre>features/<br> org.foo.sdk/<br> feature.xml: <plugin id="org.foo.rcp" /><br> <plugin id="org.foo.sdk.source" /><br> <br> build.properties: generate.plugin@org.foo.sdk.source = org.foo.sdk<br></pre> |
| </div> |
| <br> |
| <br> |
| </body> |
| </html> |