Skip to content

Commit

Permalink
First version
Browse files Browse the repository at this point in the history
Signed-off-by: Benoit Maggi <[email protected]>
  • Loading branch information
bmaggi committed Nov 15, 2017
1 parent e94a63b commit 887ce51
Show file tree
Hide file tree
Showing 114 changed files with 3,750 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

#
# The above will handle all files NOT found below
#
# These files are text and should be normalized (Convert crlf => lf)
*.classpath text
*.css text
*.htm text
*.html text
*.ini text
*.java text
*.js text
*.json text
*.jsp text
*.jspf text
*.LICENSE text
*.md text
*.mediawiki text
*.MF text
*.project text
*.properties text
*.sh text
*.svg text
*.test text
*.tsv text
*.txt text

# These files are binary and should be left untouched
# (binary is a macro for -text -diff)
*.bmp binary
*.class binary
*.dll binary
*.ear binary
*.gif binary
*.ico binary
*.jar binary
*.jpg binary
*.jpeg binary
*.pdf binary
*.png binary
*.so binary
*.war binary

17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
*.log
bin/
*.class
*.java._trace
*.pyc
.DS_Store
.settings/
.project
.classpath
# sonarlint temporary directory
sonarlint/
83 changes: 82 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,82 @@
# tycho-rules
tycho-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.

#Status
Codeship [ ![Codeship Status for bmaggi/custom-enforcer-rules](https://codeship.com/projects/df4dead0-12a2-0134-4498-76fd620179ca/status?branch=master)](https://codeship.com/projects/157406)

License [![License](https://img.shields.io/badge/license-EPL-blue.svg)](https://www.eclipse.org/legal/epl-v10.html)

# How to build

This project is built using Maven.
To build locally, simply execute the command line:

```
mvn clean install
```

You can also chose the it test with this command

```
mvn invoker:run -Dinvoker.test=checkexportpackage,checkexportpackage.failing
```

# 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>com.github.bmaggi.checks</groupId>
<artifactId>tycho-rules</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>custom-enforce</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<!-- define your rules here see Rules.md -->
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
```

# How to make a release
## Check that you are using latest version
```
mvn versions:display-dependency-updates
mvn versions:display-plugin-updates
```

## To release on maven central.
```
mvn release:clean release:prepare
```
follow by
```
mvn release:perform
```

[1]:https://maven.apache.org/
[2]:https://eclipse.org/tycho/
[3]:http://www.osgi.org/
90 changes: 90 additions & 0 deletions Rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# List of available rules

## Rule 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="com.github.bmaggi.tycho.rules.CheckManifestParameter">
<field>Bundle-Localization</field>
<value>plugin</value>
</myCustomRule>
```

## Rule RequireBundleVersion

Check that all required bundle have *bundle-version* set.

```xml
<myCustomRule implementation="com.github.bmaggi.tycho.rules.RequireBundleVersion">
</myCustomRule>
```

## Rule 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="com.github.bmaggi.tycho.rules.RequireBundleOrder">
<order>
<namespace>org.eclipse.ui</namespace>
<namespace>org.eclipse.core</namespace>
</order>
<inverse>false</inverse>
</myCustomRule>
```

## Rule CheckExportPackage

Check that all package are exported

```xml
<myCustomRule implementation="com.github.bmaggi.tycho.rules.CheckExportPackage">
</myCustomRule>
```

## Rule 5 CheckReexportBundle

Check that the bundle contained in the namespace is reexported

```xml
<myCustomRule implementation="com.github.bmaggi.tycho.rules.CheckReexportBundle">
<namespace>org.eclipse.ui</namespace>
</myCustomRule>
```
## Rule ManifestHeaderOrder

Check that the manifest is following the standard order.
This order is hard-coded for the moment.

```xml
<myCustomRule implementation="com.github.bmaggi.tycho.rules.ManifestHeaderOrder">
</myCustomRule>
```

## Rule RequireFeatureProvider

Check the feature provider-name (vendor)
( Should change to check different values in the feature.xml file)

```xml
<myCustomRule implementation="com.github.bmaggi.tycho.rules.RequireFeatureProvider">
<provider>myself</provider>
</myCustomRule>
```

## Rule ExtensionPointDocumentation

Check the extension point to ensure that there is documentation

```xml
<myCustomRule implementation="com.github.bmaggi.tycho.rules.ExtensionPointDocumentation">
<provider>myself</provider>
</myCustomRule>
```
Loading

0 comments on commit 887ce51

Please sign in to comment.