>> Friday, January 28, 2011
This is the best Eclipse license I've ever seen.
Conversely, dealing with license files in Eclipse features is a bit painful. Today, each time the Eclipse license changes, you need to copy the new license files to your features. The license files included in the Eclipse SDK are highlighted below:
These same files are included in the 46 features that the Eclipse and RT Equinox project builds. This is very tedious to update when the license files change. Lots of copy and paste. The license text also appears in the feature.properties.
In Eclipse 3.7M4, the PDE and p2 teams added support for shared licenses.
The license files will be copied from the license feature to the feature that refers to it. In 3.7M5, I modified our features to use this shared licenses. For instance, the beginning of the feature.xml for the Eclipse SDK now looks like this:
To implement this, I followed these steps.
1. Create a license feature. This feature doesn't include any bundles or features. It only stores the license files which its build.properties reference. The feature.properties has only two properties - the licenseURL and license.
2. Update the existing features to reference the license feature. Remove the license files from these features. Remove the references to the license files from your feature's build.properties. The values will be inherited from the build.properties of the license feature. Remove the name and values of licenseURL and license from the feature.properties. These will be included from the license feature. Ensure that you don't have duplicate properties in the feature.properties of the license feature and feature your are updating. This will cause a build failure.
3. Update your map files to include to the new feature. You don't need to nest the feature in another feature to fetch it, this happens automatically. For example, this is where our license feature is located
4. Run a test build. Fix typos until you have a clean build. Verify that all your features still include the appropriate license files.
There isn't an IU for the license feature included in the p2 repository. The license text is included in the metadata.
Note that you'll need to build with 3.7M5 bundles. There was a bug in the 3.7M4 bundles that prevented shared licenses from working in generated source features.
The advantage of this approach is that when the license files are updated, we'll only need to update the license feature. We'll also have to increment the versions of the license feature in the referring feature, but that's a simple search and replace.
Some other implementation details: I could have also stored the copyright information in the feature.properties of the license feature. However, the copyrights of our features are not identical, so I didn't choose this approach. This may be useful for other teams.
Thanks to the PDE and p2 team for implementing this!
Bug 306818 - Improve license support in p2.
License mechanism description in wiki
Bug 332662 - Adopt new feature that allows to share the license file