| papyrus-enforcer-rules |
| ====================== |
| |
| # Project Description |
| A [Maven][1]/[Tycho][2] project to add some validation rules for [OSGI][3] development. |
| Most of the rules are pretty simple and are used to maintain coherence in a multi-plugin project. |
| |
| |
| # How to build |
| |
| This project is built using Maven. |
| To build locally, simply execute the command line: |
| |
| ``` |
| mvn clean install |
| ``` |
| |
| # How to use |
| |
| Configuration to add in the pom.xml of your project: |
| ```xml |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-enforcer-plugin</artifactId> |
| <version>${enforcer.api.version}</version> |
| <dependencies> |
| <dependency> |
| <groupId>org.eclipse.papyrus</groupId> |
| <artifactId>papyrus-enforcer-rules</artifactId> |
| <version>0.0.1-SNAPSHOT</version> |
| </dependency> |
| </dependencies> |
| <executions> |
| <execution> |
| <id>papyrus-enforce</id> |
| <phase>validate</phase> |
| <goals> |
| <goal>enforce</goal> |
| </goals> |
| <configuration> |
| <rules> |
| </rules> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| ``` |
| |
| |
| ## Rule 1 : org.eclipse.papyrus.tycho.enforcer.rules.CheckManifestParameter |
| |
| Check that a specific *field* in the manifest.mf is equals to a predefined *value* |
| Example : Check that *Bundle-Localization* is using the correct property file *plugin* |
| |
| ```xml |
| <myCustomRule implementation="org.eclipse.papyrus.tycho.enforcer.rules.CheckManifestParameter"> |
| <field>Bundle-Localization</field> |
| <value>plugin</value> |
| </myCustomRule> |
| ``` |
| |
| ## Rule 2 : org.eclipse.papyrus.tycho.enforcer.rules.RequireBundleVersion |
| |
| Check that all required bundle have *bundle-version* set. |
| |
| ```xml |
| <myCustomRule implementation="org.eclipse.papyrus.tycho.enforcer.rules.RequireBundleVersion"> |
| </myCustomRule> |
| ``` |
| |
| ## Rule 3 : org.eclipse.papyrus.tycho.enforcer.rules.RequireBundleOrder |
| |
| Check that required bundle are following a specific order. |
| Parameter : |
| - order : the expected order by namespace, all non listed namespace will be at the end |
| - inverse : inverse the order, useful to pill up unreferenced namespace at the top |
| |
| Example : Check that plugins starting by *org.eclipse.ui* are imported before plugins starting by *org.eclipse.core* |
| |
| ```xml |
| <myCustomRule implementation="org.eclipse.papyrus.tycho.enforcer.rules.RequireBundleOrder"> |
| <order> |
| <namespace>org.eclipse.ui</namespace> |
| <namespace>org.eclipse.core</namespace> |
| </order> |
| <inverse>false</inverse> |
| </myCustomRule> |
| ``` |
| |
| [1]:https://maven.apache.org/ |
| [2]:https://eclipse.org/tycho/ |
| [3]:http://www.osgi.org/ |
| |